Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see from where a public method is called in Eclipse using Java?

I am working on a Java project in Eclipse. Sometimes when I do refactoring I would like to see from what other classes a public method is called.

There is a primitive way to do this, that I am using now. I can comment out the method and see in what classes there is an error in Eclipse. Is there any better way to do this in Eclipse? E.g. by selecting the method signature and run a command by a key-shortcut?

like image 773
Jonas Avatar asked Oct 01 '10 13:10

Jonas


People also ask

How do you see where a method is called in eclipse?

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 ).

How do I display a method in eclipse?

It should be displayed by default in the Java perspective (which I assume you are using), but if you don't see it, you can display it from Window->Show View->Outline .

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 go back a call method in eclipse?

Press Alt + Left Arrow and Alt + Right Arrow like you would in a web browser.


1 Answers

Click on the method name, then press Ctrl+Alt+H to bring up the Call Hierarchy view.

like image 67
Jon Skeet Avatar answered Sep 28 '22 09:09

Jon Skeet