Eclipse IDE 中是否存在“在项目中查找...”功能?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3175035/
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
Does a "Find in project..." feature exist in Eclipse IDE?
提问by William Jockusch
Does Eclipse have a way to search a whole project for some text like Xcode's "find in project" feature?
Eclipse 有没有办法在整个项目中搜索一些文本,比如 Xcode 的“在项目中查找”功能?
回答by Yuval Adam
1. Ctrl+ H
2. Choose File Searchfor plain text search in workspace/selected projects
1. Ctrl+ H
2.在工作区/选定项目中选择文件搜索进行纯文本搜索
For specific expression searches, choose the relevant tab (such as Java Search which allows you to search for specific identifiers)
对于特定表达式搜索,请选择相关选项卡(例如允许您搜索特定标识符的 Java 搜索)
For whole project search:
对于整个项目搜索:
3. Scope (in the form section) > Enclosing project (Radio button selection).
3. 范围(在表单部分)> 封闭项目(单选按钮选择)。
回答by Jainendra
Ctrl+ Alt+ Gcan be used to find selected text across a workspace in eclipse.
Ctrl+ Alt+G可以用来找到在蚀横跨工作区选定的文本。
OSX: ? Option+ ? Command+ G
OSX: ? Option+ ? Command+G
回答by Jason McCreary
Press Ctrl+ Hto bring up the search that includes options to search via project, directory, etc.
按Ctrl+ 调H出搜索,其中包括通过项目、目录等进行搜索的选项。
回答by shubhz
Ctrl+H.
Ctrl+ H。
Also,
还,
Open any file quickly without browsing for it in the Package Explorer: Ctrl+ Shift+ R.
Open a type (e.g.: a class, an interface) without clicking through interminable list of packages: Ctrl+ Shift+ T.
Go directly to a member (method, variable) of a huge class file, especially when a lot of methods are named similarly: Ctrl+ O
Go to line number Nin the source file: Ctrl+ L, enter line number.
打开任何文件快速而不在Package Explorer浏览它:Ctrl+ Shift+ R。
没有点击通过软件包的冗长列表:打开一个类型(类,接口例如):Ctrl+ Shift+ T。
直接进入到一个巨大的类文件的成员(方法,变量),尤其是当有很多方法可以类似地命名为:Ctrl+O
转到源文件中的第N行:Ctrl+ L,输入行号。
回答by Sumit Singh
Open Search Dialog Search-> Search...
or use Shortcut Ctrl+ H.
打开搜索对话框Search-> Search...
或使用 Shortcut Ctrl+H。
- Containing text:Type the expression for which you wish to do the text search.
- Choose if you want Case sensitive, Regular expressionor Whole word
- File name patterns:In this field, enter all the file name patterns for the files to find or search through for the specified expression.
- Scope:Choose the scope of your search. You can either search the whole workspace, pre-defined working sets, previously selected resources or projects enclosing the selected resources.
- Press Search
- 包含文本:键入要进行文本搜索的表达式。
- 选择是否需要区分大小写、正则表达式或整个单词
- 文件名模式:在此字段中,输入要查找或搜索指定表达式的文件的所有文件名模式。
- 范围:选择搜索范围。您可以搜索整个工作区、预定义的工作集、先前选择的资源或包含所选资源的项目。
- 按搜索
回答by Tam Dao
Ctrl+ His the best way! Remember to copy the string before you start searching!
Ctrl+H是最好的方法!请记住在开始搜索之前复制字符串!
回答by tlegutko
CTRL+ His actually the right answer, but the scope in which it was pressedis actually pretty important.
When you have last clicked on file you're working on, you'll get a different search window - Java Search:
CTRL+H实际上是正确的答案,但是按下它的范围实际上非常重要。当您最后一次单击您正在处理的文件时,您将看到一个不同的搜索窗口 - Java Search:
Whereas when you select directory on Package Explorer and then press Ctrl+ H(or choose Search -> File..
from main menu), you get the desired window - File Search:
而当您在包资源管理器上选择目录然后按Ctrl+ H(或Search -> File..
从主菜单中选择)时,您将获得所需的窗口 -文件搜索:
回答by jujuju
yes, but you need to open the global search panel. to do so, press the binoculars icon on the top right corner of the IDE.
是的,但您需要打开全局搜索面板。为此,请按 IDE 右上角的双筒望远镜图标。
you can even filter searches by function identifiers, method scopes an etc...
您甚至可以按函数标识符、方法范围等过滤搜索...
- Choose File Search for plain text search in workspace/selected projects
- For specific expression searches, choose the relevant tab (such as Java Search which allows to search for specific identifiers)
- 在工作区/选定项目中选择文件搜索进行纯文本搜索
- 对于特定表达式搜索,请选择相关选项卡(例如允许搜索特定标识符的 Java 搜索)
回答by VonC
You should check out the new Eclipse 2019-09 4.13 Quick Searchfeature
您应该查看新的 Eclipse 2019-09 4.13快速搜索功能
The new Quick Searchdialog provides a convenient, simple and fast way to run a textual search across your workspace and jump to matches in your code.
The dialog provides a quick overview showing matching lines of text at a glance.
It updates as quickly as you can type and allows for quick navigation using only the keyboard.
新的“快速搜索”对话框提供了一种方便、简单且快速的方法,可以在整个工作区中运行文本搜索并跳转到代码中的匹配项。
该对话框提供快速概览,一目了然地显示匹配的文本行。
它以您输入的速度更新,并允许仅使用键盘进行快速导航。
A typical workflow starts by pressing the keyboard shortcut Ctrl+Alt+Shift+L
(or Cmd+Alt+Shift+Lon Mac).
Typing a few letters updates the search result as you type.
Use Up-Down arrow keys to select a match, then hit Enterto open it in an editor.
典型的工作流程从按下键盘快捷键Ctrl+ Alt+ Shift+ L
(或Mac 上的Cmd+ Alt+ Shift+ L)开始。
键入几个字母会在您键入时更新搜索结果。
使用上下箭头键选择匹配项,然后点击Enter以在编辑器中打开它。
回答by Bob Ueland
First customize your search dialog. Ctrl+H. Click on the Customize button and select inly File Search while deselecting all the others. Close the dialog.
首先自定义您的搜索对话框。Ctrl+ H。单击自定义按钮并仅选择文件搜索,同时取消选择所有其他文件。关闭对话框。
Now you can search by selecting the word and hitting the Ctrl+Hand then Enter.
现在,您可以通过选择单词并点击Ctrl+H和 来进行搜索Enter。