• Share this article:

Clean up

Friday, April 21, 2006 - 14:24 by Wayne Beaton

Cleaning up your code gets easier with Eclipse 3.2. Select a Java element. Any element. It works on classes, packages, and projects (intuitively, the element selected determines the scope of the clean up). Select “Source > Clean Up…” from the context menu. Here’s what you’ll see.

You’re presented with a bunch of options to clean up a variety of sins. I know that I’ve been going through a period where I’ve not been consistent in my use of blocks for if and for statements. This feature can fix this inconsistency by either adding them when they’re missing or removing them when they’re unnecessary: it depends on how the options are configured.

It does lots of things. Take a look.

It occurred to me to see if the feature might be scriptable with Eclipse Monkey. I’m spending a day with Ward next week; maybe we’ll try and sort this out…