Jul 312012
 

Adding JavaHelp topics to a NetBeans Platform application is made really easy by the NetBeans IDE. Run the New File wizard, and choose the Module Development category, and under File Types pick JavaHelp Help Set. The wizard will generate all the necessary files for you.

The one thing in the process that was not obvious to me when I did this recently, is how you change the order in which help topics appear in the final product. It is in fact also very easy once you know how. 🙂

Open the generated package-info.java file, and have a look at the @HelpSetRegistration annotation. You will notice that it has a position attribute. And changing the position of the set in the final product is as simple as changing that value!

Jul 262012
 

Sometimes a small change in an application can make a pretty big difference in user experience. A colleague of mine installed the NetBeans IDE 7.2 yesterday. And after a while he commented that you can now select multiple Maven-based module projects and choose the build action from the context menu! It might seem like an insignificant change, but with our 3-tier application a change can often stretch over multiple modules. So for us this is definitely useful!

Do keep in mind though that the multiple builds are started in parellel. So if there are dependencies between the modules you would still have to choose the build order yourself. 🙂

Jul 252012
 

Besides implementing and testing the IDE itself, there are various other tasks involved in a new release of the NetBeans IDE. One important aspect is ensuring that the tutorials on the NetBeans website are up to date. And this release is no exception: there are a number of interesting NetBeans Platform Learning Trail tutorials that have been updated by Geertjan, and I would like to highlight some of them that I think are particularly useful. 🙂

  1. NetBeans IDE 7.2 Plugin Quick Start – a tutorial that illustrates some of the basic concepts around module development on the NetBeans platform, by guiding the reader to implement a Google search bar in the IDE.
  2. NetBeans Project Type Module Tutorial – a tutorial describing all the aspects of integrating your own kind of project into the IDE. This is an aspect of the platform that has IMO improved drastically over the last few years. This tutorial is most definetely worth a read!
  3. NetBeans Platform Runtime Container Tutorial – a tutorial describing the minimum set of modules that makes up a NetBeans Platform application.
Jul 062012
 

The NetBeans Platform has a very powerful quick search feature that you can reuse and extend in your own platform applications. When I decided to do that recently, I wanted to put it onto the menu bar as it appears in the IDE. So I set out to find out how to do that.

The most useful resource I found in my search is the Quick Search Integration Tutorial from the NetBeans website. It is a good tutorial that explains how to extend the quick search feature. And how to put it onto the toolbar in your own platform application (the very last section). The part that is missing, however, is how to put it onto the menu bar instead. 🙂

I knew that the change would have something to do with the layer file. But besides knowing that it would involve the menu folder, I had no idea what to put where. And so I began my exploration to find out how the IDE does it.

I created a new standalone module, and I created a layer file for that module. By expanding the XML Layer node in the projects view in the IDE, I could see the layer file in context. This means that you can see everything defined in the file system, even though these items are not in the particular layer file itself. The important point here is that a standalone module effectively inherits all the layer file entries from the IDE. And so I knew that the layer in context would have the entries that I need. Expanding the Menu Bar folder, I saw a Quick Search entry. By right-clicking on it and choosing Go to Declaration, I opened the layer file where that was originally defined. The relevant part of the layer file is shown below.

<filesystem>
    <folder name="Menu">
        <file name="org-netbeans-modules-quicksearch-QuickSearchAction.shadow">
            <attr name="originalFile" stringvalue="Actions/Edit/org-netbeans-modules-quicksearch-QuickSearchAction.instance"/>
            <attr name="position" intvalue="9010"/>
        </file>
    </folder>
</filesystem>

I put that part into my own module’s layer file, and when I executed the application the quick search box appeared. But it appeared directly next to the Help menu, which is not what I had in mind.

The quick search box in the wrong spot

The quick search box in the wrong spot

So back to the original layer file I went, and I found this very interesting entry just above the quick search one (also in filesystem/menu):

<file name="Spacer.instance">
    <attr name="instanceCreate" methodvalue="javax.swing.Box.createHorizontalGlue"/>
    <attr name="position" intvalue="9005"/>
</file>

Once I added that, the quick search bar appeared exactly where I wanted it. 🙂

The quick search box in its final location

The quick search box in its final location

And just like that, our application now has a powerful quick search feature!