1 package org
.argeo
.slc
.client
.ui
.actions
;
3 import org
.argeo
.slc
.client
.ui
.views
.ExecutionModulesView
;
4 import org
.eclipse
.jface
.action
.IAction
;
5 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
6 import org
.eclipse
.jface
.viewers
.ISelection
;
7 import org
.eclipse
.ui
.IWorkbenchWindow
;
8 import org
.eclipse
.ui
.IWorkbenchWindowActionDelegate
;
11 * Our sample action implements workbench action delegate. The action proxy will
12 * be created by the workbench and shown in the UI. When the user tries to use
13 * the action, this delegate will be created and execution will be delegated to
16 * @see IWorkbenchWindowActionDelegate
18 public class RefreshAction
implements IWorkbenchWindowActionDelegate
{
19 private IWorkbenchWindow window
;
24 public RefreshAction() {
28 * The action has been activated. The argument of the method represents the
29 * 'real' action sitting in the workbench UI.
31 * @see IWorkbenchWindowActionDelegate#run
33 public void run(IAction action
) {
34 ExecutionModulesView view
= (ExecutionModulesView
) window
35 .getWorkbench().getActiveWorkbenchWindow().getActivePage()
36 .findView(ExecutionModulesView
.ID
);
37 view
.getViewer().refresh();
38 MessageDialog
.openInformation(window
.getShell(), "Ui", "Refreshed");
42 * Selection in the workbench has been changed. We can change the state of
43 * the 'real' action here if we want, but this can only happen after the
44 * delegate has been created.
46 * @see IWorkbenchWindowActionDelegate#selectionChanged
48 public void selectionChanged(IAction action
, ISelection selection
) {
52 * We can use this method to dispose of any system resources we previously
55 * @see IWorkbenchWindowActionDelegate#dispose
57 public void dispose() {
61 * We will cache window object in order to be able to provide parent shell
62 * for the message dialog.
64 * @see IWorkbenchWindowActionDelegate#init
66 public void init(IWorkbenchWindow window
) {