Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Editing C Files Programatically(Rename a Method Name)
Editing C Files Programatically [message #494688] Mon, 02 November 2009 03:25 Go to next message
Eclipse UserFriend
Dear All,

Task definition :
I have to rename a method name. customizedAddMethod to renamedAddMethod.

I/p :

void customizedAddMethod(){
// do something
}

o/p

void renamedAddMethod(){
// do something
}

This was the sample piece of code written for it:

ASTRewrite create = ASTRewrite.create(ast);

IASTNode replacementNode = create.createLiteralNode("renamedAddMethod");

rewrite.replace(methodNameNode, replacementNode, null);

translationUnit.save(null, true);

The execution went fine, but nothing seemed to reflect in the file.

I am unable to track the flow why its not getting reflected.
Could someone help me out in this.

Thanks & Regards,
Jagadeesh. P

[Updated on: Mon, 02 November 2009 03:54] by Moderator

Re: Editing C Files Programatically [message #850566 is a reply to message #494688] Fri, 20 April 2012 02:23 Go to previous messageGo to next message
Eclipse UserFriend
hi all,


createLiteralNode(String literal);
It is used for inserting literal code by means of the rewrite facility. The node will never appear in an AST tree.

Then how we can insert our code? Can somebody help me by giving an example.

Thanks in advance.
Re: Editing C Files Programatically [message #850640 is a reply to message #850566] Fri, 20 April 2012 03:41 Go to previous message
Eclipse UserFriend
There is also CDT developers mailing list: http://dev.eclipse.org/mhonarc/lists/cdt-dev/
Previous Topic:Managed Make calls linker before all modules have been compiled
Next Topic:Linking to Libraries
Goto Forum:
  


Current Time: Fri Jun 20 04:19:59 EDT 2025

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

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

Back to the top