Eclipse: Exclude specific packages when autocompleting a class name

后端 未结 2 717
-上瘾入骨i
-上瘾入骨i 2020-11-28 01:36

When auto-completing a class name in Eclipse, e.g. if you type:

ListITab

A pop-up menu appears offering you matching class names for

相关标签:
2条回答
  • 2020-11-28 01:50
      Window->Preferences->Java->Appearance->Type Filters
    

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

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

    See Java Tips and Tricks

    To exclude certain types from appearing in content assist, use the type filter feature configured on the Java > Appearance > Type Filters preference page.
    Types matching one of these filter patterns will not appear in the Open Type dialog and will not be available to content assist, quick fix and organize imports.
    These filter patterns do not affect the Package Explorer and Hierarchy views.


    finnw (the OP) adds in the comments:

    Now how do you add a single class to this list? I'm not interested in java.awt.List but occasionally I want java.awt.Window or java.awt.Dimension. –

    "Type filter" is actually based on class pattern matching, meaning if you add:

     java.awt.List
    

    that class will disappear from the content assist propositions.
    If you know all java.awt.Lxxx classes are of no interest, you could add

     java.awt.L*
    

    All other classes from java.awt would still be there for the content assist.
    With a recent eclipse (I have right now a eclipse 3.6Mx, but this should work for 3.5.x as well), you are not limited to package pattern only in the Type Filter.

    0 讨论(0)
  • 2020-11-28 01:58
    Window->Preferences->Java->Appearance->Type Filters
    
    0 讨论(0)
提交回复
热议问题