use of org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor in project xtext-eclipse by eclipse.
the class CombinedJvmJdtRenameProcessor method createChange.
@Override
public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException {
SubMonitor monitor = SubMonitor.convert(pm, jvmElements2jdtProcessors.size() + 1);
CompositeChange compositeChange = new CompositeChange(getProcessorName());
compositeChange.add(super.createChange(monitor.newChild(1)));
for (JavaRenameProcessor processor : jvmElements2jdtProcessors.values()) {
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
compositeChange.add(processor.createChange(monitor.newChild(1)));
}
return compositeChange;
}
use of org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor in project xtext-eclipse by eclipse.
the class CombinedJvmJdtRenameProcessor method checkInitialConditions.
@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException {
SubMonitor monitor = SubMonitor.convert(pm, jvmElements2jdtProcessors.size() + 1);
RefactoringStatus status = super.checkInitialConditions(monitor.newChild(1));
for (JavaRenameProcessor processor : jvmElements2jdtProcessors.values()) {
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
status.merge(processor.checkInitialConditions(monitor.newChild(1)));
}
return status;
}
use of org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor in project xtext-eclipse by eclipse.
the class CombinedJvmJdtRenameProcessor method initialize.
@Override
public boolean initialize(final IRenameElementContext renameElementContext) {
Assert.isLegal(renameElementContext instanceof CombinedJvmJdtRenameContext);
if (!super.initialize(renameElementContext))
return false;
jvmElements2jdtProcessors = newHashMap();
for (Map.Entry<URI, IJavaElement> jvm2javaElement : ((CombinedJvmJdtRenameContext) renameElementContext).getJvm2JavaElements().entrySet()) {
JavaRenameProcessor jdtRenameProcessor = jdtRefactoringFactory.createRenameProcessor(jvm2javaElement.getValue());
if (jdtRenameProcessor != null) {
jvmElements2jdtProcessors.put(jvm2javaElement.getKey(), jdtRenameProcessor);
} else {
return false;
}
}
return true;
}
use of org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor in project xtext-xtend by eclipse.
the class AbstractXtendRenameRefactoringTest method createXtendRenameRefactoring.
protected ProcessorBasedRefactoring createXtendRenameRefactoring(final XtextEditor editor, final int offset, String newName) {
IRenameElementContext renameElementContext = createRenameElementContext(editor, offset);
ProcessorBasedRefactoring renameRefactoring = renameRefactoringProvider.getRenameRefactoring(renameElementContext);
RefactoringProcessor processor = renameRefactoring.getProcessor();
if (processor instanceof AbstractRenameProcessor)
((AbstractRenameProcessor) processor).setNewName(newName);
else if (processor instanceof JavaRenameProcessor)
((JavaRenameProcessor) processor).setNewElementName(newName);
return renameRefactoring;
}
Aggregations