Community
Participate
Working Groups
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
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.
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.
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...