在 Eclipse 的工作区中快速查找字段或方法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10852256/
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
Quick find a field or method in Eclipse's workspace
提问by pablisco
I find it extremely useful to use the Ctrl(cmd)+oshortcut on Eclipse to find a member field or method in a class (and use it again to get the ones from the super class).
我发现在 Eclipse 上使用Ctrl(cmd)+o快捷方式来查找类中的成员字段或方法(并再次使用它从超类中获取成员字段或方法)非常有用。
However, I would like to know if there is a similar way to quickly search in the project and/or workspace for a field or method you know the name of but not where it is (similarly to how it is done to find a type Ctrl(cmd)+Shift+Tor a resource Ctrl(cmd)+Shift+R).
但是,我想知道是否有类似的方法可以在项目和/或工作区中快速搜索您知道名称但不知道它在哪里的字段或方法(类似于如何找到类型Ctrl(cmd)+ Shift+T或资源Ctrl(cmd)+ Shift+ R)。
If is not available where can I request it?
如果不可用,我可以在哪里申请?
回答by Udo
ctrl+o
(cmd+o
) opens the quick outline where you can search for a method within the current class.
Pressing ctrl+o
again extends the search scope to the complete class hierarchy.
ctrl+o
( cmd+o
) 打开快速大纲,您可以在其中搜索当前类中的方法。再次按ctrl+o
将搜索范围扩展到完整的类层次结构。
回答by E-Riz
The closest thing I know of is the Java Search, which allows you to specify searching for a method, field, class, etc. If you're in the Java or Java Browsing perspective, Ctrl+Hwill open the Search dialog with Java Search as the selected type.
我知道的最接近的事是Java搜索,这使得如果你在Java或Java浏览角度是你的方法,字段级等指定搜索,Ctrl+H将打开搜索对话框与Java搜索作为选定的类型。
If you want to request a feature or enhancement, enter it into Eclipse's Bugzilla. Keep in mind that the backlog of feature requests is HUGE, so the most effective way to get yours noticed is to take initiative and submit a patch.
如果您想请求功能或增强功能,请将其输入Eclipse 的 Bugzilla。请记住,功能请求的积压是巨大的,因此让您注意到的最有效方法是主动提交补丁。
回答by nKhandhar
With the ctrl+h
you will have some more options to search.
有了 ,ctrl+h
您将有更多的搜索选项。
Under java search option you may find search for type
, method
, package
, constuctor
, field
.
在 java 搜索选项下,您可能会发现搜索type
, method
, package
, constuctor
, field
。
Also you may find "Limit To" option to narrow your search result and get precise search result!
您还可以找到“限制到”选项来缩小搜索范围并获得精确的搜索结果!
回答by Abdullah Khan
If you are using mac cmd + shift + l
will open a search box where you can search for any variable or method through out the project.
如果您使用的是 mac,cmd + shift + l
将打开一个搜索框,您可以在其中搜索整个项目中的任何变量或方法。
回答by Anthony Atkinson
The quickest way that I'm aware of is by using ctrl+h
to bring up the Java search dialog.
我所知道的最快方法是使用 调ctrl+h
出 Java 搜索对话框。
回答by murthy naika k
ctrl+h
will bring up java search option. Enter your string and see. It also has different patterns like .java
, .jsp
, then select scope then search.
ctrl+h
将调出 java 搜索选项。输入您的字符串并查看。它也有不同的模式,如.java
, .jsp
,然后选择范围然后搜索。
回答by Philip Rego
There's no way to do this in Eclipse. When you search for a method that's in a JAR Eclipse will not find it unless you already had the folder open.
在 Eclipse 中没有办法做到这一点。当您搜索 JAR 中的方法时,除非您已经打开了该文件夹,否则 Eclipse 将找不到它。
You have to play around with it and use indirect ways of finding the method.
你必须玩弄它并使用间接的方法来找到方法。