Can you organize imports for an entire project in eclipse with a keystroke?

Viewed 35092

Wouldn't it be nice to just do a keystroke and have eclipse organize all imports in all java classes instead of just the one you are looking at? Is this possible? Is there a keystroke for it?

6 Answers

Select the project in the package explorer and press Ctrl + Shift + O (same keystroke as the single class version). Should work for packages, etc.

You can edit the clean up options on save to make it organize imports. That way all of your imports will always be organized.

In eclipse 3.4 just go into Window - Preferences. In the tree view look under Java -- Editor -- Save Actions.

This is how I keep my imports organized all of the time.

Related