在 Eclipse 工作区中搜索字符串

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10424988/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 21:02:09  来源:igfitidea点击:

Searching a string in eclipse workspace

eclipse

提问by MindBrain

How to search for a string in the complete eclipse workspace? I was not able to locate a text in the eclipse workspace however I could not find the specified string in the workspace.

如何在完整的eclipse工作区中搜索字符串?我无法在 eclipse 工作区中找到文本,但是我在工作区中找不到指定的字符串。

回答by Francis Upton IV

At the top level menus, select 'Search' -> 'File Search'Then near the bottom (in the scope) there is a choice to select the entire workspace.

在顶层菜单中,选择“搜索”->“文件搜索”然后在底部附近(在范围内)有一个选择整个工作区的选项

For your "File search has encountered a problem", you need to refresh the files in your workspace, in the Project/Package Explorer, right click and select "Refresh" at any level (project, folder, file). This will sync your workspace with the underlying file system and prevent the problem.

对于您的“文件搜索遇到问题”,您需要刷新工作区中的文件,在项目/包资源管理器中,右键单击并在任何级别(项目、文件夹、文件)选择“刷新”。这将使您的工作区与底层文件系统同步并防止出现问题。

回答by Jainendra

Press Ctrl+ H, should bring up the search that will include options to search via project, directory, etc.

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

Ctrl+ Alt+ Gcan be used to find selected text across a workspace in eclipse.

Ctrl+ Alt+G可以用来找到在蚀横跨工作区选定的文本。

回答by Diego D

Ctrl+ H, Select "File Search", indicate the "file name pattern", for example *.xml or *.java. And then select the scope "Workspace"

Ctrl+H,选择“文件搜索”,指明“文件名模式”,例如*.xml 或*.java。然后选择范围“工作区”

回答by vanguard69

A lot of answers only explain how to do the search.

很多答案只解释了如何进行搜索。

To view the results look for a search tab (normally docked at the bottom of the screen):

要查看结果,请查找搜索选项卡(通常停靠在屏幕底部):

回答by Philip Enc

Eclipse does not search if the "File name patterns" field is empty.
So, if you want to search some text, write within "Containing text" field and leave
by default "File name patterns" with asterisk (*).

如果“文件名模式”字段为空,Eclipse 不会搜索。
因此,如果您想搜索一些文本,请在“包含文本”字段中输入并保留
默认为“文件名模式”并带有星号 (*)。

enter image description here

在此处输入图片说明

回答by Sairam Krish

eclipse instasearch pluginis a very useful plugin for search needs inside eclipse. It is based on lucene. This is also available in eclipse marketplace.

eclipse instasearch 插件是一个非常有用的插件,可以满足 eclipse 内部的搜索需求。它基于lucene。这也可以在 eclipse 市场中获得。

It has extensive feature set.

它具有广泛的功能集。

  • Instantly shows search results
  • Shows a preview using relevant lines
  • Periodically updates the index
  • Matches partial words (e.g. case in CamelCase)
  • Opens and highlights matches in files
  • Searches JAR source attachments
  • Supports filtering by extension/project/working set
  • 即时显示搜索结果
  • 使用相关行显示预览
  • 定期更新索引
  • 匹配部分单词(例如 CamelCase 中的大小写)
  • 打开并突出显示文件中的匹配项
  • 搜索 JAR 源附件
  • 支持按扩展/项目/工作集过滤

回答by Neil

For Mac:

对于 Mac:

Quick Text Search:Shift+ Cmd+ L

快速摘要:Shift+ Cmd+L

enter image description here

在此处输入图片说明

All other search(like File Search, Git Search, Java Search etc): Ctrl+ H

所有其他搜索(如文件搜索、Git 搜索、Java 搜索等):Ctrl+H

enter image description here

在此处输入图片说明

回答by mertaksu

Press Ctrl+shift+Land type your string

按下Ctrl+shift+L并输入您的字符串

回答by Selvakumar Ponnusamy

Goto Search->File

转到搜索->文件

You will get an window, you can give either simple search text or regx pattern. Once you enter your search keyword click Search and make sure that Scope is Workspace.

您将获得一个窗口,您可以提供简单的搜索文本或 regx 模式。输入搜索关键字后,单击搜索并确保范围是工作区。

You may use this for Replace as well.

您也可以将其用于替换。

回答by Madhu

In your Eclipse editor screen, try Control+ Shift+ Rbuttons.

在 Eclipse 编辑器屏幕中,尝试使用Control+ Shift+R按钮。