Eclipse:当自动完成类名时,排除特定的包 [英] Eclipse: Exclude specific packages when autocompleting a class name
问题描述
ListI
Tab
出现一个弹出式菜单,为您提供匹配的类名,以完成(您可以使用鼠标或使用箭头键选择:
这个例子我几乎肯定需要 java.util.ListIterator
以及 com.sun.xml.internal.bind.v2.runtime.reflect的概率。 ListIterator
(或者该包中的其他任何东西)是我想要的是一百万。
我知道这个特定的类会出现在该列表经常(每次我声明一个 ListIterator
),所以我想能够从自动完成搜索中排除其他包,以便 java。 util.ListIterator
是自动完成的,无需弹出菜单。
这是可能吗?
Window-> Preferences-> Java-> Appearance-> Type Filters
你应该可以在那里指定你不想看到的包。
要排除某些类型不显示在内容辅助中,请使用在
Java>外观>类型过滤器
首选页面。
匹配其中一个过滤器模式的类型不会显示在打开类型对话框中,因此无法使用内容辅助,快速修复和整理导入。
这些过滤器模式不影响Package Explorer和Hierarchy视图。
finnw (OP)添加了评论:
现在,您如何在此列表中添加单个类?我对java.awt.List不感兴趣,但有时候我想要java.awt.Window或java.awt.Dimension。 -
类型过滤器实际上是基于类模式匹配,这意味着如果你添加: p>
java.awt.List
该类将从内容帮助命题中消失。
如果您知道所有 java.awt.Lxxx
类是没有兴趣的,您可以添加
java.awt.L *
来自 java.awt
的所有其他类仍然会在内容帮助中。
With最近的一次eclipse(现在我已经有一个eclipse 3.6Mx,但是这应该适用于3.5.x),而不仅仅是在Type Filter中的包模式。
When auto-completing a class name in Eclipse, e.g. if you type:
ListI
Tab
A pop-up menu appears offering you matching class names for completion (which you can select with the mouse or by using the arrow keys:
In this example I almost certainly want java.util.ListIterator
and the probability that com.sun.xml.internal.bind.v2.runtime.reflect.ListIterator
(or anything else from that package) is what I want is about one in a million.
I know this particular class will appear in the list frequently (every time I declare a ListIterator
) so I would like to be able to exclude the other packages from autocomplete searches, so that java.util.ListIterator
is auto-completed without the need for a pop-up menu.
Is this possible?
Window->Preferences->Java->Appearance->Type Filters
You should be able to specify there the packages you do not want to see.
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.
这篇关于Eclipse:当自动完成类名时,排除特定的包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!