如何在 Eclipse 中搜索所有打开的文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1940675/
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 search all open files in Eclipse?
提问by daveslab
Simple question: how do I search all the files currently open in Eclipse? Note: I don't wanna search all the files I have in that workspace, just the ones open in tabs. Is there an easy way to do this?
简单的问题:如何搜索当前在 Eclipse 中打开的所有文件?注意:我不想搜索该工作区中的所有文件,只想搜索在选项卡中打开的文件。是否有捷径可寻?
回答by Boris Pavlovi?
Closest way is selecting several resources in Navigator or Package Explorer view, then press Ctrl+H and choose 'Selected Resources' radio button. It will limit search only to selected files.
最近的方法是在 Navigator 或 Package Explorer 视图中选择多个资源,然后按 Ctrl+H 并选择“Selected Resources”单选按钮。它将只搜索选定的文件。
回答by javajosh
CTRL+E on Windows or Linux, and Command+E on OSX.
Windows 或 Linux 上为 CTRL+E,OSX 上为 Command+E。
回答by dasilvj
There's no way to do that at the moment.
目前没有办法做到这一点。
The easiest solution would be to select your files manually (holding CTRL + click on file) and to specify "selected resources" as your search scope.
最简单的解决方案是手动选择文件(按住 CTRL 键并单击文件)并将“选定资源”指定为搜索范围。
回答by Ramon Royo
This may come too late for the original poster, but just in case somebody else needs to find out an answer, I had the same problem and found my solution by installing a plug-in named Instasearch. You can get it by going to Help/Eclipse Marketplaceand searching for Instasearch.
这对于原始海报来说可能来得太晚了,但以防万一其他人需要找到答案,我遇到了同样的问题,并通过安装名为 Instasearch 的插件找到了我的解决方案。您可以通过转到Help/Eclipse Marketplace并搜索Instasearch来获取它。
You can find more about this plug-in in the following address.
您可以在以下地址中找到有关此插件的更多信息。
回答by Magnus
Spring produces a stand-alone Eclipse plugin (no dependencies on Spring) called Quick Search
Spring 生成了一个名为 Quick Search 的独立 Eclipse 插件(不依赖 Spring)
http://marketplace.eclipse.org/content/quick-search-eclipse
http://marketplace.eclipse.org/content/quick-search-eclipse
For efficiency, it searches your open files first. So while it isn't purely restricting to opened files as you requested, you can still get a similar effect in practice by just clicking the first results that come up.
为了提高效率,它首先搜索您打开的文件。因此,虽然它并不完全限制按您的要求打开文件,但您仍然可以通过单击出现的第一个结果在实践中获得类似的效果。
回答by Michael Borgwardt
The currently opened files simply aren't considered special in eclipse - you have far more advanced methods of organizing your files: projects and working sets.
当前打开的文件在 eclipse 中并不特殊——您有更高级的文件组织方法:项目和工作集。
Working setsallow you to define sets of files, which can be used as constraints for many operations. You have to define them explicitly, but then they don't change just because you've closed a file.
工作集允许您定义文件集,这些文件可用作许多操作的约束。您必须明确定义它们,但它们不会仅仅因为您关闭了文件而改变。
回答by JesperE
There is no find-in-open-files command in Eclipse, no.
Eclipse 中没有 find-in-open-files 命令,没有。
I think that the main reason find-in-open-files is not implemented in Eclipse is probably because the set of open files is for many users rather insignificant. (In fact, I don't know (or care) which files I have open. (I even have Eclipse set to automatically close editors/files when they become too many). If I want to navigate to a file, I open it. Limiting a search to the files I currently have open would be completely pointless for me.)
我认为在 Eclipse 中没有实现 find-in-open-files 的主要原因可能是因为打开文件集对许多用户来说相当微不足道。(事实上,我不知道(或关心)我打开了哪些文件。(我什至将 Eclipse 设置为在编辑器/文件变得太多时自动关闭它们)。如果我想导航到一个文件,我会打开它. 将搜索限制为我当前打开的文件对我来说完全没有意义。)