Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Subversive » Undo a ExtractMethodRefactoring(Is it possible to get a ICompilationUnit, apply a refactoring, and then undo it?)
Undo a ExtractMethodRefactoring [message #1394605] Sat, 05 July 2014 15:33 Go to next message
Iñaki Berra is currently offline Iñaki BerraFriend
Messages: 2
Registered: July 2014
Junior Member
Hello! I'm a bit new around here. I've been reading about this topic for about a month and i found a lot of useful information here. But i cannot find what i want to do specifically.

I want to be able to do this:

ICompilationUnit cu = originalCu.getWorkingCopy(); (or something that copies the ICompilationUnit)

ExtractMethodRefactoring refactoring = new ExtractMethodRefactoring(cu,start,length);
NullProgressMonitor pm = new NullProgressMonitor();
refactoring1.checkAllConditions(pm);
Change change = refactoring.createChange(pm);
change.perform(pm);

//Do something with this compilation unit that has the refactroing applied.(what to use some metrics here)

cu.discardWrokingcopy();

And i want the IcompilationUnit to revert to its original state. Is this possible? I have tried very combination with the getWorkingCopy(); but nothing works! I still get my code modified.

Thank you in advance!!!
Re: Undo a ExtractMethodRefactoring [message #1403000 is a reply to message #1394605] Sat, 19 July 2014 16:08 Go to previous message
Alexander Gurov is currently offline Alexander GurovFriend
Messages: 106
Registered: July 2009
Senior Member
Hello!

I'm sorry, but I don't think we can help you. The "working copy" that is returned within the ICompilationUnit interface does not have the same meaning as in SVN. And I think the code you're writing should not depend on SVN or any other source control. So, I think it would be better to ask this question in the JDT forums.

[Updated on: Sat, 19 July 2014 16:09]

Report message to a moderator

Previous Topic:Commit Deleted/Missing file bug??
Next Topic:Problems with PDE build using FetchFromSVN
Goto Forum:
  


Current Time: Sun Apr 26 21:17:08 GMT 2015

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

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