当我使用Eclipse的Ctrl-Shift-o来组织导入,使用Ctrl-1进行快速修复或使用alt-space来完成引用时,我希望能够指定首选包(或者可以忽略包列表)避免命名空间冲突。 例如,我们总是想要java.util.List,但最终会过于频繁地看到以下对话框:
有什么方法可以避免这种情况吗?
When I use Eclipse's Ctrl-Shift-o to organize imports, Ctrl-1 for quick-fix, or alt-space to complete a reference, I'd like to be able to specify a preferred package (or alternately ignore a list of packages) to avoid namespace collisions. For instance, we always want java.util.List, but end up seeing the following dialog much too frequently:
Is there any way to avoid this?
最满意答案
Eclipse支持负导入过滤器。 例如,您可以过滤所有java.awt.*和javax.swing.*包,以便它们永远不会作为选项出现。 这可以在Java > Appearance > Type Filters菜单下的首选项中完成。
顺便说一下,这非常尴尬,这导致我提交增强请求 ,以便更简单地过滤未使用的类型。
Eclipse supports negative import filters. For example, you can filter all java.awt.* and javax.swing.* packages so that they never come up as an option. This can be done in the preferences under the Java > Appearance > Type Filters menu.
Incidentally, this is quite awkward, which lead me to file an enhancement request to make it much simpler to filter unused types.
更多推荐
发布评论