Wednesday Jul 16, 2008

My 1st Contribution to NetBeans API Javadoc!

For a very long time, Jaroslav Tulach has been asking me to add links to documentation (blogs as well as tutorials) to the NetBeans API Javadoc. I always said I would do so but then ended up being too scared—it seemed strange to add additonal Javadoc comments to code that someone else had written and I thought that somehow the build would break if I did so. (And I was also concerned that the documentation in question might be wrong or misleading, while the fact that it was linked from the Javadoc might imply that it was somehow official.)

A few days ago I promised to do so again, but this time we were in a pub and he recorded me making the promise that I would add two links the next day. So there was no way back and so two days ago I finally did it:

And today you can see the result:

So, now you can expect to see a lot more cross references from NetBeans API Javadoc to various bits of documentation that should be helpful when implementing the API in question!

Notes for NetBeans Platform 6.5 (Part 2)

Another change, comparable to the registration of the action class within the layer.xml that I showed yesterday, is the way in which actions that are "always enabled" will be created & registered in 6.5. In 6.5, if you make this selection in the New Action wizard:

...everything in the wizard will be the same as it always was. I.e., in the next panel, you'll specify where the "always enabled" action should appear and then, in the panel that appears after that, you will specify the name of the class and the package. However, when you complete the wizard, you will see that the generated class looks exactly like this:

package org.netbeans.modules.demo;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public final class MyWonderfulAction implements ActionListener {
    public void actionPerformed(ActionEvent e) {
       // TODO implement action body

And this is how the class will have been registered in the layer.xml by the wizard:

    <folder name="Actions">
        <folder name="Edit">
            <file name="org-netbeans-modules-demo-MyWonderfulAction.instance">
                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.demo.Bundle"/>
                <attr name="delegate" newvalue="org.netbeans.modules.demo.MyWonderfulAction"/>
                <attr name="displayName" bundlevalue="org.netbeans.modules.demo.Bundle#CTL_MyWonderfulAction"/>
                <attr name="iconBase" stringvalue="org/netbeans/modules/demo/icon.png"/>
                <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
                <attr name="noIconInMenu" stringvalue="false"/>
    <folder name="Menu">
        <folder name="Edit">
            <file name="org-netbeans-modules-demo-MyWonderfulAction.shadow">
                <attr name="originalFile" stringvalue="Actions/Edit/org-netbeans-modules-demo-MyWonderfulAction.instance"/>
                <attr name="position" intvalue="100"/>

In other words, the "always enabled" action will, from 6.5 onwards, assuming you use the wizard, delegate to a plain old standard Java ActionListener class. And you will be able to focus on the purpose of the action within the class, while all the ancillary information is found within the layer.xml file (take special note of the new bundlevalue attribute), i.e., these properties are available even without the object having been instantiated. (You can go on using CallableSystemAction or AbstractAction if you want, but that's not code that the wizard will generate for you.)

However, while the situation where we don't have code completion in the layer.xml file continues, it will be hard to know exactly which attributes are available. (This has always been a problem, but is exacerbated now that even more is found in that file than before.) In that sense, we currently have better support for Spring RCP!

In other news. One of the current best blogs in the NetBeans world is the newish one by the NetBeans PHP development team: The actual engineers in that team write that blog, with new developments as they happen. Bookmark it! One of the best blog entries I've seen (ever) in the software development world comes from there, click here to read it and see how immediate the interaction between users and engineers is and how directly one can impact the developments of the PHP team.


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.


« July 2008 »