1 11 package org.eclipse.pde.internal.ui.wizards.xhtml; 12 13 import java.lang.reflect.InvocationTargetException ; 14 15 import org.eclipse.jface.action.IAction; 16 import org.eclipse.jface.dialogs.MessageDialog; 17 import org.eclipse.jface.viewers.ISelection; 18 import org.eclipse.jface.wizard.IWizard; 19 import org.eclipse.jface.wizard.WizardDialog; 20 import org.eclipse.pde.internal.ui.PDEUIMessages; 21 import org.eclipse.swt.custom.BusyIndicator; 22 import org.eclipse.swt.widgets.Shell; 23 import org.eclipse.ui.IWorkbenchWindow; 24 import org.eclipse.ui.IWorkbenchWindowActionDelegate; 25 import org.eclipse.ui.PlatformUI; 26 27 public class GetUnconvertedAction implements IWorkbenchWindowActionDelegate { 28 29 private ISelection fSelection; 30 31 public void run(IAction action) { 32 GetUnconvertedOperation runnable = new GetUnconvertedOperation(fSelection); 33 try { 34 PlatformUI.getWorkbench().getProgressService().busyCursorWhile(runnable); 35 } catch (InvocationTargetException e) { 36 } catch (InterruptedException e) { 37 } finally { 38 if (runnable.needsWork()) { 39 IWizard wizard = new XHTMLConversionWizard(runnable.getChanges()); 40 Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); 41 final WizardDialog dialog = new WizardDialog(shell, wizard); 42 BusyIndicator.showWhile(shell.getDisplay(), new Runnable () { 43 public void run() { 44 dialog.open(); 45 } 46 }); 47 } else 48 MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 49 PDEUIMessages.GetUnconvertedAction_noAction, PDEUIMessages.GetUnconvertedAction_message); 50 } 51 } 52 53 public void selectionChanged(IAction action, ISelection selection) { 54 fSelection = selection; 55 } 56 57 public void dispose() { 58 } 59 60 public void init(IWorkbenchWindow window) { 61 } 62 } 63 | Popular Tags |