On a generated project I get 100s of warnings caused by unused imports and such things. Can I bulk cleanup those imports for all files?
4 Answers
In package explorer right click on the root package of your project and choose source -> organize imports

- 7,883
- 1
- 32
- 23
-
Or select the classes and or packages you want to fix in the package explorer and organise their imports like described. – rsp Nov 21 '09 at 12:33
Please consider all pros and cons of bulk import before doing it. Its helps you to organise imports, but somtimes it make work more tedious by not organizing imports for same class namein different package. Suppose you have class A in two different packages, bulk import will struggle to import and you need to revist again to this manually.
Consider turning on organize imports for Save Actions in preferences..

- 21
- 2
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.

- 1,650
- 13
- 11
-
Just tried it with the project selected in the Package Explorer and it worked (I'm using Kepler) . – E.Z. Hart Jan 17 '14 at 19:35
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.

- 73,784
- 33
- 194
- 347