How to use a ASTVisitor in a correct way? [message #194241] |
Tue, 25 January 2005 13:54  |
Eclipse User |
|
|
|
Originally posted by: pimenta.inatel.br
Hi.
I have just created a new class that extends from ASTVisitor. It is
MyASTVisitor.
I have implemented just 2 methods in MyASTVisitor:
public boolean visit(MethodDeclaration node) and
public boolean visit(MethodInvocation node)
The first one just prints "Hellow world" and return true.
And the second just prints"Beautful world" and return false.
--------------------------
The code of my plugin's final user is:
..
..
..
private void createForm(){
form = new Form("Title");
form.append(textItem);
}
Then, at run time, my plugin gets a MethodDeclaration (an AST node
representing such user's method) and run:
MyASTVisitor visitor = new MyASTVisitor()
visitor.visit(myMethodDeclaration); //I suppose the another visit method
will be called automatically.
However, my plugin prints just "Hello world". Why doesn't it print
"Beautiful world" too? If the second method can't run automatically, how
to use a ASTVisitor?
Any hint will be very helpful.
Thanks.
Rodrigo Pimenta Carvalho.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03255 seconds