Find methods calls in Eclipse project

JavaEclipseFind

Java Problem Overview


I have a class X containing method myMethod(). I would like to find locations in all projects in my current workspace where this myMethod() is being called. I cannot use any search functions as there are several classes with myMethod(), and it isn't static. Hence I need to know the name of the objects of this class, which isn't possible without manually exploring the projects.

Does Eclipse have a solution for this?

Java Solutions


Solution 1 - Java

Go to the method in X.java, and select Open Call Hierarchy from the context menu.

Solution 2 - Java

Select mymethod() and press ctrl+alt+h.

To see some detailed Information about any method you can use this by selecting that particular Object or method and right click. you can see the "OpenCallHierarchy" (Ctrl+Alt+H). Like that many tools are there to make your work Easier like "Quick Outline" (Ctrl+O) to view the Datatypes and methods declared in a particular .java file.

To know more about this, refer this eclipse Reference

Solution 3 - Java

You can also search for specific methods. For e.g. If you want to search for isEmpty() method of the string class you have to got to - Search -> Java -> type java.lang.String.isEmpty() and in the 'Search For' option use Method.

You can then select the scope that you require.

Solution 4 - Java

Move the cursor to the method name. Right click and select References > Project or References > Workspace from the pop-up menu.

Solution 5 - Java

select method > right click > References > Workspace/Project (your preferred context ) 

or

(Ctrl+Shift+G) 

This will show you a Search view containing the hierarchy of class and method which using this method.

Solution 6 - Java

Right click on method and click on Open call Hierarchy

eclipse right click call hierarchy

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionShailesh TainwalaView Question on Stackoverflow
Solution 1 - JavaThiloView Answer on Stackoverflow
Solution 2 - JavaNirmal- thInk beYondView Answer on Stackoverflow
Solution 3 - JavaVishnu Prasad KallummelView Answer on Stackoverflow
Solution 4 - JavaTed HoppView Answer on Stackoverflow
Solution 5 - JavaSaifView Answer on Stackoverflow
Solution 6 - JavaManjeetView Answer on Stackoverflow