Tuesday Jan 08, 2008

NetBeans Plugin Competition

The nice people at Dapper are holding a series of competitions, as part of the upcoming (free!) DapperCamp conference (February 4-5 in San Francisco). One of the competitions gets you to create a NetBeans plugin that interacts with Dapper. All the info you need for participating in this particular competition can be found here:

NetBeans plugin for Dapper

I looked through that page and tried to understand the suggestions they've got there for various types of NetBeans plugins you can create that would be helpful to people using Dapper. Here's my understanding of their list, together with some ideas of my own, broken down into 3 different kinds of plugins you could create (or you could combine all of these into one cool plugin) to fulfil Dapper's competition requirements:

  1. Dapper search/browse plugin. When you click this link, you will have XML in your browser, as the search results for "netbeans" to the Dapper service:


    Now replace "netbeans" in the string above, with something else, like "obama", and you'll get different results. You could create a plugin that provides a user interface (maybe a toolbar, with search results to the Output window or Navigator, or both, or icons appearing in the component palette, for example) that generates a link such as the above and parses the results.

  2. Dapper stub generator. Use the Code Snippet Module Tutorial (and possibly the Editor Component Palette Module Tutorial) to add code snippets to the palette. When the user drags and drops these onto a JSP page (or some other document), relevant XML code would be generated into the editor, retrieved from Dapper. By the way, the guideline that tells you to provide an "interface to allow you to configure the stub code before it gets generated", on the NetBeans Plugin for Dapper page, is covered in the Adding a Customizer section in the Code Snippet Module Tutorial. One thing you might want to look at is how the Google web services, StrikeIron web services, and Yahoo web services are integrated in the IDE (in the Palette and the Services window), so that you end up with a user experience that seamlessly integrates with the user experience of other vendors.

  3. Dapper widget designer. If you're even more adventurous, you might want to use the Visual Library API to let the user design their own widgets graphically. You'd probably provide a palette, something similar to Matisse, but much simpler, and the user would be able to drag and drop items onto a Visual Library scene. At the end, the source view would contain the tags that define the widget that you've created. In a sense, if you take on this task, you're integrating parts of Dapper itself into the IDE. As far as possible, try and leverage as much as possible from Dapper, i.e., use Dapper to generate the tags and so on. See also Dapper's Dapp Factory for information related to this.

By the way, the Planet NetBeans widget in the left sidebar of this blog is something I created in a very few clicks via the Dapper site. I'm not completely happy with it (doesn't resize when the browser resizes), but it's quite fun. Dapper seems like a fun deal to me. If you click the "Add to your site" link below the widget, you'll be able to get the tags that define the widget, so that you can add those tags (and thereby reuse the widget) on your own site. (If you're blocking popups, you won't be able to open links from the widget.)

So, good luck, if you're interested in working on some/all of the plugins listed above! Let me know if I can help in any way, also if you're looking for someone to partner with (i.e., maybe you don't want to participate on your own) and I will try and find someone to work with you.

My First Ant Logger

A "hello world" implementation of org.apache.tools.ant.module.spi.AntLogger:

  1. Create a module project.

  2. Set a dependency on a module called "Ant" and a module called "I/O APIs".

  3. Create a Java class and extend org.apache.tools.ant.module.spi.AntLogger.

  4. Override the methods interestedInSession, interestedInAllScripts, interestedInTargets, targetStarted, and targetFinished. Implement them like this:

    public boolean interestedInSession(AntSession session) {
        return true;
    public boolean interestedInAllScripts(AntSession session) {
        return true;
    public String[] interestedInTargets(AntSession session) {
        return AntLogger.ALL_TARGETS;
    public void targetStarted(AntEvent event) {
        String name = event.getTargetName();
        event.getSession().println(name + " started!", true, null);
    public void targetFinished(AntEvent event) {
        String name = event.getTargetName();
        event.getSession().println(name + " finished!", true, null);
  5. Expand the "Important Files" node. Expand the "META-INF services" node. Expand the "all services" node. Right-click org.apache.tools.ant.module.spi.AntLogger. Choose "Add New Service". Browse to your class and click OK.

  6. Install the module.

Now, whenever you run any target in the IDE, the Output window will show the messages you added above whenever the target starts and finishes. Replace "null" in those lines above with an OutputListener, and you'll then have hyperlinks on those lines. A future blog entry will discuss this.


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.


« January 2008 »