Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 19920 - Imports
Summary: Imports
Status: RESOLVED DUPLICATE of bug 12330
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-11 13:23 EDT by Vijay Aravamudhan CLA
Modified: 2003-04-02 03:37 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vijay Aravamudhan CLA 2002-06-11 13:23:04 EDT
I am not sure if this feature is already there, but...

I think Eclipse could look through the fully qualified class names and import 
those classes instead. And also change the fully qualified name to just the 
class name. This could either be done in the "Organize imports" menu or as a 
separate menu item. I think one of the hurdles will be when two classes (from 
different packages) are being used in the same class: like java.util.Date and 
java.sql.Date
Comment 1 Philipe Mulet CLA 2002-06-11 13:34:05 EDT
Isn't organize imports already doing it ? Moving to JDT/UI.
Comment 2 Martin Aeschlimann CLA 2002-06-15 06:17:18 EDT
the feature exists: if your code contains something like

java.util.Vector vec;

select Vector, do 'Add Import': The qualification will be removed, and the 
import added.

The reason why 'Organize import' doesn't do this is that never touches the code.
There are sometimes reasons to have a fully qualified import. Personal taste, 
conflicts ect...

Comment 3 Vijay Aravamudhan CLA 2002-06-15 09:28:40 EDT
Thanks - I tried that - but I think that there is still a problem:

I have 3 places where I use java.util.Iterator (fully qualified names).
When I follow the above steps on one of the locations - it adds the import and 
changes the name to just 'Iterator' in that location - but does not do it for 
the other locations (when I do the process for one location, I would think that 
it would go through the rest of the code and do the same automatically for all 
locations where there is no conflict for 'java.util.Iterator'.

Also, when the process was not done automatically, I tried to redo the process 
for the rest of the locations - and it did not work - the fully qualified names 
were still being used.
Comment 4 Vijay Aravamudhan CLA 2002-09-21 22:41:08 EDT
I would like to know if this is being fixed in 2.1?
Comment 5 Erich Gamma CLA 2003-02-20 08:36:52 EST
martin can you pls answer
Comment 6 Martin Aeschlimann CLA 2003-02-20 09:01:09 EST
yes, that's a drawback, you have to do it for each invocation.
no plans for 2.1
Comment 7 Vijay Aravamudhan CLA 2003-04-01 23:20:07 EST
Can we reopen this now that we are beyond 2.1?
Comment 8 Martin Aeschlimann CLA 2003-04-02 03:36:07 EST
Please let us decide what to reopen. Thanks.
Comment 9 Martin Aeschlimann CLA 2003-04-02 03:37:35 EST

*** This bug has been marked as a duplicate of 12330 ***