AST & Java Model [message #259826] |
Tue, 28 April 2009 07:03  |
Eclipse User |
|
|
|
Hello,
I would like to know how i can go from AST nodes to using the Java Model
The reason is this:
QUESTIONS
1)
Like in my past posts i have a method which returns the "ICompilationUnit"
of a class(a source file). So when i get this "ICompilationUnit" how do i
access the fields and methods using the Java Model in place of using the
AST classes like FieldDeclaration or MethodDeclaration. I want to use the
Java Model but how do i use it after getting the ICompilationUnit of a
class.
1. ICompilationUnit icomp = this.findProject();
2. CompilationUnit comp = this.parse(icomp);
3. IMethod[] iff = ((TypeDeclaration)comp.types().get(0)).getFields();
Line 3 gives error because it can't convert from MethodDeclaration to
IMethod since they are two different thing.
So i want to know the correct answer.
2)
I want to have a method's signature but the AST nodes "MethodDeclaration"
don't have a method like that but IMethod has a method getSignature()
which i can use. If i know the answer to the first question then this is
solved automatically.
Thank you.
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04904 seconds