Eclipse: exception of certain packages when autocompleting class name

When autocompleting a class name in Eclipse, for example. if you type:

ListI tab

A pop-up menu will appear offering you the appropriate class names to complete (which you can select with the mouse or the arrow keys:

In this example, I almost certainly want java.util.ListIterator , and I almost never want com.sun.xml.internal.bind.v2.runtime.reflect.ListIterator (or anything else from this package).

This particular class will appear on the list often (every time I declare a ListIterator ). I would like to be able to exclude packages from autocomplete searches, so that java.util.ListIterator automatically populated without the need for a pop-up menu.

Is it possible?

+83
java eclipse autocomplete
Jan 15
source share
2 answers
  Window->Preferences->Java->Appearance->Type Filters 

You should be able to specify packages that you do not want to see there.

http://help.eclipse.org/galileo/topic/org.eclipse.jdt.doc.user/tips/images/type-filter.png

See Tips and Tricks for Java

To prevent certain types from appearing in content help, use the type filter function configured on the Java > Appearance > Type Filters preference page.
Types that correspond to one of these filter templates will not be displayed in the Open Type dialog box and will not be available to support content, quick fix, and organize imports.
These filter patterns do not affect package explorer views and hierarchies.




finnw (OP) adds in the comments:

Now, how do you add one class to this list? I am not interested in java.awt.List, but sometimes I want java.awt.Window or java.awt.Dimension. -

The "type filter" is actually based on class template matching , which means if you add:

  java.awt.List 

this class will disappear from content support offers.
If you know that all java.awt.Lxxx classes are not of interest, you can add

  java.awt.L* 

All other classes from java.awt will still be used to support content.
With a recent eclipse (I have eclipse 3.6Mx now, but this should work on 3.5.x as well), you are not limited to the package template only in the Standard Filter.

+117
Jan 15 '10 at 18:51
source share
 Window->Preferences->Java->Appearance->Type Filters 
+48
Oct 21 '09 at 18:09
source share



All Articles