diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/in/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/in/A.java new file mode 100644 index 0000000..ab751ae --- /dev/null +++ b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/in/A.java @@ -0,0 +1,16 @@ +//can rename A.m to k +package p; +interface I { + +} +class B { + void m(T t) { + } + void m(K t) { + } +} +class A extends B { + @Override + void m(I i) { + } +} \ No newline at end of file diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/out/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/out/A.java new file mode 100644 index 0000000..192c543 --- /dev/null +++ b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test41/out/A.java @@ -0,0 +1,16 @@ +//can rename A.m to k +package p; +interface I { + +} +class B { + void k(T t) { + } + void k(K t) { + } +} +class A extends B { + @Override + void k(I i) { + } +} \ No newline at end of file diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/in/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/in/A.java new file mode 100644 index 0000000..3f7c770 --- /dev/null +++ b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/in/A.java @@ -0,0 +1,16 @@ +//can rename A.m(T) to k +package p; +interface I { + +} +class A { + void m(T t) { + } + void m(K t) { + } +} +class B extends A { + @Override + void m(I i) { + } +} \ No newline at end of file diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/out/A.java b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/out/A.java new file mode 100644 index 0000000..fa2814b --- /dev/null +++ b/org.eclipse.jdt.ui.tests.refactoring/resources/RenameVirtualMethodInClass/test42/out/A.java @@ -0,0 +1,16 @@ +//can rename A.m(T) to k +package p; +interface I { + +} +class A { + void k(T t) { + } + void k(K t) { + } +} +class B extends A { + @Override + void k(I i) { + } +} \ No newline at end of file diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java index 4310a79..5f0acb8 100644 --- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java +++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java @@ -1,14 +1,15 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation + * Nikolay Metchev - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 *******************************************************************************/ package org.eclipse.jdt.ui.tests.refactoring; import junit.framework.Test; import junit.framework.TestSuite; @@ -63,10 +64,11 @@ suite.addTest(RenameStaticMethodTests.suite()); suite.addTest(RenameParametersTests.suite()); suite.addTest(MoveInstanceMethodTests.suite()); suite.addTest(IntroduceIndirectionTests.suite()); suite.addTest(IntroduceIndirectionTests17.suite()); + suite.addTest(RippleMethodFinderTests.suite()); //--types suite.addTest(RenameTypeTests.suite()); suite.addTest(RenameTypeParameterTests.suite()); suite.addTest(ChangeTypeRefactoringTests.suite()); diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameVirtualMethodInClassTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameVirtualMethodInClassTests.java index d79bd26..b8f9c98 100644 --- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameVirtualMethodInClassTests.java +++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RenameVirtualMethodInClassTests.java @@ -1,14 +1,15 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation + * Nikolay Metchev - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 *******************************************************************************/ package org.eclipse.jdt.ui.tests.refactoring; import junit.framework.Test; import junit.framework.TestSuite; @@ -517,10 +518,18 @@ assertEquals("was supposed to pass", null, performRefactoring(refactoring)); assertEqualLines("invalid renaming A", getFileContents(getOutputTestFileName("A")), cu.getSource()); } + public void test41() throws Exception { + helper2_0("m", "k", new String[] { "QI;" }); + } + +// public void test42() throws Exception { +// helper2_0("m", "k", new String[] { "QT;" }); +// } + //anonymous inner class public void testAnon0() throws Exception{ helper2(); } diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RippleMethodFinderTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RippleMethodFinderTests.java index 0cd527f..4b61700 100644 --- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RippleMethodFinderTests.java +++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/RippleMethodFinderTests.java @@ -1,19 +1,18 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation + * Nikolay Metchev - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 *******************************************************************************/ package org.eclipse.jdt.ui.tests.refactoring; -import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.List; import junit.framework.Test; import junit.framework.TestSuite; @@ -21,19 +20,15 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2; -import org.eclipse.jdt.ui.tests.refactoring.infra.AbstractCUTestCase; -import org.eclipse.jdt.ui.tests.refactoring.infra.RefactoringTestPlugin; - -public class RippleMethodFinderTests extends AbstractCUTestCase { +public class RippleMethodFinderTests extends RefactoringTest { private static final Class clazz= RippleMethodFinderTests.class; private static final String REFACTORING_PATH= "RippleMethodFinder/"; private static final String TARGET= "/*target*/"; private static final String RIPPLE= "/*ripple*/"; @@ -52,18 +47,17 @@ public static Test setUpTest(Test someTest) { return new RefactoringTestSetup(someTest); } - protected InputStream getFileInputStream(String fileName) throws IOException { - return RefactoringTestPlugin.getDefault().getTestResourceStream(fileName); + @Override + protected String createTestFileName(String cuName, String infix) { + return getTestPath() + "/RippleMethodFinder/" + cuName + ".java"; } private void perform() throws Exception { - IPackageFragment pack= RefactoringTestSetup.getPackageP(); - String name= adaptName("A_" + getName()); - ICompilationUnit cu= createCU(pack, name, getFileInputStream(getResourceLocation() + "/" + name)); + ICompilationUnit cu= createCUfromTestFile(getPackageP(), "A_" + getName()); String contents= cu.getBuffer().getContents(); IJavaElement[] elements= cu.codeSelect(contents.indexOf(TARGET) + TARGET.length(), 0); assertEquals(1, elements.length); diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java index 5b773e0..9e78d11 100644 --- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java +++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java @@ -1,14 +1,15 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation + * Nikolay Metchev - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 *******************************************************************************/ package org.eclipse.jdt.internal.corext.refactoring.rename; import java.util.Arrays; import java.util.HashSet; @@ -43,22 +44,20 @@ import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels; public class RenameVirtualMethodProcessor extends RenameMethodProcessor { - private IMethod fOriginalMethod; private boolean fActivationChecked; private ITypeHierarchy fCachedHierarchy= null; /** * Creates a new rename method processor. * * @param method the method */ public RenameVirtualMethodProcessor(IMethod method) { super(method); - fOriginalMethod= getMethod(); } /** * Creates a new rename method processor from arguments * @@ -68,11 +67,10 @@ */ public RenameVirtualMethodProcessor(IMethod method, JavaRefactoringArguments arguments, RefactoringStatus status) { this(method); RefactoringStatus initializeStatus= initialize(arguments); status.merge(initializeStatus); - fOriginalMethod= getMethod(); } /* * int. not javadoc'd * @@ -81,18 +79,13 @@ * methods. * */ RenameVirtualMethodProcessor(IMethod topLevel, IMethod[] ripples, TextChangeManager changeManager, ITypeHierarchy hierarchy, GroupCategorySet categorySet) { super(topLevel, changeManager, categorySet); - fOriginalMethod= getMethod(); fActivationChecked= true; // is top level fCachedHierarchy= hierarchy; // may be null setMethodsToRename(ripples); - } - - public IMethod getOriginalMethod() { - return fOriginalMethod; } private ITypeHierarchy getCachedHierarchy(IType declaring, IProgressMonitor monitor) throws JavaModelException { if (fCachedHierarchy != null && declaring.equals(fCachedHierarchy.getType())) return fCachedHierarchy; @@ -114,23 +107,11 @@ return result; try{ monitor.beginTask("", 3); //$NON-NLS-1$ if (!fActivationChecked) { // the following code may change the method to be changed. - IMethod method= getMethod(); - fOriginalMethod= method; - - ITypeHierarchy hierarchy= null; - IType declaringType= method.getDeclaringType(); - if (!declaringType.isInterface()) - hierarchy= getCachedHierarchy(declaringType, new SubProgressMonitor(monitor, 1)); - - IMethod topmost= getMethod(); - if (MethodChecks.isVirtual(topmost)) - topmost= MethodChecks.getTopmostMethod(getMethod(), hierarchy, monitor); - if (topmost != null) - initialize(topmost); + initialize(getMethod()); fActivationChecked= true; } } finally{ monitor.done(); } diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java index 0657e8c..6aaf46f 100644 --- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java +++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RippleMethodFinder2.java @@ -1,14 +1,15 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation + * Nikolay Metchev - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 *******************************************************************************/ package org.eclipse.jdt.internal.corext.refactoring.rename; import java.util.ArrayList; import java.util.Arrays; @@ -24,11 +25,10 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IRegion; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.ITypeHierarchy; import org.eclipse.jdt.core.JavaCore; @@ -50,11 +50,11 @@ public class RippleMethodFinder2 { private final IMethod fMethod; private List fDeclarations; private ITypeHierarchy fHierarchy; - private Map fTypeToMethod; + private MultiMap fTypeToMethod; private Set fRootTypes; private MultiMap fRootReps; private Map fRootHierarchies; private UnionFind fUnionFind; @@ -74,10 +74,14 @@ collection.add(value); } public Collection get(K key) { return fImplementation.get(key); + } + + public Set keySet() { + return fImplementation.keySet(); } } private static class UnionFind { HashMap fElementToRepresentative= new HashMap(); @@ -220,11 +224,11 @@ List relatedTypes= partitioning.get(methodTypeRep); boolean hasRelatedInterfaces= false; List relatedMethods= new ArrayList(); for (Iterator iter= relatedTypes.iterator(); iter.hasNext();) { IType relatedType= iter.next(); - relatedMethods.add(fTypeToMethod.get(relatedType)); + relatedMethods.addAll(fTypeToMethod.get(relatedType)); if (relatedType.isInterface()) hasRelatedInterfaces= true; } //Definition: An alien type is a type that is not a related type. The set of @@ -268,22 +272,24 @@ HashSet marriedAlienTypeReps= new HashSet(); for (Iterator iter= alienTypes.iterator(); iter.hasNext();) { if (pm.isCanceled()) throw new OperationCanceledException(); IType alienType= iter.next(); - IMethod alienMethod= fTypeToMethod.get(alienType); - ITypeHierarchy hierarchy= getCachedHierarchy(alienType, owner, new SubProgressMonitor(pm, 1)); - if (hierarchy == null) - hierarchy= alienType.newTypeHierarchy(owner, new SubProgressMonitor(pm, 1)); - IType[] allSubtypes= hierarchy.getAllSubtypes(alienType); - for (int i= 0; i < allSubtypes.length; i++) { - IType subtype= allSubtypes[i]; - if (relatedSubTypes.contains(subtype)) { - if (JavaModelUtil.isVisibleInHierarchy(alienMethod, subtype.getPackageFragment())) { - marriedAlienTypeReps.add(fUnionFind.find(alienType)); - } else { - // not overridden + Collection alienMethods= fTypeToMethod.get(alienType); + for (IMethod alienMethod : alienMethods) { + ITypeHierarchy hierarchy= getCachedHierarchy(alienType, owner, new SubProgressMonitor(pm, 1)); + if (hierarchy == null) + hierarchy= alienType.newTypeHierarchy(owner, new SubProgressMonitor(pm, 1)); + IType[] allSubtypes= hierarchy.getAllSubtypes(alienType); + for (int i= 0; i < allSubtypes.length; i++) { + IType subtype= allSubtypes[i]; + if (relatedSubTypes.contains(subtype)) { + if (JavaModelUtil.isVisibleInHierarchy(alienMethod, subtype.getPackageFragment())) { + marriedAlienTypeReps.add(fUnionFind.find(alienType)); + } else { + // not overridden + } } } } } @@ -293,11 +299,11 @@ for (Iterator iter= marriedAlienTypeReps.iterator(); iter.hasNext();) { IType marriedAlienTypeRep= iter.next(); List marriedAlienTypes= partitioning.get(marriedAlienTypeRep); for (Iterator iterator= marriedAlienTypes.iterator(); iterator.hasNext();) { IType marriedAlienInterfaceType= iterator.next(); - relatedMethods.add(fTypeToMethod.get(marriedAlienInterfaceType)); + relatedMethods.addAll(fTypeToMethod.get(marriedAlienInterfaceType)); } alienTypes.removeAll(marriedAlienTypes); //not alien any more relatedTypesToProcess.addAll(marriedAlienTypes); //process freshly married types again } } @@ -343,11 +349,11 @@ fDeclarationToMatch.put(method, match); } } } - int limitTo = IJavaSearchConstants.DECLARATIONS | IJavaSearchConstants.IGNORE_DECLARING_TYPE | IJavaSearchConstants.IGNORE_RETURN_TYPE; + int limitTo= IJavaSearchConstants.DECLARATIONS | IJavaSearchConstants.IGNORE_DECLARING_TYPE | IJavaSearchConstants.IGNORE_RETURN_TYPE; int matchRule= SearchPattern.R_ERASURE_MATCH | SearchPattern.R_CASE_SENSITIVE; SearchPattern pattern= SearchPattern.createPattern(fMethod, limitTo, matchRule); SearchParticipant[] participants= SearchUtils.getDefaultSearchParticipants(); IJavaSearchScope scope= RefactoringScopeFactory.createRelatedProjectsScope(fMethod.getJavaProject(), IJavaSearchScope.SOURCES | IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SYSTEM_LIBRARIES); MethodRequestor requestor= new MethodRequestor(); @@ -364,11 +370,11 @@ } fHierarchy= JavaCore.newTypeHierarchy(region, owner, pm); } private void createTypeToMethod() { - fTypeToMethod= new HashMap(); + fTypeToMethod= new MultiMap(); for (Iterator iter= fDeclarations.iterator(); iter.hasNext();) { IMethod declaration= iter.next(); fTypeToMethod.put(declaration.getDeclaringType(), declaration); } } @@ -402,19 +408,21 @@ if (superRep == null) { //Type doesn't declare method, but maybe supertypes? uniteWithSupertypes(anchor, supertype); } else { //check whether method in supertype is really overridden: - IMember superMethod= fTypeToMethod.get(supertype); - if (JavaModelUtil.isVisibleInHierarchy(superMethod, anchor.getPackageFragment())) { - IType rep= fUnionFind.find(anchor); - fUnionFind.union(rep, superRep); - // current type is no root anymore - fRootTypes.remove(anchor); - uniteWithSupertypes(supertype, supertype); - } else { - //Not overridden -> overriding chain ends here. + Collection superMethods= fTypeToMethod.get(supertype); + for (IMethod superMethod : superMethods) { + if (JavaModelUtil.isVisibleInHierarchy(superMethod, anchor.getPackageFragment())) { + IType rep= fUnionFind.find(anchor); + fUnionFind.union(rep, superRep); + // current type is no root anymore + fRootTypes.remove(anchor); + uniteWithSupertypes(supertype, supertype); + } else { + //Not overridden -> overriding chain ends here. + } } } } } } diff --git a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameMethodUserInterfaceStarter.java b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameMethodUserInterfaceStarter.java deleted file mode 100644 index 7b45f49..0000000 --- a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameMethodUserInterfaceStarter.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jdt.internal.ui.refactoring.reorg; - -import org.eclipse.swt.widgets.Shell; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; - -import org.eclipse.jface.dialogs.MessageDialog; - -import org.eclipse.ltk.core.refactoring.Refactoring; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; - -import org.eclipse.jdt.core.IMethod; - -import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages; -import org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor; -import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; -import org.eclipse.jdt.internal.corext.util.Messages; - -import org.eclipse.jdt.ui.JavaElementLabels; - -public class RenameMethodUserInterfaceStarter extends RenameUserInterfaceStarter { - - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.ui.refactoring.reorg.RenameUserInterfaceStarter#activate(org.eclipse.jdt.internal.corext.refactoring.base.Refactoring, org.eclipse.swt.widgets.Shell) - */ - @Override - public boolean activate(Refactoring refactoring, Shell parent, int saveMode) throws CoreException { - RenameVirtualMethodProcessor processor= (RenameVirtualMethodProcessor)refactoring.getAdapter(RenameVirtualMethodProcessor.class); - if (processor != null) { - RefactoringStatus status= processor.checkInitialConditions(new NullProgressMonitor()); - if (!status.hasFatalError()) { - IMethod method= processor.getMethod(); - if (!method.equals(processor.getOriginalMethod())) { - String message= null; - if (method.getDeclaringType().isInterface()) { - message= Messages.format( - RefactoringCoreMessages.MethodChecks_implements, - new String[]{ - JavaElementUtil.createMethodSignature(method), - JavaElementLabels.getElementLabel(method.getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED)}); - } else { - message= Messages.format( - RefactoringCoreMessages.MethodChecks_overrides, - new String[]{ - JavaElementUtil.createMethodSignature(method), - JavaElementLabels.getElementLabel(method.getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED)}); - } - message= Messages.format( - ReorgMessages.RenameMethodUserInterfaceStarter_message, - message); - if (!MessageDialog.openQuestion(parent, - ReorgMessages.RenameMethodUserInterfaceStarter_name, - message)) { - return false; - } - } - } - } - return super.activate(refactoring, parent, saveMode); - } -} diff --git a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameUserInterfaceManager.java b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameUserInterfaceManager.java index fda401c..e410f2b 100644 --- a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameUserInterfaceManager.java +++ b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/reorg/RenameUserInterfaceManager.java @@ -1,14 +1,15 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation + * Nikolay Metchev - [rename] Rename method misses ambiguously overridden method - https://bugs.eclipse.org/99622 *******************************************************************************/ package org.eclipse.jdt.internal.ui.refactoring.reorg; import org.eclipse.jdt.internal.corext.refactoring.rename.RenameCompilationUnitProcessor; import org.eclipse.jdt.internal.corext.refactoring.rename.RenameEnumConstProcessor; @@ -38,10 +39,10 @@ put(RenameCompilationUnitProcessor.class, RenameUserInterfaceStarter.class, RenameCuWizard.class); put(RenameTypeProcessor.class, RenameUserInterfaceStarter.class, RenameTypeWizard.class); put(RenameFieldProcessor.class, RenameUserInterfaceStarter.class, RenameFieldWizard.class); put(RenameEnumConstProcessor.class, RenameUserInterfaceStarter.class, RenameEnumConstWizard.class); put(RenameTypeParameterProcessor.class, RenameUserInterfaceStarter.class, RenameTypeParameterWizard.class); - put(RenameNonVirtualMethodProcessor.class, RenameMethodUserInterfaceStarter.class, RenameMethodWizard.class); - put(RenameVirtualMethodProcessor.class, RenameMethodUserInterfaceStarter.class, RenameMethodWizard.class); + put(RenameNonVirtualMethodProcessor.class, RenameUserInterfaceStarter.class, RenameMethodWizard.class); + put(RenameVirtualMethodProcessor.class, RenameUserInterfaceStarter.class, RenameMethodWizard.class); put(RenameLocalVariableProcessor.class, RenameUserInterfaceStarter.class, RenameLocalVariableWizard.class); } }