Eclipse IDE 搜索具有给定名称的函数

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

Eclipse IDE search a function with given name

javaeclipse

提问by akp

How to search a partifular function in a particular project in Eclipse e.g. if I want to search a function with name xyzhow do I do it?

如何在 Eclipse 中的特定项目中搜索特定函数,例如,如果我想搜索具有名称的函数,xyz我该怎么做?

采纳答案by Aaron Digulla

Use "Java Search" in the search menu or move the caret on the function name in the source and press Ctrl+Shift+G(-> search for reference in Workspace).

使用搜索菜单中的“Java 搜索”或在源代码中移动函数名称上的插入符号并按Ctrl+Shift+G(-> 在工作区中搜索参考)。

[EDIT] If you don't know in which class the function is, then use the text search (which is called "File search"). Enter the name in the search field and then limit the search to "*.java" files.

[编辑] 如果您不知道该函数在哪个类中,请使用文本搜索(称为“文件搜索”)。在搜索字段中输入名称,然后将搜索限制为“*.java”文件。

回答by Donal Fellows

If you don't know where the method is located, use text search with a root of your whole project, working set or even the whole workspace if you've really got no idea where it might be; SearchFile…brings up a dialog which lets you enter exactly what you are looking for. You'll have to sort through all the things it finds (using the Search window) to identify the real match from among the false positives, but that's better than nothing.

如果您不知道该方法位于何处,如果您真的不知道它可能在哪里,请使用整个项目、工作集甚至整个工作区的根目录进行文本搜索;搜索文件...会弹出一个对话框,让您准确输入您要查找的内容。您必须对它找到的所有内容(使用“搜索”窗口)进行排序,以从误报中识别真正的匹配项,但这总比没有好。

回答by Tomasz Kowalczyk

You can write some code that uses that function and then use the [Ctrl] + [Click] trick to go to its implementations.

您可以编写一些使用该函数的代码,然后使用 [Ctrl] + [Click] 技巧转到其实现。

回答by zvikico

Check out nWire for Java. It has a quick search feature: start typing and it will instantly show results which include types, interfaces, methods, fields and other artifacts. It has a lot more features.

查看nWire for Java。它有一个快速搜索功能:开始输入,它会立即显示结果,包括类型、接口、方法、字段和其他工件。它有更多的功能。

回答by Dror

In Eclipse Neon 4.6 there's CTRL+H (from the menu Search -> Search) then we can use either the "File search" or "Java Search" tabs. both are very useful

在 Eclipse Neon 4.6 中有 CTRL+H(从菜单搜索 -> 搜索)然后我们可以使用“文件搜索”或“Java 搜索”选项卡。两者都非常有用