Community
Participate
Working Groups
Probably best explained using an example: Let's say you have a class with a nested type, like this: [com/blah/util/Foo.java] package com.blah.util; import java.util.*; public class Foo { private final List<Bar> _bars = new ArrayList<Bar>(); public static class Bar { public final String id; private Bar(String id) { this.id = id; } } public void addBar(String id) { _bars.add(new Bar(id)); } private static final Random _Rnd = new Random(); public Bar getRandom() { return _bars.get(Math.abs(_Rnd.nextInt()) % _bars.size()); } } ...and you want to use it in another class, so you write this code: [com/blah/myapp/FooClient.java] package com.blah.myapp; import com.blah.util.*; public class FooClient { private final Foo _f = new Foo(); public void init() { _f.addBar("A"); _f.addBar("B"); _f.addBar("C"); } public void start() throws InterruptedException { for(;;) { System.out.println("Foo.Bar.id=" + _f.getRandom().id); Thread.sleep(1000); } } } Now for some reason, you want to have the result of "_f.getRandom()" stored in a local variable. So you select "_f.getRandom()" and use the refactoring command "Extract Local Variable". Eclipse adds an import and a line of code, like this: import com.blah.util.*; import com.blah.util.Foo.*; ... final Bar randomFooBar = _f.getRandom(); System.out.println("Foo.Bar.id=" + randomFooBar.id); Exactly the same thing happens for other operations, too - eg. "Override/Implement Methods", and when you create a new class that overrides/implements an abstract class/interface. I for one would prefer it not to add that import, opting instead to refer to "Bar" by its full name, "Foo.Bar", like this: import com.blah.util.*; ... final Foo.Bar randomFooBar = _f.getRandom(); System.out.println("Foo.Bar.id=" + randomFooBar.id); I think it would be nice to have a checkbox in the "Organize Imports" preference page that says something like "Import packages only". (Might have to rethink the wording if there will automatically generated static imports, which I would still like to have.) Also, it would be nice if the automatic import feature of code completion took care of this as well. For example, let's say that instead of using Eclipse's refactoring support to do the above, you start typing the "final..." variable declaration/assignment line manually. Right now if you type "final Bar" and press Ctrl+Space you get nothing (well, not Foo's nested class "Bar" anyway). It would be very useful if the code completion list included "Foo.Bar", and when selected, inserted either the full "Foo.Bar", or just "Bar" and an import, depending on the preference described above.
Move to JDT/UI
Not important for 3.1. Postponing...
*** Bug 286632 has been marked as a duplicate of this bug. ***
Reopening, since LATER is deprecated.