use of org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring in project xtext-xtend by eclipse.
the class JavaRefactoringIntegrationTest 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;
}
use of org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring in project xtext-xtend by eclipse.
the class JavaRefactoringIntegrationTest method renameXtendElement.
protected void renameXtendElement(final XtextEditor editor, final int offset, final String newName, final int allowedSeverity) throws Exception {
syncUtil.totalSync(false);
new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
ProcessorBasedRefactoring renameRefactoring = createXtendRenameRefactoring(editor, offset, newName);
assertTrue("Refactoring not applicable", renameRefactoring.isApplicable());
RefactoringStatus status = renameRefactoring.checkAllConditions(new NullProgressMonitor());
assertTrue(status.toString(), status.getSeverity() <= allowedSeverity);
Change change = renameRefactoring.createChange(new NullProgressMonitor());
change.perform(new NullProgressMonitor());
}
}.run(new NullProgressMonitor());
syncUtil.totalSync(false);
assertTrue(compositeRefactoringProcessorAccess.isDisposed());
}
use of org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring in project xtext-xtend by eclipse.
the class JavaRefactoringIntegrationTest method renameXtendElementWithError.
protected RefactoringStatus renameXtendElementWithError(final XtextEditor editor, final int offset, String newName) throws Exception {
syncUtil.totalSync(false);
ProcessorBasedRefactoring renameRefactoring = createXtendRenameRefactoring(editor, offset, newName);
RefactoringStatus status = renameRefactoring.checkAllConditions(new NullProgressMonitor());
assertFalse("Expected an error", status.isOK());
return status;
}
use of org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring in project xtext-xtend by eclipse.
the class AbstractXtendRenameRefactoringTest method renameXtendElement.
protected void renameXtendElement(final XtextEditor editor, final int offset, final String newName, final int allowedSeverity, IProgressMonitor monitor) throws Exception {
syncUtil.totalSync(false);
new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
ProcessorBasedRefactoring renameRefactoring = createXtendRenameRefactoring(editor, offset, newName);
assertTrue("Refactoring not applicable", renameRefactoring.isApplicable());
RefactoringStatus status = renameRefactoring.checkAllConditions(monitor);
assertTrue(status.toString(), status.getSeverity() <= allowedSeverity);
Change change = renameRefactoring.createChange(monitor);
change.perform(monitor);
}
}.run(monitor);
syncUtil.totalSync(false);
assertTrue(compositeRefactoringProcessorAccess.isDisposed());
}
use of org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring in project xtext-xtend by eclipse.
the class AbstractXtendRenameRefactoringTest method renameXtendElementWithError.
protected RefactoringStatus renameXtendElementWithError(final XtextEditor editor, final int offset, String newName, IProgressMonitor monitor) throws Exception {
syncUtil.totalSync(false);
ProcessorBasedRefactoring renameRefactoring = createXtendRenameRefactoring(editor, offset, newName);
RefactoringStatus status = renameRefactoring.checkAllConditions(monitor);
assertFalse("Expected an error", status.isOK());
return status;
}
Aggregations