I have a requirement to Rename a project from eclipse plugin. I have read this article. I am new to plugin development. If anyone has prev experience can you share me the steps to be followed.
Asked
Active
Viewed 874 times
2 Answers
0
There is org.eclipse.ltk, which enables you to make refactoring. In this Thread you can see how to execute refactoring programatically, which includes renaming.
0
I recently had to do this and this is what we did based on the above referred article.
RefactoringContribution contribution = RefactoringCore.getRefactoringContribution(RenameResourceDescriptor.ID);
RenameResourceDescriptor desc = (RenameResourceDescriptor) contribution.createDescriptor();
desc.setProject(null);
desc.setResourcePath(root.getProject(name).getFullPath());
desc.setNewName(newName);
RefactoringStatus status = new RefactoringStatus();
Refactoring refactoring = desc.createRefactoring(status);
refactoring.checkInitialConditions(monitor);
refactoring.checkFinalConditions(monitor);
Change change = refactoring.createChange(monitor);
change.perform(monitor);

singularity
- 1,057
- 2
- 10
- 20