Bug 72861 - Code assist always shows all classes and public fields in the classpath
Summary: Code assist always shows all classes and public fields in the classpath
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M3   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-30 05:27 EDT by Miklos Wagner CLA
Modified: 2004-10-28 05:22 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miklos Wagner CLA 2004-08-30 05:27:22 EDT
There is an option in the Preferences/Java/Editor/Code Assist page that says 
"Show only proposals visible inthe invocation context" which should limit the 
proposals showing in the code assist window for those which are visible in the 
current context regarding the imported classes and packages but it doesn't seem 
to work that way. E.g. if I installed J3D into my JRE folder and that JRE 
library is added to the build classpath I always see J3D classes and constants 
from my code even if I don't use (either import) those. It's quite difficult to 
use code assist when the proposals window is scattered with classes from the 
whole classpath. THX
Comment 1 David Audel CLA 2004-09-02 12:57:03 EDT
The descibed behavior is the expected behavior.

When the preference "Show only proposals visible in the invocation context" is 
enabled, you will see all top level types and all visible elements. 

If you do code assist at cursor location in the following example, you will 
see only "zzzField1" and all top level types which start with 'zzz'. If you 
select one of these top level type, type name is inserted and an import 
statment is added if necessary. If there is too much proposals, type another 
character ('zzzF').

public class X {
  public Object zzzField1;
  private Object zzzField2;
}

public class Y extends X {
  void foo() {
    zzz#cursor#
  }
}

But if the preference is disabled you will see "zzzField1", "zzzField2" and 
all top level types which start with 'zzz'.

I close this bug because all seems to be correct. But if you think that 
something is wrong do not hesitate to reopen it.
Comment 2 Stefan Thomas CLA 2004-09-21 09:02:31 EDT
I have experienced the same problem. Since using some 3.0 RC xxx Versions of 
Eclipse. 
I have now already switched to Version: 3.1.0, Build id: 200408122000

but I still get way too many classes.
I have e.g. weblogic.jar from BEA on my project class path for accessing J2EE 
classes. If I start writing a simple class like:


public class Test {
  public Test() {
    int someVariable = 0;
    int anotherVariable = 1;
    
    int result = so
  }
}

And press the Crtl-Space-Button at the Cursor-Position behind 'so', I get some 
dozen suggestions from 

SOAPElementReader - weblogic.xml.security.utils to
SourceTreeManager - weblogic.apache.xpath

without a single import in my class.

At the moment, for me, code assist is useless. 

Comment 3 Frederic Fusier CLA 2004-10-28 05:22:22 EDT
As David said in comment 1, all top level types of build path corresponding to
selection are returned by code assist.
One reason of this behavior is that code assist is often used to add a type
which is not currently imported in your class... With the behavior you suggest,
user would be obliged to add import manually!
If you think that there are too many items in the list then just type one or two
characters more to reduce it...