Usage

Activation

Activating the plugin is done by pressing Ctrl+Alt+H in the Java editor (this shortcut may be customized in the preferences.) This shows the calls into (callers) or calls out of (callees) the current method (i.e. the method in which the cursor is located.) The plugin may also be activated in the editor's context menu, on the toolbar or in the context menu of the Java outline, the type hierarchy, the package explorer (whenever a method is shown.)

Navigation in the Call Hierarchy view

Using the icons at the right of the view, it is possible to toggle between showing callers (F8) or callees (F9). The refresh button rebuilds the call hierarchy tree (F5). When a method is highlighted in the search result part of the view, F3 jumps to the declaration of the method. Double clicking jumps to the actual call in the code.

Call Details

In the Call Hierarchy view, it is possible to show Call Details. The Call Details show details on the call to the method. If there are several calls to a method from another method, the different calls are listed in the details. Double clicking jumps to the location of the call.

Focus on selection

Selecting "Focus on selection" from the context menu changes the root of the call hierarchy to the selected method.

Method history

The history drop down button shows the most recently shown method and allows the user to reselect a previous method.

Search scope

The context menu and view menu includes a Search submenu with which it is possible to select the search scope for calls to or from a method. The possible values are:

  • Workspace (default)
  • Project (search in the root method's project)
  • Hierarchy (search in the root method's type hierarchy)
  • Working Set (search in a working set)

NOTE: When searching for calls from a method, the results are limited by the package filters (in the preferences) as well as the search scope.

Preference pages

There are two preference pages (Java/Call Hierarchy) and (Java/Call Hierarchy/Filters). Here it is possible to set up:

  • The maximum call depth shown (useful if you want to avoid Eclipse to run forever if you press the * key on the numeric keyboard).
  • The layout of the details view (horizontal or vertical).
  • The format of the search results.
  • Filters indicating which packages should be excluded from the search results (by default, packages such as java.* are excluded.)

Searching for interfaces/implementations

If you have the Implementors plugin ( http://eclipse-tools.sourceforge.net/implementors ) installed, two checkboxes are available in the preferences page. Enabling these enable a search for:

  • interfaces, when searching for callers
  • implementations, when searching for callees

Search for calls to a method

This functionality is already available when performing a normal search. However, when using EJB's extra value is added. Normally, Eclipse has no knowledge of the connection between interface and implementation bean class. When using the Implementors plugin, searching for calls to an EJB method also searches for calls to the interfaces (remote or local) that the bean class is bound to.

Search for calls from a method

When following the call hierarchy from a method to its callees, normally the sequence stops at an interface. Enabling the use of the Implementors plugin, the call tree can be followed "across" interfaces. The call hierarchy will show the implementation class instead of the interface, thus enabling you to follow the call tree further down.

Note: Currently, this interface->implementation substitution is only made if the Implementors plugin finds exactly on implementing class. If multiple implementations are found, the interface is shown as usual. If you have any ideas as to how multiple implementation classes could be presented in the call tree, feel free to let me know :-)