1 19 20 package org.netbeans.modules.tasklist.usertasks.actions; 21 22 import java.awt.datatransfer.Clipboard ; 23 import java.awt.event.ActionEvent ; 24 import javax.swing.TransferHandler ; 25 import javax.swing.event.ListSelectionEvent ; 26 import javax.swing.tree.TreePath ; 27 import org.netbeans.modules.tasklist.usertasks.UserTaskListTreeTableNode; 28 import org.netbeans.modules.tasklist.usertasks.UserTaskView; 29 30 35 public final class UTCutAction extends UTViewAction { 36 41 public UTCutAction(UserTaskView utv) { 42 super(utv, javax.swing.text.DefaultEditorKit.copyAction); 43 } 44 45 public void valueChanged(ListSelectionEvent e) { 46 TreePath [] paths = utv.getTreeTable().getSelectedPaths(); 47 boolean enabled = true; 48 for (int i = 0; i < paths.length; i++) { 49 if (paths[i].getLastPathComponent() instanceof 50 UserTaskListTreeTableNode) { 51 enabled = false; 52 break; 53 } 54 } 55 setEnabled(enabled); 56 } 57 58 public void actionPerformed(ActionEvent e) { 59 TransferHandler th = utv.getTreeTable().getTransferHandler(); 60 Clipboard clipboard = utv.getToolkit().getSystemClipboard(); 61 th.exportToClipboard(utv.getTreeTable(), clipboard, 62 TransferHandler.MOVE); 63 } 64 } 65 | Popular Tags |