Search in sources :

Example 1 with RenameVirtualMethodProcessor

use of org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor in project che by eclipse.

the class RenameMethodInInterfaceTest method helper1_not_available.

private void helper1_not_available(String methodName, String[] signatures) throws Exception {
    ICompilationUnit cu = createCUfromTestFile(getPackageP(), "A");
    IType interfaceI = getType(cu, "I");
    RenameProcessor processor = new RenameVirtualMethodProcessor(interfaceI.getMethod(methodName, signatures));
    RenameRefactoring ref = new RenameRefactoring(processor);
    assertTrue(!ref.isApplicable());
}
Also used : ICompilationUnit(org.eclipse.jdt.core.ICompilationUnit) RenameProcessor(org.eclipse.ltk.core.refactoring.participants.RenameProcessor) RenameVirtualMethodProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor) RenameRefactoring(org.eclipse.ltk.core.refactoring.participants.RenameRefactoring) IType(org.eclipse.jdt.core.IType)

Example 2 with RenameVirtualMethodProcessor

use of org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor 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);
}
Also used : RenameVirtualMethodProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor) RenameRefactoring(org.eclipse.ltk.core.refactoring.participants.RenameRefactoring) RefactoringStatus(org.eclipse.ltk.core.refactoring.RefactoringStatus) RenameMethodProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor) IType(org.eclipse.jdt.core.IType)

Example 3 with RenameVirtualMethodProcessor

use of org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor 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());
}
Also used : RenameVirtualMethodProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor) RenameRefactoring(org.eclipse.ltk.core.refactoring.participants.RenameRefactoring) RenameMethodProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor) IType(org.eclipse.jdt.core.IType)

Example 4 with RenameVirtualMethodProcessor

use of org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor in project che by eclipse.

the class RenameMethodRefactoringContribution method createRefactoring.

/**
	 * {@inheritDoc}
	 */
@Override
public Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) throws JavaModelException {
    JavaRefactoringArguments arguments = new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
    String input = arguments.getAttribute(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT);
    IMethod method = (IMethod) JavaRefactoringDescriptorUtil.handleToElement(arguments.getProject(), input);
    if (method == null) {
        status.addFatalError(Messages.format(RefactoringCoreMessages.RenameMethodRefactoringContribution_could_not_create, new Object[] { BasicElementLabels.getResourceName(arguments.getProject()), input }));
        return null;
    }
    JavaRenameProcessor processor;
    if (MethodChecks.isVirtual(method)) {
        processor = new RenameVirtualMethodProcessor(method, arguments, status);
    } else {
        processor = new RenameNonVirtualMethodProcessor(method, arguments, status);
    }
    return new RenameRefactoring(processor);
}
Also used : JavaRefactoringArguments(org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments) RenameNonVirtualMethodProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameNonVirtualMethodProcessor) RenameVirtualMethodProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor) RenameRefactoring(org.eclipse.ltk.core.refactoring.participants.RenameRefactoring) JavaRenameProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor) IMethod(org.eclipse.jdt.core.IMethod)

Aggregations

RenameVirtualMethodProcessor (org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor)4 RenameRefactoring (org.eclipse.ltk.core.refactoring.participants.RenameRefactoring)4 IType (org.eclipse.jdt.core.IType)3 RenameMethodProcessor (org.eclipse.jdt.internal.corext.refactoring.rename.RenameMethodProcessor)2 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)1 IMethod (org.eclipse.jdt.core.IMethod)1 JavaRefactoringArguments (org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments)1 JavaRenameProcessor (org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor)1 RenameNonVirtualMethodProcessor (org.eclipse.jdt.internal.corext.refactoring.rename.RenameNonVirtualMethodProcessor)1 RefactoringStatus (org.eclipse.ltk.core.refactoring.RefactoringStatus)1 RenameProcessor (org.eclipse.ltk.core.refactoring.participants.RenameProcessor)1