2

I'm implementing an Eclipse plug-in to refresh a new view part when any change occurs in a Java file. Is this possible? And how?

Besides that, I need to identify the abstract syntax tree (AST) of the present code in the Java editor. Any suggestion?

Rüdiger Herrmann
  • 20,512
  • 11
  • 62
  • 79

1 Answers1

3

You can listen to changes of the underlying IDocument as described here: Eclipse Plugin to granularly monitor editor changes

The Java editor input also adapts to IJavaElement. For example:

editor.getEditorInput().getAdapter( IJavaElement.class )

If the result is an ICompilationUnit, you can create an AST thereof as described here: https://www.eclipse.org/articles/article.php?file=Article-JavaCodeManipulation_AST/index.html

Community
  • 1
  • 1
Rüdiger Herrmann
  • 20,512
  • 11
  • 62
  • 79