1 19 package org.netbeans.modules.tasklist.core; 20 21 import org.openide.nodes.Node; 22 import org.openide.util.HelpCtx; 23 import org.openide.util.NbBundle; 24 import org.openide.util.actions.NodeAction; 25 26 import javax.swing.*; 27 import java.awt.*; 28 29 30 36 public class GoToTaskAction extends NodeAction { 37 38 private static final long serialVersionUID = 1; 39 40 protected boolean asynchronous() { 41 return false; 42 } 43 44 47 protected void performAction(Node[] nodes) { 48 final TaskListView tlv = TaskListView.getCurrent(); 49 if (tlv != null) { 50 final Task item = TaskNode.getTask(nodes[0]); assert item != null; 52 SwingUtilities.invokeLater(new Runnable () { public void run() { 54 tlv.showTaskInEditor(item, null); 55 } 56 }); 57 } else { 58 Toolkit.getDefaultToolkit().beep(); 60 } 61 } 62 63 65 protected boolean enable(Node[] nodes) { 66 if ((nodes == null) || (nodes.length != 1)) { 67 return false; 68 } 69 Task item = TaskNode.getTask(nodes[0]); 70 if (item == null) { 71 return false; 72 } 73 return (item.getLine() != null); 74 } 75 76 public String getName() { 77 return NbBundle.getMessage(GoToTaskAction.class, "LBL_Goto"); } 79 80 protected String iconResource() { 81 return "org/netbeans/modules/tasklist/core/showSource.gif"; } 83 84 public HelpCtx getHelpCtx() { 85 return HelpCtx.DEFAULT_HELP; 86 } 89 } 90 | Popular Tags |