Saturday Nov 03, 2012

Maven Hierarchical View for NetBeans IDE 7.2

Started working on an oft-heard request from Kirk Pepperdine for an integrated view for multimodule builds for Maven projects in NetBeans IDE, as explained here. I suddenly had some kind of brainwave and solved all the remaining problems I had, by delegating to the LogicalViewProvider's node, instead of the project's node, which means I inherit all the icons, actions, package nodes, and anything else that was originally defined within the original project, in this case for the open source JAnnocessor project:

Above, you can see that the Maven submodules can either be edited in-line, i.e., within the parent project, or separately, by opening them in the traditional NetBeans way.

Get the module here:

Some people out there might be interested in how this is achieved. First, hide the original ModulesNodeFactory in the layer. Then create the following class, which creates what you see in the screenshot above:

import java.util.ArrayList;
import java.util.List;
import javax.swing.event.ChangeListener;
import org.netbeans.api.project.Project;
import org.netbeans.spi.project.SubprojectProvider;
import org.netbeans.spi.project.ui.LogicalViewProvider;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;

@NodeFactory.Registration(projectType = "org-netbeans-modules-maven", position = 400)
public class ModulesNodeFactory2 implements NodeFactory {

    public NodeList<?> createNodes(Project prjct) {
        return new MavenModulesNodeList(prjct);

    private class MavenModulesNodeList implements NodeList<Project> {

        private final Project project;

        public MavenModulesNodeList(Project prjct) {
            this.project = prjct;

        public List<Project> keys() {
            return new ArrayList<Project> (project.getLookup().

        public Node node(final Project project) {
            Node node = project.getLookup().
            return new FilterNode(node, new FilterNode.Children(node));

        public void addChangeListener(ChangeListener cl) {

        public void removeChangeListener(ChangeListener cl) {

        public void addNotify() {

        public void removeNotify() {

Considering that there's only about three actual statements above, it's pretty amazing how much can be achieved with so little code. The NetBeans APIs really are very cool.

Hope you like it, Kirk!

Friday Nov 02, 2012

UNHCR and Stanyslas Matayo Receive Duke's Choice Award 2012

This year, NetBeans Platform applications winning Duke's Choice Awards were not only AgroSense, by Ordina in the Netherlands, and the air command and control system by NATO... but also Level One, the UNHCR registration and emergency management system.

Unfortunately, Stanyslas Matayo, the architect and lead engineer of Level One, was unable to be at JavaOne to receive his award. It would have been really cool to meet him in person, of course, and he would have joined the NetBeans Party and NetBeans Day, as well as the NetBeans Platform panel discussions that happened at various stages throughout JavaOne. Instead, he received his award at Oracle Day 2012 Nairobi, some days ago, where he presented Level One and received the Duke's Choice Award:

Level One is the UNHCR (UN refugee agency) application for capturing information on the first level details of refugees in an emergency context. In its recently released initial version, the application was used in Niger to register information about families in emergency contexts. Read more about it here and see the screenshot below.

Congratulations, Stanyslas, and the rest of the development team working on this interesting and important project!

Thursday Nov 01, 2012


Raj, the Chennai JUG lead, together with others from that JUG, is interested in Visage, the JavaFX script language closely associated with Stephen Chin.

He sent me the related lexer and parser and I started by having a look at them in the new version of ANTLRWorks being developed by Sam Harwell (who demonstrated it very effectively during JavaOne):

Notice how the lexer and parser are shown in a tree structure, as well as in a cool syntax diagram.

Next, I downloaded a bunch of JARs from here, so that packages such as from "" can be used, i.e., these are Visage-specific packages that aren't found anywhere except in the location below:

It turns out that there's also a Visage NetBeans plugin out there:

Rather than recreating everything from scratch, i.e., generating ANTLR Java classes from the lexer and parser, I copied a lot of stuff from the site above and now a file Raj sent me looks as follows, i.e., basic syntax coloring is shown:

For anyone wanting to seriously support Visage in NetBeans IDE, I recommend downloading the existing Visage NetBeans plugin above, rather than creating everything yourself from scratch, and then figuring out how to use that code in some way, i.e., add the JARs I pointed to above, and work on its build.xml file, which could be frustrating in the beginning, but there's no point in recreating everything if everything already exists.


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.


« November 2012 »