01 package org.jpn.xucker.rcp.optipngwrapper.actions;
02
03 import org.eclipse.jface.action.IAction;
04 import org.eclipse.jface.viewers.ISelection;
05 import org.eclipse.ui.IWorkbenchWindow;
06 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
07 import org.eclipse.update.ui.UpdateManagerUI;
08
09 /**
10 * Our sample action implements workbench action delegate.
11 * The action proxy will be created by the workbench and
12 * shown in the UI. When the user tries to use the action,
13 * this delegate will be created and execution will be
14 * delegated to it.
15 * @see IWorkbenchWindowActionDelegate
16 */
17 public class UpdateAction implements IWorkbenchWindowActionDelegate {
18 private IWorkbenchWindow window;
19 /**
20 * The constructor.
21 */
22 public UpdateAction() {
23 }
24
25 /**
26 * The action has been activated. The argument of the
27 * method represents the 'real' action sitting
28 * in the workbench UI.
29 * @see IWorkbenchWindowActionDelegate#run
30 */
31 public void run(IAction action) {
32 UpdateManagerUI.openInstaller(window.getShell());
33 }
34
35 /**
36 * Selection in the workbench has been changed. We
37 * can change the state of the 'real' action here
38 * if we want, but this can only happen after
39 * the delegate has been created.
40 * @see IWorkbenchWindowActionDelegate#selectionChanged
41 */
42 public void selectionChanged(IAction action, ISelection selection) {
43 }
44
45 /**
46 * We can use this method to dispose of any system
47 * resources we previously allocated.
48 * @see IWorkbenchWindowActionDelegate#dispose
49 */
50 public void dispose() {
51 }
52
53 /**
54 * We will cache window object in order to
55 * be able to provide parent shell for the message dialog.
56 * @see IWorkbenchWindowActionDelegate#init
57 */
58 public void init(IWorkbenchWindow window) {
59 this.window = window;
60 }
61 }
|