Adding Nodes to the NetBeans IDE's Runtime Window

Using a sample I found on-line in an old (very very old) document, I achieved something that I've been hoping to achieve ever since I started learning about NetBeans Modules: I added some nodes to the IDE's Runtime window. And, finally, I have a working sample that I can play with and learn from, specifically in relation to the Nodes API. Here's the evidence:

The sample is actually pretty useful (i.e., it goes way beyond the 'Hello World' type examples that I've been building so far). It creates a node with a very large number of subnodes, each labeled according to a key for specific Java properties. It even lets me add new properties and modify existing ones. Because the sample was so old, several of the methods have been deprecated. However, fortunately, there's a very helpful Upgrade Guide, which told me how to replace TopManager and that a module is installed in the Runtime window via the following entry in the layer.xml (instead of via entries in manifest.mf, which is how you used to have to install a module in the Runtime window):

<folder name="UI">
    <folder name="Runtime">
       <file name="org.netbeans.modules.sysprops.AllPropsNode.instance">     
          <attr name="instanceClass" 
         stringvalue="org.netbeans.modules.sysprops.AllPropsNode"/>
       </file>
    </folder>
</folder>

And, by the way, this is the structure of my module in the Projects window:

(It's a pity that the Projects window doesn't display the files in the top-level directory, because that means that the Projects window doesn't display my manifest.mf file as well as the sysprops.nbm file -- i.e., the NetBeans Module itself -- which means I have to keep switching to the Files window whenever I want to modify the manifest.mf file or delete the NetBeans Module. I should probably add the module to the clean target, but in such a way that the manifest.mf isn't included. Still, it would be nice to be able to see the top-level directory in the Projects window.)

Now that I've got this working sample, I can play around with it and really begin to understand how each part works. I'll be blogging more about this sample and the Nodes API in the coming weeks.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today