|Re: Get all ASTNodes in JDT Java Model [message #1067218 is a reply to message #1066306]
||Sun, 07 July 2013 18:18
| Stephan Herrmann
Registered: July 2009
A few comments:|
JDT distinguishes the "DOM AST" vs. the "Java Model", you seem to be asking about the former.
I don't see why you would want a list of all subclasses of ASTNode, that still wouldn't give you the desired instances, right?
If I understand correctly, the only thing you're missing seems to be how to iterate over all compilation units, right?
Do you want all compilation units of a given project, or all of the entire workspace?
You could either use an IResourceVisitor and check which visited resources correspond to Java compilation units,
or more systematically: start from an IJavaProject (this is the Java Model) and descend into its IPackageFragmentRoot's -> IPackageFragment's -> ICompilationUnit's
Note, that requesting ASTs for all files in the workspace is very expensive (time & memory), so you may actually have to revise your strategy.
Powered by FUDForum
. Page generated in 0.01720 seconds