I am working on an eclipse plugin, and I need to get the selected element from the active editor. I have already figured out (one way) to do this. Here are the key lines:
ITypeRoot root = EditorUtility.getEditorInputJavaElement(activeJavaEditor, false);
selectedElement = root.getElementAt(offset);
(This is similar to the answer the question Eclipse plugin : Get the enclosing class and member name)
But the problem that I'm having is that this will only return declared methods, types, fields, etc, and never invoked ones. For example, given this code in the active editor:
public void foo() {
ClassA.run();
}
even if the caret is positioned over "ClassA" or "run," my code still returns the method "foo." Does anyone know how to also get invoked methods?