Community
Participate
Working Groups
In the "Organize Imports" dialog, the ordering of the classes isn't optimal. If I have a class in my workspace with the same name as a known class in another package (ie. in the Java libraries), the other class is displayed first. Wouldn't it make more sense to display my class first since I would be more likely to chose it? When doing multiple "organize imports" across a workspace, it's much nicer to have the default one selected to the one I'm most likely to pick instead of having to key down each time. Instead of changing the order, the default selection could be changed to the class with the matching name in the workspace.
We are thinking about remembering the last decision on clashes.
Yep, using the last decision would be a good solution as well. What would really be nice is if the Organize Imports was a bit smarter. If I have the code: List stuff = new Vector(); I'm obviously not talking about a java.awt.List here, because Vector implements the Java Collections List interface. But Organize Imports asks me anyway because it's not smart enough to figure it out. Ideally, the Organize Imports dialog shouldn't even bother prompting me unless there is a double ambiguity between the interface/superclass on the left and the class on the right. Doing that would minimize the need for the Organize Imports UI to be more efficient because it wouldn't be used as much. Couple that automation intelligence with "Run in Background" (bug #71497) and I'll touch Ctrl-Shift-O even less. :) A smarter Organize Imports is a completely different issue though, I could open another bug...
Any one of the fixes mentioned here would be awesome. All of them would be even better, but if I had to vote for one I´d say the most important one is to recognize when a suggested import would create a compile error. This is a little more general than knowing that Vector extends List (and maybe easier to implement?). For example, if I say "List l = new Vector();" then Eclipse should know which List and Vector to use. Given "List l = null;" Eclipse clearly can't tell what kind of list I want, and it should prompt me (preferably with a customizable sort order). But if I say "List<Integer> l = null;" it should at least reduce the selection to all paraeterized types. In this case that resolves it unambiguously, because awt.List isn't paraeterized. Generalizing this to "Do not give suggestions that cause compile errors, unless AL suggestions give compile errors" would be nice. But maybe the overhead for speculative compilation is too high and you should just check for Generics.
In M5 we added a history of used types so they are are higher in the list. The request to make smarter for 'List l= new Vector()' is bug 87950