Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » ASTRewrite.replace() and ASTRewrite.createGroupNode()
ASTRewrite.replace() and ASTRewrite.createGroupNode() [message #648380] Wed, 12 January 2011 16:25 Go to next message
Jochen Huck is currently offline Jochen HuckFriend
Messages: 8
Registered: August 2010
Junior Member

I want to perform some source code transformations using the class ASTRewrite. I want to insert some ASTNodes (lets say n1, n2, n3) after a known ASTNode (denoted by n) . I could do this with a ListRewrite if the ASTNode n was always in a Block or something like that. But I don't like this assumption and therefore I am searching for another possibility. Currently I am grouping the ASTNodes to a single node n0 with
ASTNode[] nodes = {n, n1, n2, n3}; 

Afterwards I replace the node n through n0 with
ASTRewrite.replace(n, n0, null);

That works fine for me in most cases. But sometimes there are nodes missing after the transformation (I do many of these in one CompilationUnit). I assume that the problem has to do with the grouped nodes. Can someone help me?

Re: ASTRewrite.replace() and ASTRewrite.createGroupNode() [message #649237 is a reply to message #648380] Tue, 18 January 2011 10:31 Go to previous message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
Can you give a testcase?
Previous Topic:Diff PackageExplorer and ProjectExplorer?
Next Topic:Possible to show java.util.concurrent locks in Debug view?
Goto Forum:

Current Time: Tue Jun 19 16:34:50 GMT 2018

Powered by FUDForum. Page generated in 0.01986 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top