Reputation: 20986
Organize imports (<Ctrl>+<Shift>+O
) is well known feature of Eclipse.
How could I remove only unused imports, but not reorganize it (not unfold .* and not change line ordering)?
Upvotes: 3
Views: 1358
Reputation: 1300
You can do it very easily upon saving a Java file by:
Window -> Preferences -> Java -> Editor -> Save Actions -> Check Additional Actions -> Configure -> Unnecessary Code -> Check on Remove Unused Imports
Upvotes: 1
Reputation: 3323
As I know it is not possible automatically do.
You can repeat this steps
Ctrl + .
(This will move cursor to the next error or warning Ctrl + 1
- show hintsUpvotes: 0
Reputation: 1634
You can try menu Source / Clean Up / Use custom profile and configure it to only do the "Remove unused imports".
Upvotes: 6