13

When I try to use the "Open call hierarchy" function in Eclipse, all of sudden it has stopped working. I don't get any results, it just shows the name of the method I wanted to see the call hierarchy for. This happens for all methods I try, even though they are all called by other methods.

I've tried opening eclipse with -clean -refresh, opening and closing eclipse and the project, updating the project, renaming the .metadata-file, and so far nothing has worked.

I've checked that it searches the whole workspace, and there are no filters on.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Bugle
  • 301
  • 1
  • 3
  • 7
  • What is the name of the method? I noticed the call hierarchy does not work for common names like `clear()`, `get()`, etc. but don't know why. – Franky Apr 19 '17 at 07:42
  • It doesn't work for any method I try it on. For instance logEvent, ackAlarm, etc. – Bugle Apr 19 '17 at 07:43
  • Possible duplicate of [Eclipse IDE - Open Call Hierarchy is empty/broken](https://stackoverflow.com/questions/15542145/eclipse-ide-open-call-hierarchy-is-empty-broken) – Nathan Apr 21 '19 at 21:15
  • as specified by @vargapati it is a bug in Eclipse 2019-03 – Lovin Jan 20 '20 at 11:15
  • This happened with me when I configured a new git project on the same workspace and removed the older git project. – Zafar Nasim Sep 07 '20 at 06:55
  • For me it seems to be the issue reported here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=549003 (so the only solution so far seems to remove java 1.8, which I didn't try yet because several projects in that workspace are still using it) – Patter Jan 04 '23 at 16:20

6 Answers6

25
  1. Exit Eclipse
  2. Go into Workspace Directory/.metadata/.plugins/org.eclipse.jdt.core
  3. Delete savedIndexNames.txt
  4. Delete all *.index
  5. Start Eclipse

The search results should now show up.

user1803551
  • 12,965
  • 5
  • 47
  • 74
Nitin Jain
  • 265
  • 4
  • 8
  • Should work, Check if you are deleting the indexes in the workspace you are currently working with, This can be located at /.metadata/.plugins/org.eclipse.jdt.core/. Delete all .index files and savedIndexnames.txt file – Nitin Jain May 21 '18 at 22:06
  • Ensure you're searching for metadata from inside the workspace (if this is not clear) – leroneb Mar 27 '19 at 18:33
  • Nathan have Suggested https://stackoverflow.com/questions/15542145/eclipse-ide-open-call-hierarchy-is-empty-broken, Check if this solution work for you – Nitin Jain Apr 26 '19 at 16:55
  • 2020 and this is still a thing, as this fix just solved this very problem in my latest version of the IDE. – Koenigsberg Oct 21 '20 at 07:31
  • 1
    It worked but 5th step should be "Start" since we already exited at step 1st. :) – Ismail Yavuz May 26 '22 at 09:05
  • I remember this once worked. But not anymore... or not with the current screw up of my eclipse workspace. – EasterBunnyBugSmasher Sep 26 '22 at 15:50
14

No need for deleting indexes/re-install eclipse etc.

  1. Go to "Call Hierarchy" tab (open by Ctrl + Alt + h)
  2. On the upper right corner, there are 2 options:
    1. "Show Caller Hierarchy" (icon, 2 dots directing to 1 dot)
    2. "Show Callee Hierarchy" (icon, 1 dot directing to 2 dots)
  3. Change it to "Show Caller Hierarchy"
jonathan Heindl
  • 844
  • 7
  • 16
Aman
  • 735
  • 1
  • 6
  • 19
3

Go to window->perspective-> reset perspective.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
  • Not working and will erase your current perspective. If you try this, save your perspective first for restore. – zeraDev Sep 01 '22 at 10:05
3

Changing Installed JRE to JDK from Windows|Preferences|Java|Installed JREs worked for me.

ferhat kul
  • 43
  • 1
  • 7
2

Change Windows|Preferences|Java|Installed JREs, set the default to a JDK.

Version: 2021-09 (4.21.0)
Build id: 20210910-1417

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Billy
  • 21
  • 2
0

Maybe you have a search scope issue. I faced this issue, my eclipse coul'nt find any callers in third projects that uses the method i selected (i also tryed to remove the indexes, restart eclipse, close/open projects, and that was'nt enough so far). I Eventually realized the caller search has a "Search Scope" , that can be set to current workspace/current Project/working set. The item "search scope" is in the "call hierarchy" window menu, opened by top-right arrow. I set it to "current workspace" and then it was ok

EricD
  • 1