1 19 20 21 package org.netbeans.tests.j2eeserver.plugin.registry; 22 23 import org.openide.nodes.*; 24 import org.openide.util.actions.*; 25 import java.util.*; 26 import org.netbeans.tests.j2eeserver.plugin.jsr88.*; 27 28 32 public class TargNode extends AbstractNode { 33 static Node[] getNodes() { 34 Node[] bogusNodes = new Node[] { Node.EMPTY.cloneNode(), Node.EMPTY.cloneNode() }; 35 bogusNodes[0].setName("Bogus1"); bogusNodes[0].setDisplayName("Bogus 1"); 36 bogusNodes[1].setName("Bogus2"); bogusNodes[1].setDisplayName("Bogus 2"); 37 return bogusNodes; 38 } 39 40 public TargNode(Targ targ) { 41 super(new MyChildren(Arrays.asList(getNodes()))); 42 setDisplayName("Original:"+ targ.getName()); 43 setIconBase("org/netbeans/tests/j2eeserver/plugin/registry/target"); 44 } 45 46 public javax.swing.Action [] getActions(boolean context) { 47 return new javax.swing.Action [] { 48 SystemAction.get(TargetAction.class) 49 }; 50 } 51 52 public PropertySet[] getPropertySets() { 53 Sheet sheet = Sheet.createDefault(); 54 Sheet.Set ps = sheet.get(Sheet.PROPERTIES); 55 ps.setName("TargetServer"); 56 ps.setDisplayName("Target Server"); 57 ps.put(new PropertySupport.ReadWrite( 58 "DebugPort", String .class, 60 "Debug Name", 61 "Debug port number or share memory name") { 62 public Object getValue() { 63 return "7485"; 64 } 65 public void setValue(Object home) { 66 } 67 }); 68 return new PropertySet[] { ps }; 69 } 70 71 public static class MyChildren extends Children.Array { 72 public MyChildren(Collection nodes) { 73 super(nodes); 74 } 75 } 76 77 public static class TargetAction extends NodeAction { 78 public String getName () { return "Target Action"; } 79 80 protected boolean enable(Node[] activatedNodes) { 81 return true; 82 } 83 84 public org.openide.util.HelpCtx getHelpCtx() { 85 return org.openide.util.HelpCtx.DEFAULT_HELP; 86 } 87 88 protected void performAction(Node[] activatedNodes) { 89 System.out.println("Some one called target?"); 90 } 91 } 92 } 93 | Popular Tags |