如何按名称查找 Eclipse 项目和文件夹?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1786563/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to find Eclipse projects & folders by name?
提问by inger
Is there a way to search for folders/projects by name in the Eclipse workspace?
有没有办法在 Eclipse 工作区中按名称搜索文件夹/项目?
The results would best be returned in a view where I can do bulk operations (like closing, opening, assign working set). It's just to fiddly to manually click through the list of hundreds of projects.
结果最好在我可以执行批量操作(如关闭、打开、分配工作集)的视图中返回。手动点击数百个项目的列表只是繁琐的。
This seemingly trivial task is causing grief to me, which I find embarrassing after all my Eclipse years.
这个看似微不足道的任务让我感到悲伤,在我经历了 Eclipse 多年之后,我觉得这很尴尬。
I have tried:
我试过了:
- Search dialogs (Ctrl+H) - among the multitude of options, I don't find anything that would actually select folders or projects (only files)
- Open Resources(Ctrl+R), looks handier than the dialogs, but again: only file search. BTW, why isn't that called "Open File"? resource can normally be a folder too, right?
- use filtering in the package/project explorer.. But that only supports filtering things out - no way to keep only things matching a pattern
- can Working Sets be set up in a dynamic way? (given search criteria, rather than fixed assignment in a fiddly dialog). EDIT: this is the winning option, see below.
- 搜索对话框 (Ctrl+H) - 在众多选项中,我找不到任何可以实际选择文件夹或项目的内容(仅文件)
- 打开资源(Ctrl + R),看起来比对话框更方便,但同样:只搜索文件。顺便说一句,为什么不叫“打开文件”?资源通常也可以是文件夹,对吗?
- 在包/项目资源管理器中使用过滤.. 但这仅支持过滤掉东西 - 没有办法只保留与模式匹配的东西
- 可以动态设置工作集吗?(给定搜索条件,而不是繁琐的对话中的固定分配)。编辑:这是获胜的选择,见下文。
Did I miss something? Maybe a 3rd party plugin that gives sane searching for anything? Would (Eclipse/GroovyMonkey) scripting help with this? Mylyn? Is this too much to ask for, from a such mature environment?
我错过了什么?也许是一个 3rd 方插件,可以让您理智地搜索任何东西?(Eclipse/GroovyMonkey) 脚本对此有帮助吗?米林?在如此成熟的环境中,这要求太多了吗?
I have kindly asked this on Eclipse forums, and they kindly answered "No" :) As usual, I have more confidence in SO folks, and would be grateful for ideas.
我曾在 Eclipse 论坛上好心地问过这个问题,他们好心地回答“不”:) 像往常一样,我对 SO 人更有信心,并且会很感激你的想法。
And the -current- winner is Scott's excellent dynamic working setsplugin, which exactly implements the option 4 above!
而 -current- 获胜者是 Scott 出色的动态工作集插件,它完全实现了上面的选项 4!
采纳答案by Scott Stanchfield
First, I'll answer the "dynamic working set" question:
首先,我将回答“动态工作集”的问题:
I've written a dynamic working set plugin. It allows you to group projects by project nature, regular expressions for names, and (as an extension to it) maven group and project name.
我写了一个动态工作集插件。它允许您按项目性质、名称的正则表达式以及(作为它的扩展)maven 组和项目名称对项目进行分组。
Check it out at http://code.google.com/p/javadude/wiki/DynamicWorkingSets
在http://code.google.com/p/javadude/wiki/DynamicWorkingSets查看
That may give you everything you need for now...
这可能会给你你现在需要的一切......
Otherwise, I don't think there is anything like what you're looking for, unless someone writes a plugin for it (which would be easy to do, once used to writing eclipse plugins)
否则,我不认为有你正在寻找的东西,除非有人为它写了一个插件(这很容易做到,一旦习惯了编写 eclipse 插件)
回答by fmjrey
A couple plugins to check out for this:
几个插件来检查这个:
- the Eclipse Glance pluginon googlecode
- the Eclipse Project Exploring pluginson github
- the selectproject pluginon googlecode
- googlecode 上的 Eclipse Glance 插件
- GitHub 上的 Eclipse 项目探索插件
- googlecode 上的 selectproject 插件
I'm using the first one and I'm quite happy with it. It adds a key shortcut (Ctrl+Alt+F) to search within most tables, treeviews, and text displays and it highlights occurences within the component. Works on editors, package explorer, etc.
我正在使用第一个,我对它很满意。它添加了一个快捷键 (Ctrl+Alt+F) 以在大多数表格、树视图和文本显示中进行搜索,并突出显示组件内的出现。适用于编辑器、包浏览器等。
I have not use the second plugin but here's what the home page says:
我没有使用第二个插件,但这是主页上的内容:
A set of eclipse Plugins which allow easier handling of an eclipse workspace with lots of Projects in it.
Filter Package Explorer
The Filter Package Explorer provides a view called FPackage Explorer which extends the Package Explorer and adds a filter field at the top.
Go to Project Plugin
The Go to Project Plugin provides a dialog similar to the Open Type dialog which lists all available projects in the workspace and allows you to filter them. When selecting one here it is automatically highlighted in whatever file displaying view you might have open. If you don't have any open the Package Explorer is opened showing the project.
一组 eclipse 插件,可以更轻松地处理包含大量项目的 eclipse 工作区。
过滤包资源管理器
Filter Package Explorer 提供了一个名为 FPackage Explorer 的视图,它扩展了 Package Explorer 并在顶部添加了一个过滤器字段。
转到项目插件
Go to Project Plugin 提供了一个类似于 Open Type 对话框的对话框,它列出了工作区中所有可用的项目并允许您过滤它们。在这里选择一个时,它会在您可能打开的任何文件显示视图中自动突出显示。如果您没有打开任何包资源管理器,则会打开显示项目。
The third one is new, here's what it's page says:
第三个是新的,这是它的页面上说的:
Eclipse contains popular shortcuts for selecting types and resources (such as Ctrl+Shift+T). This plug-in adds a similar shortcut for projects as well. Type a few letters with wildcards and quickly select one or more projects. Great for navigating, grouping projects into working sets, or other batch operations on projects.
Eclipse 包含用于选择类型和资源的常用快捷方式(例如 Ctrl+Shift+T)。此插件也为项目添加了类似的快捷方式。输入几个带有通配符的字母,然后快速选择一个或多个项目。非常适合导航、将项目分组到工作集或对项目进行其他批处理操作。
If you're wondering how to do it programatically you can also check this other question.
如果您想知道如何以编程方式进行操作,您还可以查看其他问题。
回答by Scott Stanchfield
Another option is to use the "filter" option on the package explorer. You can specify a few filters (including names) to filter outitems. That might help a bit, but not a huge amount.
另一种选择是使用包浏览器上的“过滤器”选项。您可以指定几个过滤器(包括姓名)进行筛选出来的项目。这可能会有所帮助,但不是很大。
Look for it under the little down-pointing triangle button on the package explorer tool bar.
在包资源管理器工具栏上的小向下三角形按钮下寻找它。