use of org.eclipse.ltk.core.refactoring.participants.RenameRefactoring in project che by eclipse.
the class RenameVirtualMethodInClassTest method helper1_0.
private void helper1_0(String methodName, String newMethodName, String[] signatures) throws Exception {
IType classA = getType(createCUfromTestFile(getPackageP(), "A"), "A");
RenameMethodProcessor processor = new RenameVirtualMethodProcessor(classA.getMethod(methodName, signatures));
RenameRefactoring ref = new RenameRefactoring(processor);
processor.setNewElementName(newMethodName);
RefactoringStatus result = performRefactoring(ref);
assertNotNull("precondition was supposed to fail", result);
}
use of org.eclipse.ltk.core.refactoring.participants.RenameRefactoring in project che by eclipse.
the class RenameVirtualMethodInClassTest method helper1_not_available.
private void helper1_not_available(String methodName, String[] signatures) throws Exception {
IType classA = getType(createCUfromTestFile(getPackageP(), "A"), "A");
RenameMethodProcessor processor = new RenameVirtualMethodProcessor(classA.getMethod(methodName, signatures));
RenameRefactoring ref = new RenameRefactoring(processor);
assertTrue(!ref.isApplicable());
}
use of org.eclipse.ltk.core.refactoring.participants.RenameRefactoring in project che by eclipse.
the class RenameTypeParameterTest method helper1.
private void helper1(String parameterName, String newParameterName, String typeName, String methodName, String[] methodSignature, boolean references) throws Exception {
IType declaringType = getType(createCUfromTestFile(getPackageP(), "A"), typeName);
IMethod[] declaringMethods = getMethods(declaringType, new String[] { methodName }, new String[][] { methodSignature });
RenameTypeParameterProcessor processor = new RenameTypeParameterProcessor(declaringMethods[0].getTypeParameter(parameterName));
RenameRefactoring refactoring = new RenameRefactoring(processor);
processor.setNewElementName(newParameterName);
processor.setUpdateReferences(references);
RefactoringStatus result = performRefactoring(refactoring);
assertNotNull("precondition was supposed to fail", result);
}
use of org.eclipse.ltk.core.refactoring.participants.RenameRefactoring in project che by eclipse.
the class RenameTypeParameterTest method helper2.
private void helper2(String parameterName, String newParameterName, String typeName, String methodName, String[] methodSignature, boolean references) throws Exception {
ParticipantTesting.reset();
ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
IType declaringType = getType(cu, typeName);
IMethod[] declaringMethods = getMethods(declaringType, new String[] { methodName }, new String[][] { methodSignature });
ITypeParameter typeParameter = declaringMethods[0].getTypeParameter(parameterName);
RenameTypeParameterProcessor processor = new RenameTypeParameterProcessor(typeParameter);
RenameRefactoring refactoring = new RenameRefactoring(processor);
processor.setNewElementName(newParameterName);
processor.setUpdateReferences(references);
RefactoringStatus result = performRefactoring(refactoring);
assertEquals("was supposed to pass", null, result);
assertEqualLines("invalid renaming", getFileContents(getOutputTestFileName("A")), cu.getSource());
assertTrue("anythingToUndo", RefactoringCore.getUndoManager().anythingToUndo());
assertTrue("! anythingToRedo", !RefactoringCore.getUndoManager().anythingToRedo());
RefactoringCore.getUndoManager().performUndo(null, new NullProgressMonitor());
assertEqualLines("invalid undo", getFileContents(getInputTestFileName("A")), cu.getSource());
assertTrue("! anythingToUndo", !RefactoringCore.getUndoManager().anythingToUndo());
assertTrue("anythingToRedo", RefactoringCore.getUndoManager().anythingToRedo());
RefactoringCore.getUndoManager().performRedo(null, new NullProgressMonitor());
assertEqualLines("invalid redo", getFileContents(getOutputTestFileName("A")), cu.getSource());
}
use of org.eclipse.ltk.core.refactoring.participants.RenameRefactoring in project che by eclipse.
the class RenameTypeParameterTest method helper2.
private void helper2(String parameterName, String newParameterName, String typeName, boolean references) throws Exception {
ParticipantTesting.reset();
ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
IType declaringType = getType(cu, typeName);
ITypeParameter typeParameter = declaringType.getTypeParameter(parameterName);
RenameTypeParameterProcessor processor = new RenameTypeParameterProcessor(typeParameter);
RenameRefactoring refactoring = new RenameRefactoring(processor);
processor.setNewElementName(newParameterName);
processor.setUpdateReferences(references);
RefactoringStatus result = performRefactoring(refactoring);
assertEquals("was supposed to pass", null, result);
assertEqualLines("invalid renaming", getFileContents(getOutputTestFileName("A")), cu.getSource());
assertTrue("anythingToUndo", RefactoringCore.getUndoManager().anythingToUndo());
assertTrue("! anythingToRedo", !RefactoringCore.getUndoManager().anythingToRedo());
RefactoringCore.getUndoManager().performUndo(null, new NullProgressMonitor());
assertEqualLines("invalid undo", getFileContents(getInputTestFileName("A")), cu.getSource());
assertTrue("! anythingToUndo", !RefactoringCore.getUndoManager().anythingToUndo());
assertTrue("anythingToRedo", RefactoringCore.getUndoManager().anythingToRedo());
RefactoringCore.getUndoManager().performRedo(null, new NullProgressMonitor());
assertEqualLines("invalid redo", getFileContents(getOutputTestFileName("A")), cu.getSource());
}
Aggregations