01: /*******************************************************************************
02: * Copyright (c) 2004, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.ide.update;
11:
12: import org.eclipse.jface.action.Action;
13: import org.eclipse.jface.action.IAction;
14: import org.eclipse.jface.viewers.ISelection;
15: import org.eclipse.swt.custom.BusyIndicator;
16: import org.eclipse.ui.IWorkbenchWindow;
17: import org.eclipse.ui.IWorkbenchWindowActionDelegate;
18: import org.eclipse.ui.PlatformUI;
19: import org.eclipse.update.ui.UpdateManagerUI;
20:
21: /**
22: * Action to invoke the Update install wizard.
23: *
24: * @since 3.0
25: */
26: public class InstallWizardAction extends Action implements
27: IWorkbenchWindowActionDelegate {
28:
29: private IWorkbenchWindow window;
30:
31: public InstallWizardAction() {
32: // do nothing
33: }
34:
35: public void run() {
36: openInstaller(PlatformUI.getWorkbench()
37: .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(),
46: new Runnable() {
47: public void run() {
48: UpdateManagerUI
49: .openInstaller(window.getShell());
50: }
51: });
52: }
53:
54: public void selectionChanged(IAction action, ISelection selection) {
55: // do nothing
56: }
57:
58: public void dispose() {
59: // do nothing
60: }
61:
62: public void init(IWorkbenchWindow window) {
63: this.window = window;
64: }
65: }
|