Keeping Track of AST after ASTRewrite [message #259691] |
Thu, 23 April 2009 09:55 |
Eclipse User |
|
|
|
I have working code that uses ASTRewrite to save changes to a java source
file.
What I would like to do now, is check the state of the AST after I have
made some changes, but BEFORE I write the changes back to the file.
So, for example, let's say I add an argument to a method:
ListRewrite listRewrite = astRewrite.getListRewrite(method,
MethodInvocation.ARGUMENTS_PROPERTY);
listRewrite.insertLast(arg, null);
I can now write my change to file:
TextEdit astRewriteTextEdit = astRewrite.rewriteAST(document, null);
astRewriteTextEdit.apply(document);
This works.
Now, I would like to see the list of arguments in the MethodInvocation,
reflecting my change, before writing it out. I tried this:
astRewrite.rewriteAST();
But my MethodInvocation object was unchanged. I tried running a new
Visitor on the ASTNode that was returned by the original parser.createAST
call, but it also appears unmodified.
Any suggestions about how to see the state of the AST without writing to
file and reloading?
Thanks.
|
|
|
Powered by
FUDForum. Page generated in 0.04413 seconds