问题
I find it extremely useful to use the Ctrl(cmd)+o shortcut on Eclipse to find a member field or method in a class (and use it again to get the ones from the super class).
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+T or a resource Ctrl(cmd)+Shift+R).
If is not available where can I request it?
回答1:
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.
回答2:
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+H will open the Search dialog with Java Search as the selected type.
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.
回答3:
With the ctrl+h
you will have some more options to search.
Under java search option you may find search for type
, method
, package
, constuctor
, field
.
Also you may find "Limit To" option to narrow your search result and get precise search result!
回答4:
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.
回答5:
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.
回答6:
The quickest way that I'm aware of is by using ctrl+h
to bring up the Java search dialog.
回答7:
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.
You have to play around with it and use indirect ways of finding the method.
来源:https://stackoverflow.com/questions/10852256/quick-find-a-field-or-method-in-eclipses-workspace