Friday Aug 25, 2006

Just yesterday, I forwarded my Review Comment Assistant Netbeans plugin (look at the previous post for a description) to Sathish, my team's Tech Lead. However, after installing the plugin, his Netbeans 5.0 wouldnt start. The splash screen used to come up and then just vanish.

We looked at the startup log and found an issue with my plugin. Now fixing that would take some time, but I wanted to get Sathish's Netbeans up and running fast. In other words, I wanted to stop Netbeans from loading my plugin during startup.

This is what I did to disable the plugin from loading:

  1. Go to <user_home>/.netbeans/config/Modules
  2. Find <plugin_name>.xml and open it in your editor and change the "enabled" property. The plugin name for my case was com-sun-sps-devtools-commentator and so I fired up gedit and opened com-sun-sps-devtools-commentator.xml and modified the "enabled" property (marked in red box in the figure below) to make it false.
  3. Ran Netbeans, it started without a problem.

When modules are installed by a user, they are typically installed in the <userhome>/.netbeans/modules directory. But a good question is, How are modules registered? How does Netbeans know which modules to load?

Well, Netbeans has a concept of a System Filesystem (more about it here). When modules are installed, an entry of the module is kept in the .netbeans/config/modules directory. This directory is scanned by Netbeans during startup to load all user-installed modules. Changing the enabled property to false, stopped Netbeans from loading my problematic module.

Back to fixing my plugin :-) !

Thursday Aug 24, 2006

I was playing around with the Netbeans API, and used it to create a little review comment collector plugin to record review comments in code.

My team (The N1 Service Provisioning System development team - http://www.sun.com/software/products/service_provisioning/index.xml) uses an in house tool developed by one of the team members to do code reviews. This tool is used as a central place to put in all code review comments as the review passes through several phases before check in.

However, the process of entering review comments was getting really out of hand for me. Every review entry would be something like this:

File : xyz.java
Line: 291
Code: public static void main(String args[]) {
Comments:
1. Do this
2. Do that

Lot of work to be done for something so simple. Netbeans to the rescue!

Here's what I do in Netbeans now (with the help of my plugin):

1. Right click on the line where I want to put a review comment:

2. This throws up a dialog box for entering comments:

3. After entering the comments, I press 'OK' and the comments get recorded in the Comment Collector Window (top left) and an annotation appears on the line on which the comment was added:

4. I do this for all the files which I have to review. All the comments have now been collected in the Collector window. I now hit the "Export" button to get the whole list of comments ready to copy and paste into our internal review tool.

Time invested on this plugin : 1 day
Time saved : Much much more than 1 day :-)

Point : Developing Netbeans Plugins is a piece of cake. Thanks to the efforts of the Netbeans team who have done a fabulous job of documenting things and producing a bunch of 5 star tutorials. Just go to http://platform.netbeans.org/tutorials !

This blog copyright 2009 by gridbag