Sunday, May 1, 2005

NetBeans plugins I use, part 1

WARNING: This blog entry was imported from my old blog on (which used different blogging software), so formatting and links may not be correct.

One of the optional plugins for NetBeans I rely on the most heavily, is the Jalopy plugin.
It reformats source files (provided they are compilable). Unlike the built-in basic formatting,
it performs all kinds of nice cleanup, like moving fields to the top of the file, enforces
whitespace around if blocks, and so on. And it's extremely configurable - if you invoke the

Jalopy Settings dialog from the Tools menu, you get the dialog shown on the right - plus a source
file viewer on the right immediately showing the effects of your toggling of components on
the options panel on the left. (Click on the image to see it in full size - that's true in
general for all small pictures in my blog.)

I've gotten in the habit of hitting Ctrl-Shift-F10 after making edits to my files now, to immediately
have the source file reformatted.

Of course, the first time I did this, I generated a huge number of CVS diffs in my module.
People generally don't like that since it makes source code archaeology harder. But finding
the original checkin comment for a reformatted line is still possible, so because of that I find
that the benefits outweigh this disadvantage. In fact, I would be quite happy if the entire NetBeans
source tree was reformatted too, since a couple of people checking in code in that code base
(at least early on) like to put a space between function names and the parentheses -- foo ();
and that drives me nuts!!

By the way, Here's my Jalopy settings XML file
- you can import it directly from
the Jalopy Settings file. This is basically the default JDK style, but I've increased the line
length up to 100 instead of 80 columns, and I've tweaked the import organization. One thing I left
alone was its parenthesis preferences, even though I like to omit some parentheses where it goes
and puts them back in.

You can find the plugin NBM file for 4.0/4.1 here.
Note that there is also a commercial
version of Jalopy for NetBeans, and it supports JDK 1.5 - which the current free plugin does
not. I just started writing some JDK 1.5 code the other day - and loved every minute of it. The new language
constructs and APIs are extremely handy.

I use some other optional plugins quite a bit too - I'll blog about them another time.

No comments:

Post a Comment