1.1 --- a/apisupport/src/org/netbeans/modules/apisupport/resources/templates/Nodes_API/__Sample_container__Children_java Mon May 13 19:21:17 2002 +0000
1.2 +++ b/apisupport/src/org/netbeans/modules/apisupport/resources/templates/Nodes_API/__Sample_container__Children_java Mon May 20 14:26:22 2002 +0000
1.3 @@ -14,46 +14,46 @@
1.4 /** Optional holder for the keys, to be used when changing them dynamically. */
1.5 protected List myKeys;
1.6
1.7 - public __Sample_container__Children () {
1.8 + public __Sample_container__Children() {
1.9 myKeys = null;
1.10 }
1.11
1.12 - protected void addNotify () {
1.13 - super.addNotify ();
1.14 + protected void addNotify() {
1.15 + super.addNotify();
1.16 if (myKeys != null) return;
1.17 - myKeys = new LinkedList ();
1.18 + myKeys = new LinkedList();
1.19 // add whatever keys you need
1.20 - setKeys (myKeys);
1.21 + setKeys(myKeys);
1.22 }
1.23
1.24 - protected void removeNotify () {
1.25 + protected void removeNotify() {
1.26 myKeys = null;
1.27 - setKeys (Collections.EMPTY_SET);
1.28 - super.removeNotify ();
1.29 + setKeys(Collections.EMPTY_SET);
1.30 + super.removeNotify();
1.31 }
1.32
1.33 - protected Node[] createNodes (Object key) {
1.34 + protected Node[] createNodes(Object key) {
1.35 // interpret your key here...usually one node generated, but could be zero or more
1.36 - return new Node[] { new MyNode ((MyParameter) key) };
1.37 + return new Node[] {new MyNode((MyParameter)key)};
1.38 }
1.39
1.40 /** Optional accessor method for the keys, for use by the container node or maybe subclasses. */
1.41 /*
1.42 - protected addKey (Object newKey) {
1.43 + protected addKey(Object newKey) {
1.44 // Make sure some keys already exist:
1.45 - addNotify ();
1.46 - myKeys.add (newKey);
1.47 + addNotify();
1.48 + myKeys.add(newKey);
1.49 // Ensure that the node(s) is displayed:
1.50 - refreshKey (newKey);
1.51 + refreshKey(newKey);
1.52 }
1.53 */
1.54
1.55 /** Optional accessor method for keys, for use by the container node or maybe subclasses. */
1.56 /*
1.57 - protected void setKeys (Collection keys) {
1.58 - myKeys = new LinkedList ();
1.59 - myKeys.addAll (keys);
1.60 - super.setKeys (keys);
1.61 + protected void setKeys(Collection keys) {
1.62 + myKeys = new LinkedList();
1.63 + myKeys.addAll(keys);
1.64 + super.setKeys(keys);
1.65 }
1.66 */
1.67
2.1 --- a/apisupport/src/org/netbeans/modules/apisupport/resources/templates/Nodes_API/__Sample_container__Node_java Mon May 13 19:21:17 2002 +0000
2.2 +++ b/apisupport/src/org/netbeans/modules/apisupport/resources/templates/Nodes_API/__Sample_container__Node_java Mon May 20 14:26:22 2002 +0000
2.3 @@ -12,100 +12,100 @@
2.4 */
2.5 public class __Sample_container__Node extends AbstractNode {
2.6
2.7 - public __Sample_container__Node () {
2.8 - super (new __NAME$Node$Children$MyChildren__ ());
2.9 - setIconBase ("__PACKAGE_AND_NAME_SLASHES$Node$NodeIcon$MyIcon__");
2.10 + public __Sample_container__Node() {
2.11 + super(new __NAME$Node$Children$MyChildren__());
2.12 + setIconBase("__PACKAGE_AND_NAME_SLASHES$Node$NodeIcon$MyIcon__");
2.13 // Whatever is most relevant to a user:
2.14 - setDefaultAction (SystemAction.get (PropertiesAction.class));
2.15 + setDefaultAction(SystemAction.get(PropertiesAction.class));
2.16 // Set FeatureDescriptor stuff:
2.17 - setName ("preferablyUniqueNameForThisNodeAmongSiblings"); // or, super.setName if needed
2.18 - setDisplayName (NbBundle.getMessage (__NAME__.class, "LBL_node"));
2.19 - setShortDescription (NbBundle.getMessage (__NAME__.class, "HINT_node"));
2.20 + setName("preferablyUniqueNameForThisNodeAmongSiblings"); // or, super.setName if needed
2.21 + setDisplayName(NbBundle.getMessage(__NAME__.class, "LBL_node"));
2.22 + setShortDescription(NbBundle.getMessage(__NAME__.class, "HINT_node"));
2.23 // Add cookies, e.g.:
2.24 /*
2.25 - getCookieSet ().add (new OpenCookie () {
2.26 - public void open () {
2.27 + getCookieSet().add(new OpenCookie() {
2.28 + public void open() {
2.29 // Open something useful...
2.30 }
2.31 });
2.32 */
2.33 // Make reorderable:
2.34 - // getCookieSet ().add (new ReorderMe ());
2.35 + // getCookieSet().add(new ReorderMe());
2.36 }
2.37
2.38 // Create the popup menu:
2.39 - protected SystemAction[] createActions () {
2.40 + protected SystemAction[] createActions() {
2.41 return new SystemAction[] {
2.42 - SystemAction.get (OpenLocalExplorerAction.class),
2.43 + SystemAction.get(OpenLocalExplorerAction.class),
2.44 null,
2.45 - // SystemAction.get (MyFavoriteAction.class),
2.46 + // SystemAction.get(MyFavoriteAction.class),
2.47 // null, // separator
2.48 /* according to what it can do:
2.49 - SystemAction.get (ReorderAction.class),
2.50 + SystemAction.get(ReorderAction.class),
2.51 null,
2.52 - SystemAction.get (CutAction.class),
2.53 - SystemAction.get (CopyAction.class),
2.54 - SystemAction.get (PasteAction.class),
2.55 + SystemAction.get(CutAction.class),
2.56 + SystemAction.get(CopyAction.class),
2.57 + SystemAction.get(PasteAction.class),
2.58 null,
2.59 - SystemAction.get (DeleteAction.class),
2.60 - SystemAction.get (RenameAction.class),
2.61 + SystemAction.get(DeleteAction.class),
2.62 + SystemAction.get(RenameAction.class),
2.63 null,
2.64 - SystemAction.get (NewAction.class),
2.65 + SystemAction.get(NewAction.class),
2.66 null,
2.67 */
2.68 - SystemAction.get (ToolsAction.class),
2.69 + SystemAction.get(ToolsAction.class),
2.70 null,
2.71 - SystemAction.get (PropertiesAction.class),
2.72 + SystemAction.get(PropertiesAction.class),
2.73 };
2.74 }
2.75
2.76 - public HelpCtx getHelpCtx () {
2.77 + public HelpCtx getHelpCtx() {
2.78 return HelpCtx.DEFAULT_HELP;
2.79 // When you have help, change to:
2.80 - // return new HelpCtx (__NAME__.class);
2.81 + // return new HelpCtx(__NAME__.class);
2.82 }
2.83
2.84 - protected __NAME$Node$Children$MyChildren__ get__NAME$Node$Children$MyChildren__ () {
2.85 - return (__NAME$Node$Children$MyChildren__) getChildren ();
2.86 + protected __NAME$Node$Children$MyChildren__ get__NAME$Node$Children$MyChildren__() {
2.87 + return (__NAME$Node$Children$MyChildren__)getChildren();
2.88 }
2.89
2.90 // RECOMMENDED - handle cloning specially (so as not to invoke the overhead of FilterNode):
2.91 /*
2.92 - public Node cloneNode () {
2.93 + public Node cloneNode() {
2.94 // Try to pass in similar constructor params to what you originally got:
2.95 - return new __NAME__ ();
2.96 + return new __NAME__();
2.97 }
2.98 */
2.99
2.100 // Create a property sheet:
2.101 /*
2.102 - protected Sheet createSheet () {
2.103 - Sheet sheet = super.createSheet ();
2.104 + protected Sheet createSheet() {
2.105 + Sheet sheet = super.createSheet();
2.106 // Make sure there is a "Properties" set:
2.107 - Sheet.Set props = sheet.get (Sheet.PROPERTIES); // get by name, not display name
2.108 + Sheet.Set props = sheet.get(Sheet.PROPERTIES); // get by name, not display name
2.109 if (props == null) {
2.110 - props = Sheet.createPropertiesSet ();
2.111 - sheet.put (props);
2.112 + props = Sheet.createPropertiesSet();
2.113 + sheet.put(props);
2.114 }
2.115 - props.put (new MyProp (someParams));
2.116 + props.put(new MyProp(someParams));
2.117 return sheet;
2.118 }
2.119 */
2.120
2.121 // Permit new subnodes to be created:
2.122 /*
2.123 - public NewType[] getNewTypes () {
2.124 - return new NewType[] { new NewType () {
2.125 - public String getName () {
2.126 - return NbBundle.getMessage (__NAME__.class, "LBL_NewType");
2.127 + public NewType[] getNewTypes() {
2.128 + return new NewType[] {new NewType() {
2.129 + public String getName() {
2.130 + return NbBundle.getMessage(__NAME__.class, "LBL_NewType");
2.131 }
2.132 // If you have help:
2.133 - // public HelpCtx getHelpCtx () {
2.134 - // return __NAME__.class.getName () + ".newType";
2.135 + // public HelpCtx getHelpCtx() {
2.136 + // return __NAME__.class.getName() + ".newType";
2.137 // }
2.138 - public void create () throws IOException {
2.139 + public void create() throws IOException {
2.140 // do whatever you need, e.g.:
2.141 - get__NAME$Node$Children$MyChildren__ ().addKey (someNewKey);
2.142 + get__NAME$Node$Children$MyChildren__().addKey(someNewKey);
2.143 // Throw an IOException if you are creating an underlying
2.144 // object and this fails.
2.145 }
2.146 @@ -116,27 +116,27 @@
2.147
2.148 // Permit things to be pasted into this node:
2.149 /*
2.150 - protected void createPasteTypes (final Transferable t, List l) {
2.151 + protected void createPasteTypes(final Transferable t, List l) {
2.152 // Make sure to pick up super impl, which adds intelligent node paste type:
2.153 - super.createPasteTypes (t, l);
2.154 - if (t.isDataFlavorSupported (DataFlavor.stringFlavor)) {
2.155 - l.add (new PasteType () {
2.156 - public String getName () {
2.157 - return NbBundle.getMessage (__NAME__.class, "LBL_PasteType");
2.158 + super.createPasteTypes(t, l);
2.159 + if (t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
2.160 + l.add(new PasteType() {
2.161 + public String getName() {
2.162 + return NbBundle.getMessage(__NAME__.class, "LBL_PasteType");
2.163 }
2.164 // If you have help:
2.165 - // public HelpCtx getHelpCtx () {
2.166 - // return __NAME__.class.getName () + ".pasteType";
2.167 + // public HelpCtx getHelpCtx() {
2.168 + // return __NAME__.class.getName() + ".pasteType";
2.169 // }
2.170 - public Transferable paste () throws IOException {
2.171 + public Transferable paste() throws IOException {
2.172 try {
2.173 - String data = (String) t.getTransferData (DataFlavor.stringFlavor);
2.174 + String data = (String)t.getTransferData(DataFlavor.stringFlavor);
2.175 // Or, you can look for nodes and related things in the transferable, using e.g.:
2.176 - // Node n = NodeTransfer.node (t, NodeTransfer.COPY);
2.177 - // Node[] ns = NodeTransfer.nodes (t, NodeTransfer.MOVE);
2.178 - // MyCookie cookie = (MyCookie) NodeTransfer.cookie (t, NodeTransfer.COPY, MyCookie.class);
2.179 + // Node n = NodeTransfer.node(t, NodeTransfer.COPY);
2.180 + // Node[] ns = NodeTransfer.nodes(t, NodeTransfer.MOVE);
2.181 + // MyCookie cookie = (MyCookie)NodeTransfer.cookie(t, NodeTransfer.COPY, MyCookie.class);
2.182 // do something, e.g.:
2.183 - get__NAME$Node$Children$MyChildren__ ().addKey (data);
2.184 + get__NAME$Node$Children$MyChildren__().addKey(data);
2.185 // Throw an IOException if you are creating an underlying
2.186 // object and this fails.
2.187 // To leave the clipboard as is:
2.188 @@ -145,7 +145,7 @@
2.189 // return ExTransferable.EMPTY;
2.190 } catch (UnsupportedFlavorException ufe) {
2.191 // Should not happen, since t said it supported this flavor, but:
2.192 - throw new IOException (ufe.getMessage ());
2.193 + throw new IOException(ufe.getMessage());
2.194 }
2.195 }
2.196 });
2.197 @@ -155,24 +155,24 @@
2.198
2.199 // Handle renaming:
2.200 /*
2.201 - public boolean canRename () {
2.202 + public boolean canRename() {
2.203 return true;
2.204 }
2.205 - public void setName (String nue) {
2.206 + public void setName(String nue) {
2.207 // Update visible name, fire property changes:
2.208 - super.setName (nue);
2.209 + super.setName(nue);
2.210 // perform additional actions, i.e. rename underlying object
2.211 }
2.212 */
2.213
2.214 // Handle deleting:
2.215 /*
2.216 - public boolean canDestroy () {
2.217 + public boolean canDestroy() {
2.218 return true;
2.219 }
2.220 - public void destroy () throws IOException {
2.221 + public void destroy() throws IOException {
2.222 // Actually remove the node itself and fire property changes:
2.223 - super.destroy ();
2.224 + super.destroy();
2.225 // perform additional actions, i.e. delete underlying object
2.226 // (and don't forget about objects represented by your children!)
2.227 }
2.228 @@ -180,31 +180,31 @@
2.229
2.230 // Handle copying and cutting specially:
2.231 /*
2.232 - public boolean canCopy () {
2.233 + public boolean canCopy() {
2.234 return true;
2.235 }
2.236 - public boolean canCut () {
2.237 + public boolean canCut() {
2.238 return true;
2.239 }
2.240 - public Transferable clipboardCopy () {
2.241 + public Transferable clipboardCopy() {
2.242 // Add to, do not replace, the default node copy flavor:
2.243 - ExTransferable et = ExTransferable.create (super.clipboardCopy ());
2.244 - et.put (new ExTransferable.Single (DataFlavor.stringFlavor) {
2.245 - protected Object getData () {
2.246 - return __NAME__.this.getDisplayName ();
2.247 + ExTransferable et = ExTransferable.create(super.clipboardCopy());
2.248 + et.put(new ExTransferable.Single(DataFlavor.stringFlavor) {
2.249 + protected Object getData() {
2.250 + return __NAME__.this.getDisplayName();
2.251 }
2.252 });
2.253 return et;
2.254 }
2.255 - public Transferable clipboardCut () {
2.256 + public Transferable clipboardCut() {
2.257 // Add to, do not replace, the default node cut flavor:
2.258 - ExTransferable et = ExTransferable.create (super.clipboardCut ());
2.259 + ExTransferable et = ExTransferable.create(super.clipboardCut());
2.260 // This is not so useful because this node will not be destroyed afterwards
2.261 // (it is up to the paste type to decide whether to remove the "original",
2.262 // and it is not safe to assume that getData will only be called once):
2.263 - et.put (new ExTransferable.Single (DataFlavor.stringFlavor) {
2.264 - protected Object getData () {
2.265 - return __NAME__.this.getDisplayName ();
2.266 + et.put(new ExTransferable.Single(DataFlavor.stringFlavor) {
2.267 + protected Object getData() {
2.268 + return __NAME__.this.getDisplayName();
2.269 }
2.270 });
2.271 return et;
2.272 @@ -213,11 +213,11 @@
2.273
2.274 // Permit user to customize whole node at once (instead of per-property):
2.275 /*
2.276 - public boolean hasCustomizer () {
2.277 + public boolean hasCustomizer() {
2.278 return true;
2.279 }
2.280 - public Component getCustomizer () {
2.281 - return new MyCustomizingPanel (this);
2.282 + public Component getCustomizer() {
2.283 + return new MyCustomizingPanel(this);
2.284 }
2.285 */
2.286
2.287 @@ -227,25 +227,25 @@
2.288 /*
2.289 private class ReorderMe extends Index.Support {
2.290
2.291 - public Node[] getNodes () {
2.292 - return __NAME__.this.getChildren ().getNodes ();
2.293 + public Node[] getNodes() {
2.294 + return __NAME__.this.getChildren().getNodes();
2.295 }
2.296
2.297 - public int getNodesCount () {
2.298 - return getNodes ().length;
2.299 + public int getNodesCount() {
2.300 + return getNodes().length;
2.301 }
2.302
2.303 // This assumes that there is exactly one child node per key.
2.304 // If you are using e.g. Children.Array, you can use shortcut implementations
2.305 // of the Index cookie.
2.306 - public void reorder (int[] perm) {
2.307 + public void reorder(int[] perm) {
2.308 // Remember: {2, 0, 1} cycles three items forwards.
2.309 - List old = __NAME__.this.get__NAME$Node$Children$MyChildren__ ().myKeys;
2.310 - if (list.size () != perm.length) throw new IllegalArgumentException ();
2.311 - List nue = new ArrayList (perm.length);
2.312 + List old = __NAME__.this.get__NAME$Node$Children$MyChildren__().myKeys;
2.313 + if (list.size() != perm.length) throw new IllegalArgumentException();
2.314 + List nue = new ArrayList(perm.length);
2.315 for (int i = 0; i < perm.length; i++)
2.316 - nue.set (i, old.get (perm[i]));
2.317 - __NAME__.this.get__NAME$Node$Children$MyChildren__ ().setKeys (nue);
2.318 + nue.set(i, old.get(perm[i]));
2.319 + __NAME__.this.get__NAME$Node$Children$MyChildren__().setKeys(nue);
2.320 }
2.321
2.322 }
3.1 --- a/apisupport/src/org/netbeans/modules/apisupport/resources/templates/Nodes_API/__Sample_filter__Children_java Mon May 13 19:21:17 2002 +0000
3.2 +++ b/apisupport/src/org/netbeans/modules/apisupport/resources/templates/Nodes_API/__Sample_filter__Children_java Mon May 20 14:26:22 2002 +0000
3.3 @@ -8,32 +8,32 @@
3.4 */
3.5 public class __Sample_filter__Children extends FilterNode.Children {
3.6
3.7 - public __Sample_filter__Children (Node orig) {
3.8 + public __Sample_filter__Children(Node orig) {
3.9 // This is the original parent node:
3.10 - super (orig);
3.11 + super(orig);
3.12 }
3.13
3.14 - public Object clone () {
3.15 - return new __NAME__ (original);
3.16 + public Object clone() {
3.17 + return new __NAME__(original);
3.18 }
3.19
3.20 - protected Node copyNode (Node child) {
3.21 + protected Node copyNode(Node child) {
3.22 // Perhaps create a customized child somehow, e.g. recurse:
3.23 - return new __NAME$Children$Node$MyFilterNode__ (child);
3.24 + return new __NAME$Children$Node$MyFilterNode__(child);
3.25 }
3.26
3.27 // If you need to display 0 or >1 nodes for one original child, you must
3.28 // directly override this:
3.29 /*
3.30 - protected Node[] createNodes (Object key) {
3.31 - Node child = (Node) key;
3.32 - SomeCookie cookie = (SomeCookie) child.getCookie (SomeCookie.class);
3.33 + protected Node[] createNodes(Object key) {
3.34 + Node child = (Node)key;
3.35 + SomeCookie cookie = (SomeCookie)child.getCookie(SomeCookie.class);
3.36 if (cookie != null) {
3.37 // Represent and also show something else besides, for example.
3.38 - return new Node[] { child.cloneNode (), new ExtraInfoNode (cookie) };
3.39 + return new Node[] {child.cloneNode(), new ExtraInfoNode(cookie)};
3.40 } else {
3.41 // Do not represent.
3.42 - return new Node[] { };
3.43 + return new Node[] {};
3.44 }
3.45 }
3.46 */
4.1 --- a/apisupport/src/org/netbeans/modules/apisupport/resources/templates/Nodes_API/__Sample_filter__Node_java Mon May 13 19:21:17 2002 +0000
4.2 +++ b/apisupport/src/org/netbeans/modules/apisupport/resources/templates/Nodes_API/__Sample_filter__Node_java Mon May 20 14:26:22 2002 +0000
4.3 @@ -8,73 +8,73 @@
4.4 */
4.5 public class __Sample_filter__Node extends FilterNode {
4.6
4.7 - public __Sample_filter__Node (Node original) {
4.8 - super (original, new __NAME$Node$Children$MyChildren__ (original));
4.9 + public __Sample_filter__Node(Node original) {
4.10 + super(original, new __NAME$Node$Children$MyChildren__(original));
4.11 // Or if you just want to copy all the children as plain FilterNode's
4.12 // (or acc. to Node.cloneNode) you can use:
4.13 - // super (original);
4.14 + // super(original);
4.15 // If you wish to operate on the filter node, instead of / in addition to the original,
4.16 // for basic node operations, you should use e.g.:
4.17 - // disableDelegation (DELEGATE_DESTROY | DELEGATE_SET_DISPLAY_NAME);
4.18 + // disableDelegation(DELEGATE_DESTROY | DELEGATE_SET_DISPLAY_NAME);
4.19 // Then you can customize some parts, e.g.:
4.20 - // super.setDisplayName (NbBundle.getMessage (__NAME__.class, "LBL_FilterNode_display_name_format", getDisplayName ());
4.21 + // super.setDisplayName(NbBundle.getMessage(__NAME__.class, "LBL_FilterNode_display_name_format", getDisplayName());
4.22 // To change the icon, you must use getIcon -- there is no icon resource, you
4.23 // must load it yourself.
4.24 }
4.25
4.26 - public Node cloneNode () {
4.27 + public Node cloneNode() {
4.28 // Usually you will want to override this if you are subclassing.
4.29 // Otherwise a filter of a filter is created, which works but is not ideal.
4.30 - return new __NAME__ (getOriginal ());
4.31 + return new __NAME__(getOriginal());
4.32 }
4.33
4.34 /*
4.35 // Often you will want to override this if you are subclassing.
4.36 // Otherwise the filter node cannot be persisted, so for example
4.37 // Explorer windows rooted at it will not be correctly restored.
4.38 - public Node.Handle getHandle () {
4.39 - Node.Handle origHandle = getOriginal ().getHandle ();
4.40 + public Node.Handle getHandle() {
4.41 + Node.Handle origHandle = getOriginal().getHandle();
4.42 // Simplest behavior: just store the original node and try to recreate
4.43 // a filter based on that.
4.44 if (origHandle != null)
4.45 - return new __NAME$Node$Handle$NodeHandle__ (origHandle);
4.46 + return new __NAME$Node$Handle$NodeHandle__(origHandle);
4.47 else
4.48 return null; // cannot persist original, do not persist filter
4.49 }
4.50 // Note that this class should be static and is serializable:
4.51 private static class __NAME$Node$Handle$NodeHandle__ implements Node.Handle {
4.52 private Node.Handle origHandle; // the only serializable state
4.53 - public __NAME$Node$Handle$NodeHandle__ (Node.Handle origHandle) {
4.54 + public __NAME$Node$Handle$NodeHandle__(Node.Handle origHandle) {
4.55 this.origHandle = origHandle;
4.56 }
4.57 - public Node getNode () throws IOException {
4.58 + public Node getNode() throws IOException {
4.59 // Simplest behavior. If you have more configuration present in the filter,
4.60 // for example additional options to the constructor, you will probably need
4.61 // to manually store them or otherwise know how to recreate them.
4.62 - return new __NAME__ (origHandle);
4.63 + return new __NAME__(origHandle);
4.64 }
4.65 }
4.66 */
4.67
4.68 // To override handling of e.g. node destruction, you may:
4.69 /*
4.70 - public boolean canDestroy () {
4.71 + public boolean canDestroy() {
4.72 return true;
4.73 }
4.74 - public void destroy () throws IOException {
4.75 - super.destroy (); // if you have disabled DELEGATE_DESTROY, this destroys this node
4.76 - // getOriginal ().destroy (); // you might wish to destroy both
4.77 + public void destroy() throws IOException {
4.78 + super.destroy(); // if you have disabled DELEGATE_DESTROY, this destroys this node
4.79 + // getOriginal().destroy(); // you might wish to destroy both
4.80 // Can perform other actions here to your liking.
4.81 }
4.82 */
4.83
4.84 // To add cookies:
4.85 /*
4.86 - public Node.Cookie getCookie (Class clazz) {
4.87 - if (clazz.isAssignableFrom (MySupportedCookie.class))
4.88 - return new MyCookieSupport (getOriginal ());
4.89 + public Node.Cookie getCookie(Class clazz) {
4.90 + if (clazz.isAssignableFrom(MySupportedCookie.class))
4.91 + return new MyCookieSupport(getOriginal());
4.92 else
4.93 - return getOriginal ().getCookie (clazz);
4.94 + return getOriginal().getCookie(clazz);
4.95 }
4.96 */
4.97
4.98 @@ -84,37 +84,37 @@
4.99 // on the original, or constructed some other way. For example, if you are
4.100 // filtering data folders and wish Reorder/Move Up/Move Down to work:
4.101 /*
4.102 - public Node.Cookie getCookie (Class clazz) {
4.103 - if (clazz.isAssignableFrom (DataFolder.Index.class)) {
4.104 - DataFolder folder = (DataFolder) super.getCookie (DataFolder.class);
4.105 + public Node.Cookie getCookie(Class clazz) {
4.106 + if (clazz.isAssignableFrom(DataFolder.Index.class)) {
4.107 + DataFolder folder = (DataFolder)super.getCookie(DataFolder.class);
4.108 if (folder != null) {
4.109 - return new DataFolder.Index (folder, this);
4.110 + return new DataFolder.Index(folder, this);
4.111 }
4.112 }
4.113 - return super.getCookie (clazz);
4.114 + return super.getCookie(clazz);
4.115 }
4.116 */
4.117 // If you are not sure, it may also work to adjust equality checks to treat
4.118 // this filter as interchangeable with the original:
4.119 /*
4.120 - public boolean equals (Object o) {
4.121 + public boolean equals(Object o) {
4.122 return this == o ||
4.123 - getOriginal ().equals (o) ||
4.124 - (o != null && o.equals (getOriginal ()));
4.125 + getOriginal().equals(o) ||
4.126 + (o != null && o.equals(getOriginal()));
4.127 }
4.128 - public int hashCode () {
4.129 - return getOriginal ().hashCode ();
4.130 + public int hashCode() {
4.131 + return getOriginal().hashCode();
4.132 }
4.133 */
4.134
4.135 // To add properties, cumbersome but straightforward:
4.136 /*
4.137 - public Node.PropertySet[] getPropertySets () {
4.138 - Node.PropertySet[] pss = getOriginal ().getPropertySets ();
4.139 - final Node.Property myProp = new SomethingProp (getOriginal ());
4.140 + public Node.PropertySet[] getPropertySets() {
4.141 + Node.PropertySet[] pss = getOriginal().getPropertySets();
4.142 + final Node.Property myProp = new SomethingProp(getOriginal());
4.143 int found = -1;
4.144 for (int i = 0; i < pss.length; i++) {
4.145 - if (pss[i].getName ().equals (Sheet.PROPERTIES)) {
4.146 + if (pss[i].getName().equals(Sheet.PROPERTIES)) {
4.147 found = i;
4.148 break;
4.149 }
4.150 @@ -125,32 +125,32 @@
4.151 for (int i = 0; i < pss.length; i++) {
4.152 if (i == found) {
4.153 final Node.PropertySet oldps = pss[i];
4.154 - nue[i] = new Node.PropertySet () {
4.155 - public void Node.Property[] getProperties () {
4.156 + nue[i] = new Node.PropertySet() {
4.157 + public void Node.Property[] getProperties() {
4.158 Node.PropertySet[] result = new Node.PropertySet[oldps.length + 1];
4.159 - System.arraycopy (oldps, 0, result, 0, oldps.length);
4.160 + System.arraycopy(oldps, 0, result, 0, oldps.length);
4.161 result[oldps.length] = myProp;
4.162 return result;
4.163 }
4.164 };
4.165 - nue[i].setName (oldps.getName ());
4.166 - nue[i].setDisplayName (oldps.getDisplayName ());
4.167 - nue[i].setShortDescription (oldps.getShortDescription ());
4.168 + nue[i].setName(oldps.getName());
4.169 + nue[i].setDisplayName(oldps.getDisplayName());
4.170 + nue[i].setShortDescription(oldps.getShortDescription());
4.171 } else {
4.172 nue[i] = pss[i];
4.173 }
4.174 }
4.175 } else {
4.176 nue = new Node.PropertySet[pss.length + 1];
4.177 - Node.PropertySet added = new Node.PropertySet () {
4.178 - public void Node.Property[] getProperties () {
4.179 + Node.PropertySet added = new Node.PropertySet() {
4.180 + public void Node.Property[] getProperties() {
4.181 return myProp;
4.182 }
4.183 };
4.184 - added.setName (Sheet.PROPERTIES);
4.185 - added.setDisplayName (NbBundle.getMessage (__NAME__.class, "LBL_AddedSheet"));
4.186 - added.setShortDescription (NbBundle.getMessage (__NAME__.class, "HINT_AddedSheet"));
4.187 - System.arraycopy (pss, 0, nue, 0, pss.length);
4.188 + added.setName(Sheet.PROPERTIES);
4.189 + added.setDisplayName(NbBundle.getMessage(__NAME__.class, "LBL_AddedSheet"));
4.190 + added.setShortDescription(NbBundle.getMessage(__NAME__.class, "HINT_AddedSheet"));
4.191 + System.arraycopy(pss, 0, nue, 0, pss.length);
4.192 nue[pss.length] = added;
4.193 }
4.194 return nue;
5.1 --- a/apisupport/src/org/netbeans/modules/apisupport/resources/templates/Nodes_API/__Sample_leaf__Node_java Mon May 13 19:21:17 2002 +0000
5.2 +++ b/apisupport/src/org/netbeans/modules/apisupport/resources/templates/Nodes_API/__Sample_leaf__Node_java Mon May 20 14:26:22 2002 +0000
5.3 @@ -12,19 +12,19 @@
5.4 */
5.5 public class __Sample_leaf__Node extends AbstractNode {
5.6
5.7 - public __Sample_leaf__Node () {
5.8 - super (Children.LEAF);
5.9 - setIconBase ("__PACKAGE_AND_NAME_SLASHES$Node$NodeIcon$MyIcon__");
5.10 + public __Sample_leaf__Node() {
5.11 + super(Children.LEAF);
5.12 + setIconBase("__PACKAGE_AND_NAME_SLASHES$Node$NodeIcon$MyIcon__");
5.13 // Whatever is most relevant to a user:
5.14 - setDefaultAction (SystemAction.get (PropertiesAction.class));
5.15 + setDefaultAction(SystemAction.get(PropertiesAction.class));
5.16 // Set FeatureDescriptor stuff:
5.17 - setName ("preferablyUniqueNameForThisNodeAmongSiblings"); // or, super.setName if needed
5.18 - setDisplayName (NbBundle.getMessage (__NAME__.class, "LBL_node"));
5.19 - setShortDescription (NbBundle.getMessage (__NAME__.class, "HINT_node"));
5.20 + setName("preferablyUniqueNameForThisNodeAmongSiblings"); // or, super.setName if needed
5.21 + setDisplayName(NbBundle.getMessage(__NAME__.class, "LBL_node"));
5.22 + setShortDescription(NbBundle.getMessage(__NAME__.class, "HINT_node"));
5.23 // Add cookies, e.g.:
5.24 /*
5.25 - getCookieSet ().add (new OpenCookie () {
5.26 - public void open () {
5.27 + getCookieSet().add(new OpenCookie() {
5.28 + public void open() {
5.29 // Open something useful...
5.30 }
5.31 });
5.32 @@ -32,104 +32,104 @@
5.33 }
5.34
5.35 // Create the popup menu:
5.36 - protected SystemAction[] createActions () {
5.37 + protected SystemAction[] createActions() {
5.38 return new SystemAction[] {
5.39 - // SystemAction.get (MyFavoriteAction.class),
5.40 + // SystemAction.get(MyFavoriteAction.class),
5.41 // null, // separator
5.42 /* according to what it can do:
5.43 - SystemAction.get (CutAction.class),
5.44 - SystemAction.get (CopyAction.class),
5.45 + SystemAction.get(CutAction.class),
5.46 + SystemAction.get(CopyAction.class),
5.47 null,
5.48 - SystemAction.get (DeleteAction.class),
5.49 - SystemAction.get (RenameAction.class),
5.50 + SystemAction.get(DeleteAction.class),
5.51 + SystemAction.get(RenameAction.class),
5.52 null,
5.53 */
5.54 - SystemAction.get (ToolsAction.class),
5.55 + SystemAction.get(ToolsAction.class),
5.56 null,
5.57 - SystemAction.get (PropertiesAction.class),
5.58 + SystemAction.get(PropertiesAction.class),
5.59 };
5.60 }
5.61
5.62 - public HelpCtx getHelpCtx () {
5.63 + public HelpCtx getHelpCtx() {
5.64 return HelpCtx.DEFAULT_HELP;
5.65 // When you have help, change to:
5.66 - // return new HelpCtx (__NAME__.class);
5.67 + // return new HelpCtx(__NAME__.class);
5.68 }
5.69
5.70 // RECOMMENDED - handle cloning specially (so as not to invoke the overhead of FilterNode):
5.71 /*
5.72 - public Node cloneNode () {
5.73 + public Node cloneNode() {
5.74 // Try to pass in similar constructor params to what you originally got:
5.75 - return new __NAME__ ();
5.76 + return new __NAME__();
5.77 }
5.78 */
5.79
5.80 // Create a property sheet:
5.81 /*
5.82 - protected Sheet createSheet () {
5.83 - Sheet sheet = super.createSheet ();
5.84 + protected Sheet createSheet() {
5.85 + Sheet sheet = super.createSheet();
5.86 // Make sure there is a "Properties" set:
5.87 - Sheet.Set props = sheet.get (Sheet.PROPERTIES); // get by name, not display name
5.88 + Sheet.Set props = sheet.get(Sheet.PROPERTIES); // get by name, not display name
5.89 if (props == null) {
5.90 - props = Sheet.createPropertiesSet ();
5.91 - sheet.put (props);
5.92 + props = Sheet.createPropertiesSet();
5.93 + sheet.put(props);
5.94 }
5.95 - props.put (new MyProp (someParams));
5.96 + props.put(new MyProp(someParams));
5.97 return sheet;
5.98 }
5.99 */
5.100
5.101 // Handle renaming:
5.102 /*
5.103 - public boolean canRename () {
5.104 + public boolean canRename() {
5.105 return true;
5.106 }
5.107 - public void setName (String nue) {
5.108 + public void setName(String nue) {
5.109 // Update visible name, fire property changes:
5.110 - super.setName (nue);
5.111 + super.setName(nue);
5.112 // perform additional actions, i.e. rename underlying object
5.113 }
5.114 */
5.115
5.116 // Handle deleting:
5.117 /*
5.118 - public boolean canDestroy () {
5.119 + public boolean canDestroy() {
5.120 return true;
5.121 }
5.122 - public void destroy () throws IOException {
5.123 + public void destroy() throws IOException {
5.124 // Actually remove the node itself and fire property changes:
5.125 - super.destroy ();
5.126 + super.destroy();
5.127 // perform additional actions, i.e. delete underlying object
5.128 }
5.129 */
5.130
5.131 // Handle copying and cutting specially:
5.132 /*
5.133 - public boolean canCopy () {
5.134 + public boolean canCopy() {
5.135 return true;
5.136 }
5.137 - public boolean canCut () {
5.138 + public boolean canCut() {
5.139 return true;
5.140 }
5.141 - public Transferable clipboardCopy () {
5.142 + public Transferable clipboardCopy() {
5.143 // Add to, do not replace, the default node copy flavor:
5.144 - ExTransferable et = ExTransferable.create (super.clipboardCopy ());
5.145 - et.put (new ExTransferable.Single (DataFlavor.stringFlavor) {
5.146 - protected Object getData () {
5.147 - return __NAME__.this.getDisplayName ();
5.148 + ExTransferable et = ExTransferable.create(super.clipboardCopy());
5.149 + et.put(new ExTransferable.Single(DataFlavor.stringFlavor) {
5.150 + protected Object getData() {
5.151 + return __NAME__.this.getDisplayName();
5.152 }
5.153 });
5.154 return et;
5.155 }
5.156 - public Transferable clipboardCut () {
5.157 + public Transferable clipboardCut() {
5.158 // Add to, do not replace, the default node cut flavor:
5.159 - ExTransferable et = ExTransferable.create (super.clipboardCut ());
5.160 + ExTransferable et = ExTransferable.create(super.clipboardCut());
5.161 // This is not so useful because this node will not be destroyed afterwards
5.162 // (it is up to the paste type to decide whether to remove the "original",
5.163 // and it is not safe to assume that getData will only be called once):
5.164 - et.put (new ExTransferable.Single (DataFlavor.stringFlavor) {
5.165 - protected Object getData () {
5.166 - return __NAME__.this.getDisplayName ();
5.167 + et.put(new ExTransferable.Single(DataFlavor.stringFlavor) {
5.168 + protected Object getData() {
5.169 + return __NAME__.this.getDisplayName();
5.170 }
5.171 });
5.172 return et;
5.173 @@ -138,11 +138,11 @@
5.174
5.175 // Permit user to customize whole node at once (instead of per-property):
5.176 /*
5.177 - public boolean hasCustomizer () {
5.178 + public boolean hasCustomizer() {
5.179 return true;
5.180 }
5.181 - public Component getCustomizer () {
5.182 - return new MyCustomizingPanel (this);
5.183 + public Component getCustomizer() {
5.184 + return new MyCustomizingPanel(this);
5.185 }
5.186 */
5.187