1 11 package org.eclipse.jdt.internal.ui.refactoring.reorg; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.NullProgressMonitor; 15 16 import org.eclipse.jdt.core.IMethod; 17 18 import org.eclipse.swt.widgets.Shell; 19 20 import org.eclipse.jface.dialogs.MessageDialog; 21 22 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages; 23 import org.eclipse.jdt.internal.corext.refactoring.rename.RenameVirtualMethodProcessor; 24 import org.eclipse.jdt.internal.corext.refactoring.util.JavaElementUtil; 25 import org.eclipse.jdt.internal.corext.util.JavaModelUtil; 26 import org.eclipse.jdt.internal.corext.util.Messages; 27 28 import org.eclipse.ltk.core.refactoring.Refactoring; 29 import org.eclipse.ltk.core.refactoring.RefactoringStatus; 30 31 public class RenameMethodUserInterfaceStarter extends RenameUserInterfaceStarter { 32 33 36 public boolean activate(Refactoring refactoring, Shell parent, int saveMode) throws CoreException { 37 RenameVirtualMethodProcessor processor= (RenameVirtualMethodProcessor)refactoring.getAdapter(RenameVirtualMethodProcessor.class); 38 if (processor != null) { 39 RefactoringStatus status= processor.checkInitialConditions(new NullProgressMonitor()); 40 if (!status.hasFatalError()) { 41 IMethod method= processor.getMethod(); 42 if (!method.equals(processor.getOriginalMethod())) { 43 String message= null; 44 if (method.getDeclaringType().isInterface()) { 45 message= Messages.format( 46 RefactoringCoreMessages.MethodChecks_implements, 47 new String []{ 48 JavaElementUtil.createMethodSignature(method), 49 JavaModelUtil.getFullyQualifiedName(method.getDeclaringType())}); 50 } else { 51 message= Messages.format( 52 RefactoringCoreMessages.MethodChecks_overrides, 53 new String []{ 54 JavaElementUtil.createMethodSignature(method), 55 JavaModelUtil.getFullyQualifiedName(method.getDeclaringType())}); 56 } 57 message= Messages.format( 58 ReorgMessages.RenameMethodUserInterfaceStarter_message, 59 message); 60 if (!MessageDialog.openQuestion(parent, 61 ReorgMessages.RenameMethodUserInterfaceStarter_name, 62 message)) { 63 return false; 64 } 65 } 66 } 67 } 68 return super.activate(refactoring, parent, saveMode); 69 } 70 } 71 | Popular Tags |