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.

4

2 回答 2

0

有 org.eclipse.ltk,它使您能够进行重构。在这个线程中,您可以看到如何以编程方式执行重构,其中包括重命名。

于 2012-08-03T09:06:58.360 回答
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);
于 2018-09-01T17:39:44.497 回答