Docking a NetBeans Module in the IDE (Part 4)
By Geertjan-Oracle on May 23, 2005
Note that the build and dist folders in the illustration above are generated when you build the application. The netbeans folder and the .nbm file are generated when you build the module. Targets for all of these activities are provided in the build.xml referred to below.
So, here is the list of files needed, but this time with a link to a file containing the code in question:
- A Java class that extends TopComponent: MyTopComponent.java.
- A Java class that extends CallableSystemAction: TestAction.java.
- A layer file (.xml extension): layer.xml.
- A manifest file (.mf extension): manifest.mf.
- A mode settings file (.settings extension): mytab.settings.
- A windows system top component reference file (.wstcref extension): mytab.wstcref.
On top of that, you need to change Anagrams.java because the Anagrams sample wasn't made to be a dockable NetBeans Module. So, there are a few things that don't work within the context of a dockable NetBeans Module. For example, the sample extends JFrame, and it has a menubar, which are not things that you'd find in modules that are dockable. For example, look at the Projects window -- a tree hierarchy is used there. The Output window just has a big text field. So, click here to get the restructured Anagrams.java file.
Finally, you need a build.xml file that contains the Ant scripts used for creating and loading the NetBeans module. Click here to get the build.xml file generated by the IDE for standard projects, together with the relevant Ant targets. Note that it imports nbproject/build-impl.xml, which you can get for yourself by creating a new web application from scratch. (You also need some module-specific properties in a project.properties file, so click here to get it.)
That's it. Now you have everything you need to transform the Anagrams sample into a dockable NetBeans Module. Take a look at Docking a NetBeans Module in the IDE (Part 3) for some of the possibilities.