简体   繁体   English

Eclipse:“查找所有引用”忽略目标目录

[英]Eclipse: “Find All References” ignore target directory

Is there any way to limit the search for "Find all References" in Eclipse so that it ignores files in the target directory. 有没有办法限制在Eclipse中搜索“查找所有引用”,以便它忽略目标目录中的文件。 This is not the same as the answer from this question: Limit “Find References” in Eclipse to only references from my code . 这与此问题的答案不同: 将Eclipse中的“查找引用”限制为仅从我的代码中引用 That answer only works for text search . 该答案仅适用于文本搜索 I want all references to a particular variable. 我想要所有对特定变量的引用。

Maven Java project? Maven Java项目?

If the target folder is properly set as Default output folder in the project's properties > Java build path > Source you should be fine. 如果目标文件Default output folder在项目的属性> Java构建路径>源中正确设置为Default output folder ,那么您应该没问题。

Source: just tested on Eclipse Indigo (I've tried Ctrl+Shift+G on both classes and variables); 来源:刚刚在Eclipse Indigo上测试过(我在类和变量上都尝试过Ctrl+Shift+G ); the search is limited to src/main and src/test . 搜索仅限于src/mainsrc/test

Try: 尝试:

  1. Go to Window->Customize Perspective. 转到Window-> Customize Perspective。 In Command And Groups Availability tab enable Window Working Set option if not enabled. 在“ 命令和组可用性”选项卡中启用“ 窗口工作集”选项(如果未 Click OK 单击确定
  2. Go to Window->Working Sets->Edit. 转到Window-> Working Sets-> Edit。 A dialog will pop up. 将弹出一个对话框。 Click NEW button 单击“ 新建”按钮
  3. A dialog will pop up. 将弹出一个对话框。 Select Resource option in that. 选择资源选项。 Click Next Button 单击下一步按钮
  4. Click on Select All Button. 单击“全选”按钮。 Deselect the target folder. 取消选择目标文件夹。 Enter the name for this working set say "Exclude target folder". 输入此工作集的名称,说“排除目标文件夹”。
  5. Open the source file in editor. 在编辑器中打开源文件。 Keep cursor on a variable. 将光标保持在变量上。 Right on that variable 就在那个变量上
  6. Go References->Working set->Exclude target folder Go References-> Working set-> Exclude target folder

By this you can also exclude some files along with folders. 通过此,您还可以排除一些文件和文件夹。 One drawback in this is that you have to manually deselect each and every files and folders to exclude. 这样做的一个缺点是您必须手动取消选择要排除的每个文件和文件夹。

Right-click and select properties and then check the derived check-box. 右键单击并选择属性,然后选中派生的复选框。 Done. 完成。

This works for the target directory and any other directories and files you want to exclude from searches and your normal workflow since the IDE will view these derived resources as resources that are not original data, and can be recreated from their source files. 这适用于目标目录以及要从搜索和正常工作流中排除的任何其他目录和文件,因为IDE将这些派生资源视为非原始数据的资源,并且可以从其源文件重新创建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM