eclipse java import organizing

in test classes I have the following import

import static org.junit.Assert.*;

when I do organize import via ctrl + shift + o then it automatically changes to following

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

How can I configure eclipse not to do it ? PS: I only want junit imports not be handled in that way

=============

I added a save action to remove unused imports. [properties -> java editor -> save actions] so everytime I save unused imports are removed (since I used ctrl + shift + o mainly to remove unused imports this looks like a way forward..)

Jon Skeet
people
quotationmark

Under Window, Preferences, Java, Code Style, Organize Imports there's an option called "Number of static imports needed for .*" - set that to 1. (Another way to find it quickly is just to type "static" into the search box in preferences.)

Note that this will mean that hitting Ctrl-Shift-O will always turn any static imports into an static import-on-demand form, which may not be what you want. If you have separate projects for test and non-test code, you could configure it on a per project basis.

Personally I'd just live with the explicit imports - I usually end up with static imports by starting off with the class-qualified call, and then hitting Ctrl-Shift-M on the method name to import it statically.

people

See more on this question at Stackoverflow