1 11 package org.eclipse.jdt.internal.ui.refactoring; 12 13 import java.lang.reflect.InvocationTargetException ; 14 15 import org.eclipse.core.runtime.IProgressMonitor; 16 17 import org.eclipse.swt.widgets.Composite; 18 19 import org.eclipse.jface.operation.IRunnableWithProgress; 20 21 import org.eclipse.ui.PlatformUI; 22 23 import org.eclipse.jdt.internal.corext.refactoring.structure.ExtractSupertypeProcessor; 24 import org.eclipse.jdt.internal.corext.refactoring.structure.ExtractSupertypeRefactoring; 25 26 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 27 import org.eclipse.jdt.internal.ui.JavaPlugin; 28 29 34 public class ExtractSupertypeMethodPage extends PullUpMethodPage { 35 36 39 public ExtractSupertypeRefactoring getExtractSuperTypeRefactoring() { 40 return (ExtractSupertypeRefactoring) getRefactoring(); 41 } 42 43 48 protected ExtractSupertypeProcessor getProcessor() { 49 return getExtractSuperTypeRefactoring().getExtractSupertypeProcessor(); 50 } 51 52 55 public void createControl(Composite parent) { 56 super.createControl(parent); 57 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.EXTRACT_SUPERTYPE_WIZARD_PAGE); 58 } 59 60 63 public void setVisible(final boolean visible) { 64 if (visible) { 65 final ExtractSupertypeProcessor processor= getProcessor(); 66 processor.resetChanges(); 67 try { 68 getWizard().getContainer().run(false, false, new IRunnableWithProgress() { 69 70 public void run(final IProgressMonitor monitor) throws InvocationTargetException , InterruptedException { 71 processor.createWorkingCopyLayer(monitor); 72 } 73 }); 74 } catch (InvocationTargetException exception) { 75 JavaPlugin.log(exception); 76 } catch (InterruptedException exception) { 77 } 79 } 80 super.setVisible(visible); 81 } 82 } 83 | Popular Tags |