Bug 20424

Summary: Autocompletion "Iterate through Collection" should add "import java.util.Iterator"
Product: [Eclipse Project] JDT Reporter: Andreas Krüger <andreas.krueger>
Component: UIAssignee: Claude Knaus <Claude_Knaus>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: peter_burka
Version: 2.0Keywords: investigate
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Andreas Krüger CLA 2002-06-17 05:48:32 EDT
I use autocompletion to generate an iteration through a collection.  So this is
the kind of code I'm getting:

   for (Iterator iter = myCollection.iterator(); iter.hasNext();) {
      type element = (type) iter.next();

However, autocompletion leaves my .java file without the neccessary

   import java.util.Iterator;

required for all of this to make sense.

I feel it's not as "auto" and not as "complete" as it could be (if you pardon
the pun).
Comment 1 Dirk Baeumer CLA 2002-06-17 11:42:39 EDT
Known limitation. We have to live with it for 2.0
Comment 2 Dirk Baeumer CLA 2002-07-31 09:53:18 EDT
Since we try to be smart regarding imports in JDT we should investigate if we 
can add an import in this case as well. Claude the is a special edit to 
organize imports. May be you only need to add that edit to the text buffer.

Please investigate
Comment 3 Claude Knaus CLA 2002-08-05 08:11:03 EDT
fixed >= 20020805
Comment 4 Claude Knaus CLA 2002-09-09 03:53:47 EDT
*** Bug 10812 has been marked as a duplicate of this bug. ***