Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

More Intelligent Eclipse "Open Call Hierarchy"?

If I have a Java project in Eclipse, I can right-click on a method name and "Open Call Hierarchy." Suppose I have two interfaces, A and B, that both specify a method x(). Is it possible for me to have Eclipse use "Open Call Hierarchy" in a more intelligent way so as to only show calls to x() from A's while not showing those from B's?

like image 213
Michael McGowan Avatar asked Jan 10 '11 18:01

Michael McGowan


People also ask

How do I open Hierarchy in Eclipse?

Press Ctrl+Shift+H -or- from the Menu Bar go to Navigate | Open Type in Hierarchy. The "Open Type in Hierarchy" dialog is displayed.

How do I get call Hierarchy in Eclipse?

To find the references of a method, eclipse has a plugin called Open Call Hierarchy(Ctrl+Alt+H).

How do I find my call Hierarchy?

Use the Call Hierarchy window To display the Call Hierarchy window, right-click in the code editor on the name of a method, property, or constructor call, and then select View Call Hierarchy. The member name appears in a tree view pane in the Call Hierarchy window.

How do I get call Hierarchy in Intellij?

Open a file in the editor and place the caret at the declaration or usage of the desired method or a field. Alternatively, select the desired method or the field in the Project tool window. From the main menu, select Navigate | Call Hierarchy or press Ctrl+Alt+H .


1 Answers

Eclipse should already do this. If you want to test it, go to your A interface, select the x() method and run 'Open Call Hierarchy' on it. Do the same for your x() method in interface B. You should get different code locations, unless you have a class which implements both, which you should never do. Doing so won't break any compilation or execution, you will just be doubly declaring the same method signature.

like image 158
Wagan8r Avatar answered Oct 13 '22 04:10

Wagan8r