0

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.

VamsiKrishna
  • 751
  • 6
  • 14
  • 29

2 Answers2

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.

Community
  • 1
  • 1
aphex
  • 3,372
  • 2
  • 28
  • 56
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