]> 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
04a4c14a632210b12b583ef839ca560c2735ca6f
[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.apache.commons.logging.Log;
4 import org.apache.commons.logging.LogFactory;
5 import org.argeo.slc.client.ui.views.ResultListView;
6 import org.eclipse.jface.action.IAction;
7 import org.eclipse.jface.viewers.ISelection;
8 import org.eclipse.ui.IWorkbenchWindow;
9 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
10
11 /**
12 * Our sample action implements workbench action delegate. The action proxy will
13 * be created by the workbench and shown in the UI. When the user tries to use
14 * the action, this delegate will be created and execution will be delegated to
15 * it.
16 *
17 * @see IWorkbenchWindowActionDelegate
18 */
19 public class RefreshAction implements IWorkbenchWindowActionDelegate {
20 private final static Log log = LogFactory.getLog(RefreshAction.class);
21 private IWorkbenchWindow window;
22
23 /**
24 * The constructor.
25 */
26 public RefreshAction() {
27 }
28
29 /**
30 * The action has been activated. The argument of the method represents the
31 * 'real' action sitting in the workbench UI.
32 *
33 * @see IWorkbenchWindowActionDelegate#run
34 */
35 public void run(IAction action) {
36 // ExecutionModulesView view = (ExecutionModulesView) window
37 // .getWorkbench().getActiveWorkbenchWindow().getActivePage()
38 // .findView(ExecutionModulesView.ID);
39 // view.getViewer().refresh();
40 // MessageDialog.openInformation(window.getShell(), "Ui", "Refreshed");
41 log.info("command");
42 ResultListView view = (ResultListView) window.getWorkbench()
43 .getActiveWorkbenchWindow().getActivePage().findView(
44 ResultListView.ID);
45 view.retrieveResults();
46 }
47
48 /**
49 * Selection in the workbench has been changed. We can change the state of
50 * the 'real' action here if we want, but this can only happen after the
51 * delegate has been created.
52 *
53 * @see IWorkbenchWindowActionDelegate#selectionChanged
54 */
55 public void selectionChanged(IAction action, ISelection selection) {
56 }
57
58 /**
59 * We can use this method to dispose of any system resources we previously
60 * allocated.
61 *
62 * @see IWorkbenchWindowActionDelegate#dispose
63 */
64 public void dispose() {
65 }
66
67 /**
68 * We will cache window object in order to be able to provide parent shell
69 * for the message dialog.
70 *
71 * @see IWorkbenchWindowActionDelegate#init
72 */
73 public void init(IWorkbenchWindow window) {
74 this.window = window;
75 }
76 }