use of org.eclipse.xtext.ui.refactoring.impl.RenameElementProcessor in project xtext-xtend by eclipse.
the class XtendJdtRenameParticipantProcessor method isXtendRename.
/**
* @return true, if the triggering refactoring targets an Xtend element.
*/
protected boolean isXtendRename() {
JdtRenameParticipant jdtRenameParticipant = ((JvmModelJdtRenameParticipantContext) getRenameElementContext()).getJdtRenameParticipant();
RefactoringProcessor triggeringProcessor = jdtRenameParticipant.getProcessor().getRefactoring().getProcessor();
if (triggeringProcessor instanceof RenameElementProcessor) {
EClass targetElementEClass = ((RenameElementProcessor) triggeringProcessor).getRenameElementContext().getTargetElementEClass();
return targetElementEClass.getEPackage() == XtendPackage.eINSTANCE;
}
return false;
}
use of org.eclipse.xtext.ui.refactoring.impl.RenameElementProcessor in project xtext-xtend by eclipse.
the class RefactoringIntegrationTest method doRename.
protected void doRename(EObject targetElement, String newName) throws Exception {
URI targetElementURI = EcoreUtil.getURI(targetElement);
RenameElementProcessor processor = processorProvider.get();
processor.initialize(new IRenameElementContext.Impl(targetElementURI, targetElement.eClass(), null, null, null));
processor.setNewName(newName);
RefactoringStatus initialStatus = processor.checkInitialConditions(new NullProgressMonitor());
assertTrue(initialStatus.isOK());
RefactoringStatus finalStatus = processor.checkFinalConditions(new NullProgressMonitor(), null);
assertTrue(finalStatus.toString(), finalStatus.isOK());
final Change change = processor.createChange(new NullProgressMonitor());
assertNotNull(change);
new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
change.perform(monitor);
}
}.run(null);
}
Aggregations