Calling call hierarchy from eclipse plugin

I want to write an eclipse plugin that can take a list of class names and return to me the class table that they reference in this project. I was thinking if I can use the eclipse cal hierarchy. But you do not know how to call this command. could someone help me with this, thanks in advance

+1
source share
3 answers

Take a look at the OpenCallHierarchyAction package class org.eclipse.jdt.ui.internal.callhierarchy. This is the internal source code for Eclipse, but you are interested in the code in the selection method (select ITextSelection).

+1
source

It seems like you want something like β€œLinks β†’ Workspace (Control + Shift + G)” rather than a call hierarchy?

Have you used this option before? It uses FindReferencesAction, take a look at this class, and you can see how it creates a search query based on the currently selected IJavaElement parameter.

Could you use this as the base for a search query on multiple IJavaElements? Or do you want your own specific look?

+2
source

Before writing something like this, make sure you look at JDepend4Eclipse , it can do a lot of what you need. I used it in the past for package level refactoring, as well as for understanding (and removing) circular dependencies.

If he does not do what you need, you can look at his source code.

0
source

Source: https://habr.com/ru/post/1380586/


All Articles