Last active
December 15, 2015 15:39
-
-
Save suxiaogang/5283711 to your computer and use it in GitHub Desktop.
IResource rename in plugin development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected boolean renameProject(IProject localProject, String newProjectName) { | |
RenameResourceProcessor renameProcessor = new RenameResourceProcessor(localProject); | |
renameProcessor.setNewResourceName(newProjectName); | |
CheckConditionsOperation condictionOperation = new CheckConditionsOperation(new RenameRefactoring(renameProcessor), | |
CheckConditionsOperation.FINAL_CONDITIONS); | |
CreateChangeOperation operation = new CreateChangeOperation(condictionOperation, | |
RefactoringCore.getConditionCheckingFailedSeverity()); | |
PerformChangeOperation performChangeOperation = new PerformChangeOperation(operation); | |
try { | |
performChangeOperation.run(null); | |
} catch (CoreException e) { | |
return false; | |
} | |
return true; | |
} //org.eclipse.ltk.core.refactoring |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment