How to access the ASTs that Eclipse uses? [message #247778] |
Tue, 18 September 2007 07:34  |
Eclipse User |
|
|
|
Hello,
Is there any way that one can access the ASTs that Eclipse uses? I
suppose Eclipse has it's own set of ASTs for every Java source file of a
Java Project at any given moment. I would like to be able to visit those
ASTs instead of doing both parsing and visiting for an ICompilationUnit.
Or is this impossible, does Eclipse only have the JavaModel and
parses & visits only when it needs to ?
Thank you
George
|
|
|
|
|
Re: How to access the ASTs that Eclipse uses? [message #247874 is a reply to message #247846] |
Wed, 19 September 2007 12:18   |
Eclipse User |
|
|
|
Thank you both,
Up until now I've designed my plugin to work just like in the article
(I've actually used that exact same article as a startup point).
But if I want, for example, to collect all the local variables of a
given type (the AST nodes that represent those local variables to be more
exact) from a java project, i'd have to parse all the source files and
then visit the ASTs... - I'd like to skip the parsing phase and do only
the visiting.
My question is, can I skip this step, does the Eclipse IDE have
somewere all the ASTs form a given JavaProject, or does every plugin,
(e.g. the editor) needs to parse it's own ASTs when it's needs to.
I'm using Eclipse 3.3 and I haven't tried
org.eclipse.jdt.ui.SharedASTProvider yet, I'll download 3.4 tomorrow :)
thanks again,
George
|
|
|
|
Re: How to access the ASTs that Eclipse uses? [message #247984 is a reply to message #247894] |
Fri, 21 September 2007 07:45  |
Eclipse User |
|
|
|
Olivier Thomann wrote:
> George Ganea a écrit :
>> My question is, can I skip this step, does the Eclipse IDE have
>> somewere all the ASTs form a given JavaProject, or does every plugin,
>> (e.g. the editor) needs to parse it's own ASTs when it's needs to.
> I believe only the current editor has its AST available.
> Having all the ASTs in memory simply would not scale.
Ok, thank you very much for your answer, I was hoping I could get those
ASTs for free... Oh well, I'll just have to parse the java files for
myself...
I was amazed how quickly the SearchEngine (org.eclipse.jdt.core.search)
returns the results, that's why I thought that the ASTs should be already
there, but then I looked at the source code and noticed it too uses a sort
of a parser...
http://kickjava.com/src/org/eclipse/jdt/internal/core/search /BasicSearchEngine.java.htm
Thank you all,
George
|
|
|
Powered by
FUDForum. Page generated in 0.03321 seconds