Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-core-dev] Accessing the jdt "Abstract Syntax Tree"

I'm converting a standalone Java development tool into an Eclipse
plugin. The tool requires a tree representation of source code (being
edited) in order to operate. Currently we use our own internal Java
parser (constructed using ANTLR) to parse the source files users are
working on, however it would obviously be preferable to instead use
JDT's parsing of files.

I have looked at starting with an ICompilationUnit and recursing down
the parse tree using IParent.getParents(), but this parse tree seems to
only extend down to the "method level" (i.e. the parse tree doesn't
include the *contents* of the methods, just the prototype of the
methods). I am guessing that a more complete parse tree is constructed
somewhere in the JDT, because it seems like a deeper parse tree would be
necessary for features like ContentAssist, however I have been unable to
locate such code. 

Is there a way to access a more complete parse tree than provided by
recursive application of getParents() ?

thanks!

-Seth



Back to the top