1 19 package org.netbeans.test.editor.app.gui.actions; 20 21 import org.netbeans.test.editor.app.Main; 22 import org.netbeans.test.editor.app.core.TestNode; 23 import org.netbeans.test.editor.app.gui.RenameDialog; 24 import org.netbeans.test.editor.app.gui.actions.TreeNodeAction; 25 import org.netbeans.test.editor.app.gui.tree.TestNodeDelegate; 26 27 32 public class TestRenameAction extends TreeNodeAction { 33 34 35 public TestRenameAction() { 36 } 37 38 public boolean enable(TestNodeDelegate[] activatedNodes) { 39 if (activatedNodes.length == 1) 40 return true; 41 else 42 return false; 43 } 44 45 public void performAction(TestNodeDelegate[] activatedNodes) { 46 if (activatedNodes.length == 1) { 47 TestNode node=activatedNodes[0].getTestNode(); 48 RenameDialog dlg=new RenameDialog(Main.frame,node.getName()); 49 dlg.show(); 50 if (dlg.getState()) { 51 node.setName(dlg.getName()); 52 } 53 } 54 } 55 56 public String getHelpCtx() { 57 return "Rename selected node."; 58 } 59 60 public String getName() { 61 return "Rename"; 62 } 63 64 } 65 | Popular Tags |