1 11 package org.eclipse.jdt.internal.ui.refactoring.reorg; 12 13 14 import org.eclipse.core.runtime.CoreException; 15 16 import org.eclipse.swt.widgets.Shell; 17 18 import org.eclipse.ltk.core.refactoring.Refactoring; 19 import org.eclipse.ltk.core.refactoring.participants.RenameProcessor; 20 21 import org.eclipse.jdt.internal.corext.refactoring.tagging.INameUpdating; 22 23 import org.eclipse.jdt.internal.ui.refactoring.UserInterfaceStarter; 24 25 public class RenameUserInterfaceStarter extends UserInterfaceStarter { 26 27 public boolean activate(Refactoring refactoring, Shell parent, int saveMode) throws CoreException { 28 RenameProcessor processor= (RenameProcessor)refactoring.getAdapter(RenameProcessor.class); 29 Object [] elements= processor.getElements(); 30 RenameSelectionState state= elements.length == 1 ? new RenameSelectionState(elements[0]) : null; 31 boolean executed= super.activate(refactoring, parent, saveMode); 32 INameUpdating nameUpdating= (INameUpdating)refactoring.getAdapter(INameUpdating.class); 33 if (executed && nameUpdating != null && state != null) { 34 Object newElement= nameUpdating.getNewElement(); 35 if (newElement != null) { 36 state.restore(newElement); 37 } 38 } 39 return executed; 40 } 41 } 42 | Popular Tags |