use of org.eclipse.ltk.core.refactoring.Refactoring in project che by eclipse.
the class RenameParametersTest method helper2.
private void helper2(String[] newNames, String[] signature) throws Exception {
IType classA = getType(createCUfromTestFile(getPackageP(), false, false), "A");
//DebugUtils.dump("classA" + classA);
IMethod method = classA.getMethod("m", signature);
Assert.assertTrue("refactoring not available", RefactoringAvailabilityTester.isChangeSignatureAvailable(method));
ChangeSignatureProcessor processor = new ChangeSignatureProcessor(method);
Refactoring ref = new ProcessorBasedRefactoring(processor);
modifyInfos(processor.getParameterInfos(), newNames);
RefactoringStatus result = performRefactoring(ref);
Assert.assertNotNull("precondition was supposed to fail", result);
}
use of org.eclipse.ltk.core.refactoring.Refactoring in project che by eclipse.
the class RenameVirtualMethodInClassTest method test18.
@Test
public void test18() throws Exception {
ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
ICompilationUnit cuC = createCUfromTestFile(getPackageP(), "C");
IType classB = getType(cu, "B");
IMethod method = classB.getMethod("m", new String[] { "I" });
final RenameJavaElementDescriptor descriptor = RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_METHOD);
descriptor.setJavaElement(method);
descriptor.setNewName("kk");
descriptor.setUpdateReferences(true);
final RefactoringStatus status = new RefactoringStatus();
final Refactoring refactoring = descriptor.createRefactoring(status);
assertNotNull("Refactoring should not be null", refactoring);
assertTrue("status should be ok", status.isOK());
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.ltk.core.refactoring.Refactoring in project che by eclipse.
the class RenameVirtualMethodInClassTest method test40.
@Test
public void test40() throws Exception {
// test for bug 68592
ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
IType localClass = cu.getType("A").getMethod("doit", new String[0]).getType("LocalClass", 1);
IMethod method = localClass.getMethod("method", new String[] { "I" });
final RenameJavaElementDescriptor descriptor = RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_METHOD);
descriptor.setJavaElement(method);
descriptor.setNewName("method2");
descriptor.setUpdateReferences(true);
final RefactoringStatus status = new RefactoringStatus();
final Refactoring refactoring = descriptor.createRefactoring(status);
assertNotNull("Refactoring should not be null", refactoring);
assertTrue("status should be ok", status.isOK());
assertEquals("was supposed to pass", null, performRefactoring(refactoring));
assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("A")), cu.getSource());
}
use of org.eclipse.ltk.core.refactoring.Refactoring in project che by eclipse.
the class RenameTypeTest method helper3.
private void helper3(String oldName, String newName, boolean updateRef, boolean updateTextual, boolean updateSimilar, String nonJavaFiles) throws JavaModelException, CoreException, IOException, Exception {
RefactoringDescriptor descriptor = initWithAllOptions(oldName, oldName, newName, updateRef, updateTextual, updateSimilar, nonJavaFiles, RenamingNameSuggestor.STRATEGY_EMBEDDED);
Refactoring ref = createRefactoring(descriptor);
RefactoringStatus status = performRefactoring(ref);
Assert.assertNull("was supposed to pass", status);
checkResultInClass(newName);
checkMappedSimilarElementsExist(ref);
}
use of org.eclipse.ltk.core.refactoring.Refactoring in project che by eclipse.
the class RenameTypeTest method helper3_inner.
private void helper3_inner(String oldName, String oldInnerName, String newName, String innerNewName, boolean updateRef, boolean updateTextual, boolean updateSimilar, String nonJavaFiles) throws JavaModelException, CoreException, IOException, Exception {
RefactoringDescriptor descriptor = initWithAllOptions(oldName, oldInnerName, innerNewName, updateRef, updateTextual, updateSimilar, nonJavaFiles, RenamingNameSuggestor.STRATEGY_EMBEDDED);
Refactoring ref = createRefactoring(descriptor);
Assert.assertNull("was supposed to pass", performRefactoring(ref));
checkResultInClass(newName);
checkMappedSimilarElementsExist(ref);
}
Aggregations