Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the callers of a method?

Tags:

java

eclipse

Usually to find the callers of a method in Eclipse I use ctrl-alt-h on the method. If nothing comes up, it is a callback from some other library. I'm pretty certain this method is not a callback and I'm pretty certain it's being called from somewhere. How can I find out if nothing shows up with a ctrl-alt-h?

like image 284
Barodapride Avatar asked Nov 25 '25 03:11

Barodapride


1 Answers

You can put the cursor on the method name and press Ctrl-Shift-G (default key combination).

This will open a search in the project to look for references to your method.

Edit

On frameworks using declarative markup (Spring, Android, etc.) you might actually need to use a more manual approach: the file search.

  • Copy or highlight your method name
  • Press Ctrl-H (default binding) and select File search (you can assign a custom key binding for that but no custom is provided)
  • Fill the containing text with your method name if not automatically filled
  • Optionally, select "case sensitive", or your file pattern if any
  • Then select your scope (the project should be a good place to start)
like image 78
Mena Avatar answered Nov 27 '25 18:11

Mena