Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [LTK Refactoring] How to control the order of Refactoring are executed({Repost to platform from tools.jdt})
[LTK Refactoring] How to control the order of Refactoring are executed [message #821169] Wed, 14 March 2012 22:22 Go to next message
Harshana Martin is currently offline Harshana Martin
Messages: 4
Registered: December 2011
Junior Member
Hi All,

I have implemented a refactoring by extending rename participant and it suppose to do some modifications to a file reside in a project (metadata file) upon renaming that project.

But the issue I'm facing is, by the time my factoring get executed, refactoring contributed from org.eclipse.ltk.internal.core.refactoring.resource.RenameResourceRefactoringContribution is already executed and hence the original project name is now changed to the new one. Hence my refactoring implementation throws exceptions and fails.

Therefore is there any mechanism in place to control the order of the refactoring contributions and participants are executed?

Thanks and Regards,
Harshana

[Updated on: Wed, 14 March 2012 23:07]

Report message to a moderator

Re: [LTK Refactoring] How to control the order of Refactoring are executed [message #821879 is a reply to message #821169] Thu, 15 March 2012 19:18 Go to previous message
Harshana Martin is currently offline Harshana Martin
Messages: 4
Registered: December 2011
Junior Member
Hi All,

I figured out the solution.

In the rename participant class we have 2 methods as following.

1. createPreChange
2. createChange

Here, if we you need to execute a change before refactoring occurs , for example to update a metadata file, you need to implement your change in createPreChange method. createPreChange method is executed before carrying out actual refactoring.

On the other hand if you want to make some change to the refactored target, then you can use createChange to define the changes to be carried out after the refactoring. createChange is executed after actual refactoring taken place.

Hope this helps to everyone who got in to the same issue!

Thanks and Regards,
Harshana
Previous Topic:Eclipse customization
Next Topic:Console with prompt
Goto Forum:
  


Current Time: Thu Jul 31 07:40:19 EDT 2014

Powered by FUDForum. Page generated in 0.01456 seconds