views:

701

answers:

4

Is there something similar to the Eclipse cleanup rules ((Preferences > Java > Code Style > Clean Up) in NetBeans?

The cleanup rules in eclipse will allow you to clean things up like organizing imports, removing unnecessary casts, adding missing override annotations etc.

Also can you do that on a whole set of classes/packages instead of individual classes?

+1  A: 

Theres nothing like this for netbeans unfortunatly :(

I believe its a target feature for 7.0.

Matt
+1  A: 

I know that netbeans points out these things automatically, but beyond merely pointing them out I don't know.

Soldier.moth
Version 6.5 displays a little light bulb icon inline, which if you click on will suggest fixes (such as add Override annotation, remove unused imports, etc.).
ssakl
A: 

I don't know a way to do this en mass, but if you delete all imports from a source file and then right click in the source editor, you can select fix imports. This will import all the classes for you alphabetically, asking when it encounters package ambiguities.

As Soldier.moth pointed out, Netbeans will point out other issues, like casts and override annotations, in line, by use of a light bulb to the left of the source.

James McMahon
+2  A: 

The equivalent of Eclipse's "Code Cleanup" in NetBeans is "Format". It's under Source > Format, and the keyboard shortcut is Alt+Shift+F (on Windows). Unfortunately, unlike Eclipse, it doesn't seem like this can be configured in NetBeans.

DR