1 11 package org.eclipse.jdt.internal.ui.refactoring.actions; 12 13 import org.eclipse.jface.action.IAction; 14 import org.eclipse.jface.viewers.ISelection; 15 import org.eclipse.jface.viewers.IStructuredSelection; 16 import org.eclipse.jface.wizard.WizardDialog; 17 18 import org.eclipse.ui.IWorkbenchWindow; 19 import org.eclipse.ui.IWorkbenchWindowActionDelegate; 20 import org.eclipse.ui.PlatformUI; 21 22 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 23 import org.eclipse.jdt.internal.ui.jarimport.JarImportWizard; 24 25 30 public final class MigrateJarFileAction implements IWorkbenchWindowActionDelegate { 31 32 33 private static final int SIZING_WIZARD_HEIGHT= 610; 34 35 36 private static final int SIZING_WIZARD_WIDTH= 500; 37 38 39 private IWorkbenchWindow fWindow= null; 40 41 44 public void dispose() { 45 } 47 48 51 public void init(final IWorkbenchWindow window) { 52 fWindow= window; 53 } 54 55 58 public void run(final IAction action) { 59 if (fWindow != null) { 60 final JarImportWizard wizard= new JarImportWizard(true); 61 final ISelection selection= fWindow.getSelectionService().getSelection(); 62 if (selection instanceof IStructuredSelection) 63 wizard.init(fWindow.getWorkbench(), (IStructuredSelection) selection); 64 final WizardDialog dialog= new WizardDialog(fWindow.getShell(), wizard); 65 dialog.create(); 66 dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT); 67 PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IJavaHelpContextIds.JARIMPORT_WIZARD_PAGE); 68 dialog.open(); 69 } 70 } 71 72 75 public void selectionChanged(final IAction action, final ISelection selection) { 76 } 78 } 79 | Popular Tags |