Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 08:25 Go to next message
Jacks  is currently offline Jacks Friend
Messages: 1
Registered: November 2009
Junior Member
Dear All,

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

I/p :

void customizedAddMethod(){
// do something


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);, 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 08:54]

Report message to a moderator

Re: Editing C Files Programatically [message #850566 is a reply to message #494688] Fri, 20 April 2012 06:23 Go to previous messageGo to next message
new2CDT . is currently offline new2CDT .Friend
Messages: 4
Registered: April 2012
Junior Member
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 07:41 Go to previous message
Yevgeny Shifrin is currently offline Yevgeny ShifrinFriend
Messages: 208
Registered: July 2009
Senior Member
There is also CDT developers mailing list:
Previous Topic:Managed Make calls linker before all modules have been compiled
Next Topic:Linking to Libraries
Goto Forum:

Current Time: Thu Jun 21 10:54:43 GMT 2018

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

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

Back to the top