Eclipse是否有像Xcode的“在项目中查找”功能那样的方法来搜索整个项目中的某些文本?


当前回答

Ctrl+H在这里非常方便。我主要在当前项目中搜索,而不是在整个工作空间中搜索。要查找当前缓冲区中字符串在整个项目中的所有出现情况,只需选择该字符串,按Ctrl+H并按enter。就这么简单!

Use Resource Filters! Eclipse will restrict the search result using the Resource Filters defined for your project (eg. right click on you project name and select Properties -> Resource -> Resource Filters). So if you keep getting search hits from parts of your project that your not interested in you could make Eclipse skip those by adding a Resource Filter for them. This is especially useful if you have build files or logs or other temporary files that are part of your projects directory structure, but you only want to search amongst the source code. You should also be aware of that files/directories matched for exclusion in the Resource Filters will not show up in the Package Explorer either, so you might not always want this.

其他回答

你应该看看新的Eclipse 2019-09 4.13快速搜索功能

新的快速搜索对话框提供了一种方便、简单和快速的方式,可以在工作空间中运行文本搜索并跳转到代码中的匹配项。 该对话框提供了一个快速概述,一目了然地显示匹配的文本行。 它的更新速度和你打字的速度一样快,并且只允许使用键盘快速导航。

典型的工作流程由按键盘快捷键Ctrl+Alt+Shift+L开始 (或Cmd+Alt+Shift+L在Mac)。 键入几个字母就会更新搜索结果。 使用上下方向键选择匹配项,然后按Enter键在编辑器中打开它。

是的,但是你需要打开全局搜索面板。要做到这一点,按下IDE右上角的双筒望远镜图标。

你甚至可以通过函数标识符、方法作用域等来过滤搜索。

选择“文件搜索”在工作区/所选项目中进行纯文本搜索 对于特定的表达式搜索,选择相关的选项卡(例如允许搜索特定标识符的Java Search)

按Ctrl + H打开搜索,其中包括通过项目、目录等进行搜索的选项。

Ctrl+H在这里非常方便。我主要在当前项目中搜索,而不是在整个工作空间中搜索。要查找当前缓冲区中字符串在整个项目中的所有出现情况,只需选择该字符串,按Ctrl+H并按enter。就这么简单!

Use Resource Filters! Eclipse will restrict the search result using the Resource Filters defined for your project (eg. right click on you project name and select Properties -> Resource -> Resource Filters). So if you keep getting search hits from parts of your project that your not interested in you could make Eclipse skip those by adding a Resource Filter for them. This is especially useful if you have build files or logs or other temporary files that are part of your projects directory structure, but you only want to search amongst the source code. You should also be aware of that files/directories matched for exclusion in the Resource Filters will not show up in the Package Explorer either, so you might not always want this.

Ctrl + H是最好的方法! 记得在开始搜索之前复制字符串!