KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > ide > update > InstallWizardAction


1 /*******************************************************************************
2  * Copyright (c) 2004, 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.ui.internal.ide.update;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.jface.action.IAction;
15 import org.eclipse.jface.viewers.ISelection;
16 import org.eclipse.swt.custom.BusyIndicator;
17 import org.eclipse.ui.IWorkbenchWindow;
18 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
19 import org.eclipse.ui.PlatformUI;
20 import org.eclipse.update.ui.UpdateManagerUI;
21
22 /**
23  * Action to invoke the Update install wizard.
24  *
25  * @since 3.0
26  */

27 public class InstallWizardAction extends Action implements
28         IWorkbenchWindowActionDelegate {
29
30     private IWorkbenchWindow window;
31
32     public InstallWizardAction() {
33         // do nothing
34
}
35
36     public void run() {
37         openInstaller(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
38     }
39
40     public void run(IAction action) {
41         openInstaller(window);
42     }
43
44     private void openInstaller(final IWorkbenchWindow window) {
45         BusyIndicator.showWhile(window.getShell().getDisplay(), new Runnable JavaDoc() {
46             public void run() {
47                 UpdateManagerUI.openInstaller(window.getShell());
48             }
49         });
50     }
51
52     public void selectionChanged(IAction action, ISelection selection) {
53         // do nothing
54
}
55
56     public void dispose() {
57         // do nothing
58
}
59
60     public void init(IWorkbenchWindow window) {
61         this.window = window;
62     }
63 }
64
Popular Tags