]> git.argeo.org Git - gpl/argeo-slc.git/blob - eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/actions/RefreshAction.java
Introduce SLC RCP
[gpl/argeo-slc.git] / eclipse / plugins / org.argeo.slc.client.ui / src / org / argeo / slc / client / ui / actions / RefreshAction.java
1 package org.argeo.slc.client.ui.actions;
2
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;
9
10 /**
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
14 * it.
15 *
16 * @see IWorkbenchWindowActionDelegate
17 */
18 public class RefreshAction implements IWorkbenchWindowActionDelegate {
19 private IWorkbenchWindow window;
20
21 /**
22 * The constructor.
23 */
24 public RefreshAction() {
25 }
26
27 /**
28 * The action has been activated. The argument of the method represents the
29 * 'real' action sitting in the workbench UI.
30 *
31 * @see IWorkbenchWindowActionDelegate#run
32 */
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");
39 }
40
41 /**
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.
45 *
46 * @see IWorkbenchWindowActionDelegate#selectionChanged
47 */
48 public void selectionChanged(IAction action, ISelection selection) {
49 }
50
51 /**
52 * We can use this method to dispose of any system resources we previously
53 * allocated.
54 *
55 * @see IWorkbenchWindowActionDelegate#dispose
56 */
57 public void dispose() {
58 }
59
60 /**
61 * We will cache window object in order to be able to provide parent shell
62 * for the message dialog.
63 *
64 * @see IWorkbenchWindowActionDelegate#init
65 */
66 public void init(IWorkbenchWindow window) {
67 this.window = window;
68 }
69 }