views:

218

answers:

3

On a generated project i 100s of warnings caused by unused imports and the like. Can i bulk cleanup those imports for all files?

+11  A: 

In package explorer right click on the root package of your project and choose source -> organize imports

Luno
Or select the classes and or packages you want to fix in the package explorer and organise their imports like described.
rsp
A: 

CTRL-SHIFT-O will do this on a file by file basis in eclipse, if you want to do an entire project, you might need to use something like jalopy. There is a jalopy eclipse plugin, but I'm not sure if it will do an entire project at one time or not.

Mainguy
+1  A: 

After you have gotten rid of your import warnings, consider turning on Save Actions for Java Editors in preferences. We do the suggested source cleaning, plus we format the source. Makes it much easier to see exactly when a change was introduced later.

Thorbjørn Ravn Andersen