KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > wizards > xhtml > GetUnconvertedAction


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.wizards.xhtml;
12
13 import java.lang.reflect.InvocationTargetException JavaDoc;
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 JavaDoc e) {
36         } catch (InterruptedException JavaDoc 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 JavaDoc() {
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