use of org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor 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.jdt.internal.corext.refactoring.rename.RenameMethodProcessor 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.jdt.internal.corext.refactoring.rename.RenameMethodProcessor in project che by eclipse.
the class RenamePrivateMethodTest 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 RenameNonVirtualMethodProcessor(classA.getMethod(methodName, signatures));
RenameRefactoring refactoring = new RenameRefactoring(processor);
processor.setNewElementName(newMethodName);
RefactoringStatus result = performRefactoring(refactoring);
assertNotNull("precondition was supposed to fail", result);
}
use of org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor in project che by eclipse.
the class RenamePrivateMethodTest method test18.
@Test
public void test18() throws Exception {
ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
ICompilationUnit cuC = createCUfromTestFile(getPackageP(), "C");
IType classB = getType(cu, "B");
RenameMethodProcessor processor = new RenameNonVirtualMethodProcessor(classB.getMethod("m", new String[] { "I" }));
RenameRefactoring refactoring = new RenameRefactoring(processor);
processor.setNewElementName("kk");
assertEquals("was supposed to pass", null, performRefactoring(refactoring));
assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("A")), cu.getSource());
assertEqualLines("invalid renaming C", getFileContents(getOutputTestFileName("C")), cuC.getSource());
}
use of org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor in project che by eclipse.
the class RenamePrivateMethodTest method helper2_0.
private void helper2_0(String methodName, String newMethodName, String[] signatures, boolean updateReferences, boolean createDelegate) throws Exception {
ParticipantTesting.reset();
ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
IType classA = getType(cu, "A");
IMethod method = classA.getMethod(methodName, signatures);
String[] handles = ParticipantTesting.createHandles(method);
RenameMethodProcessor processor = new RenameNonVirtualMethodProcessor(method);
RenameRefactoring refactoring = new RenameRefactoring(processor);
processor.setUpdateReferences(updateReferences);
processor.setNewElementName(newMethodName);
processor.setDelegateUpdating(createDelegate);
assertEquals("was supposed to pass", null, performRefactoring(refactoring));
assertEqualLines("invalid renaming", getFileContents(getOutputTestFileName("A")), cu.getSource());
ParticipantTesting.testRename(handles, new RenameArguments[] { new RenameArguments(newMethodName, updateReferences) });
assertTrue("anythingToUndo", RefactoringCore.getUndoManager().anythingToUndo());
assertTrue("! anythingToRedo", !RefactoringCore.getUndoManager().anythingToRedo());
//assertEquals("1 to undo", 1, Refactoring.getUndoManager().getRefactoringLog().size());
RefactoringCore.getUndoManager().performUndo(null, new NullProgressMonitor());
assertEqualLines("invalid undo", getFileContents(getInputTestFileName("A")), cu.getSource());
assertTrue("! anythingToUndo", !RefactoringCore.getUndoManager().anythingToUndo());
assertTrue("anythingToRedo", RefactoringCore.getUndoManager().anythingToRedo());
//assertEquals("1 to redo", 1, Refactoring.getUndoManager().getRedoStack().size());
RefactoringCore.getUndoManager().performRedo(null, new NullProgressMonitor());
assertEqualLines("invalid redo", getFileContents(getOutputTestFileName("A")), cu.getSource());
}
Aggregations