01: package com.xoetrope.editor.eclipse;
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.jface.dialogs.MessageDialog;
08:
09: /**
10: * Our sample action implements workbench action delegate. The action proxy will
11: * be created by the workbench and shown in the UI. When the user tries to use
12: * the action, this delegate will be created and execution will be delegated to
13: * it.
14: *
15: * @see IWorkbenchWindowActionDelegate
16: */
17: public class XuiProAction implements IWorkbenchWindowActionDelegate {
18: private IWorkbenchWindow window;
19:
20: /**
21: * The constructor.
22: */
23: public XuiProAction() {
24: }
25:
26: /**
27: * The action has been activated. The argument of the method represents the
28: * 'real' action sitting in the workbench UI.
29: *
30: * @see IWorkbenchWindowActionDelegate#run
31: */
32: public void run(IAction action) {
33: MessageDialog.openInformation(window.getShell(),
34: "XuiProEditor", "XuiPro");
35: }
36:
37: /**
38: * Selection in the workbench has been changed. We can change the state of the
39: * 'real' action here if we want, but this can only happen after the delegate
40: * has been created.
41: *
42: * @see IWorkbenchWindowActionDelegate#selectionChanged
43: */
44: public void selectionChanged(IAction action, ISelection selection) {
45: }
46:
47: /**
48: * We can use this method to dispose of any system resources we previously
49: * allocated.
50: *
51: * @see IWorkbenchWindowActionDelegate#dispose
52: */
53: public void dispose() {
54: }
55:
56: /**
57: * We will cache window object in order to be able to provide parent shell for
58: * the message dialog.
59: *
60: * @see IWorkbenchWindowActionDelegate#init
61: */
62: public void init(IWorkbenchWindow window) {
63: this.window = window;
64: }
65: }
|