From 36a1c53c326dc286d14111a59dc1ac76913aeb3c Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Tue, 21 Sep 2010 09:32:16 +0000 Subject: [PATCH] -> Rename SlcExecution to Process -> Change all actions to commands -> Implements Spring IoC for existing commands -> comment ProcessList auto-refresh to prevent Exception to be thrown until hibernate session pb is resolved. git-svn-id: https://svn.argeo.org/slc/trunk@3782 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org.argeo.slc.client.rcp/plugin.xml | 26 ++++++- .../rcp/ApplicationActionBarAdvisor.java | 12 --- .../org/argeo/slc/client/rcp/Perspective.java | 4 +- .../slc/client/rcp/commands/ExitHandler.java | 15 ++++ .../META-INF/MANIFEST.MF | 1 - .../META-INF/spring/commands.xml | 12 +++ .../META-INF/spring/views.xml | 4 +- .../org.argeo.slc.client.ui/plugin.xml | 74 +++++++++++------- .../slc/client/ui/actions/RefreshAction.java | 76 ------------------- .../client/ui/commands/RefreshHandler.java | 9 +-- .../services/TestManagerServiceAdapter.java | 6 +- ...tionListView.java => ProcessListView.java} | 6 +- 12 files changed, 112 insertions(+), 133 deletions(-) create mode 100644 eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/commands/ExitHandler.java create mode 100644 eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/commands.xml delete mode 100644 eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/actions/RefreshAction.java rename eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/{SlcExecutionListView.java => ProcessListView.java} (95%) diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml b/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml index 9caec033e..2df055019 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml +++ b/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml @@ -36,6 +36,30 @@ + + + + + + + + + + + + diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ApplicationActionBarAdvisor.java b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ApplicationActionBarAdvisor.java index 340f17542..70f6217cd 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ApplicationActionBarAdvisor.java +++ b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ApplicationActionBarAdvisor.java @@ -1,11 +1,7 @@ package org.argeo.slc.client.rcp; import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; import org.eclipse.ui.application.ActionBarAdvisor; import org.eclipse.ui.application.IActionBarConfigurer; @@ -20,7 +16,6 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor { // them // in the fill methods. This ensures that the actions aren't recreated // when fillActionBars is called with FILL_PROXY. - private IWorkbenchAction exitAction; public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { super(configurer); @@ -33,16 +28,9 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor { // file. // Registering also provides automatic disposal of the actions when // the window is closed. - - exitAction = ActionFactory.QUIT.create(window); - register(exitAction); } protected void fillMenuBar(IMenuManager menuBar) { - MenuManager fileMenu = new MenuManager("&File", - IWorkbenchActionConstants.M_FILE); - menuBar.add(fileMenu); - fileMenu.add(exitAction); } } diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/Perspective.java b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/Perspective.java index f5e915771..746dfe553 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/Perspective.java +++ b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/Perspective.java @@ -2,7 +2,7 @@ package org.argeo.slc.client.rcp; import org.argeo.slc.client.ui.views.ExecutionModulesView; import org.argeo.slc.client.ui.views.ResultListView; -import org.argeo.slc.client.ui.views.SlcExecutionListView; +import org.argeo.slc.client.ui.views.ProcessListView; import org.eclipse.ui.IFolderLayout; import org.eclipse.ui.IPageLayout; import org.eclipse.ui.IPerspectiveFactory; @@ -22,7 +22,7 @@ public class Perspective implements IPerspectiveFactory { topRight.addView(ResultListView.ID); IFolderLayout bottomRight = layout.createFolder("bottomRight", IPageLayout.BOTTOM, 0.5f, "topRight"); - bottomRight.addView(SlcExecutionListView.ID); + bottomRight.addView(ProcessListView.ID); // layout.addStandaloneView(SlcExecutionListView.ID, false, // IPageLayout.BOTTOM, 0.5f, editorArea); } diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/commands/ExitHandler.java b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/commands/ExitHandler.java new file mode 100644 index 000000000..f5eaff52f --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/commands/ExitHandler.java @@ -0,0 +1,15 @@ +package org.argeo.slc.client.rcp.commands; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +public class ExitHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + HandlerUtil.getActiveWorkbenchWindow(event).close(); + return null; + } + +} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF index 2e1862d64..c3bfd54c1 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF +++ b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF @@ -12,7 +12,6 @@ Require-Bundle: org.eclipse.ui;resolution:=optional, Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.argeo.slc.client.ui, - org.argeo.slc.client.ui.actions, org.argeo.slc.client.ui.services, org.argeo.slc.client.ui.views Import-Package: org.apache.commons.logging;version="1.1.1", diff --git a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/commands.xml b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/commands.xml new file mode 100644 index 000000000..34a365353 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/commands.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/views.xml b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/views.xml index f718ccb52..4c349d6ec 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/views.xml +++ b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/views.xml @@ -14,8 +14,8 @@ scope="prototype"> - - diff --git a/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml b/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml index 25b779488..aefea5791 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml +++ b/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml @@ -2,6 +2,7 @@ + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/actions/RefreshAction.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/actions/RefreshAction.java deleted file mode 100644 index 04a4c14a6..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/actions/RefreshAction.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.argeo.slc.client.ui.actions; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.client.ui.views.ResultListView; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; - -/** - * Our sample action implements workbench action delegate. The action proxy will - * be created by the workbench and shown in the UI. When the user tries to use - * the action, this delegate will be created and execution will be delegated to - * it. - * - * @see IWorkbenchWindowActionDelegate - */ -public class RefreshAction implements IWorkbenchWindowActionDelegate { - private final static Log log = LogFactory.getLog(RefreshAction.class); - private IWorkbenchWindow window; - - /** - * The constructor. - */ - public RefreshAction() { - } - - /** - * The action has been activated. The argument of the method represents the - * 'real' action sitting in the workbench UI. - * - * @see IWorkbenchWindowActionDelegate#run - */ - public void run(IAction action) { - // ExecutionModulesView view = (ExecutionModulesView) window - // .getWorkbench().getActiveWorkbenchWindow().getActivePage() - // .findView(ExecutionModulesView.ID); - // view.getViewer().refresh(); - // MessageDialog.openInformation(window.getShell(), "Ui", "Refreshed"); - log.info("command"); - ResultListView view = (ResultListView) window.getWorkbench() - .getActiveWorkbenchWindow().getActivePage().findView( - ResultListView.ID); - view.retrieveResults(); - } - - /** - * Selection in the workbench has been changed. We can change the state of - * the 'real' action here if we want, but this can only happen after the - * delegate has been created. - * - * @see IWorkbenchWindowActionDelegate#selectionChanged - */ - public void selectionChanged(IAction action, ISelection selection) { - } - - /** - * We can use this method to dispose of any system resources we previously - * allocated. - * - * @see IWorkbenchWindowActionDelegate#dispose - */ - public void dispose() { - } - - /** - * We will cache window object in order to be able to provide parent shell - * for the message dialog. - * - * @see IWorkbenchWindowActionDelegate#init - */ - public void init(IWorkbenchWindow window) { - this.window = window; - } -} \ No newline at end of file diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RefreshHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RefreshHandler.java index 1ff034141..713f3a0bf 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RefreshHandler.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RefreshHandler.java @@ -1,7 +1,6 @@ package org.argeo.slc.client.ui.commands; import org.argeo.slc.client.ui.views.ResultListView; -import org.argeo.slc.client.ui.views.SlcExecutionListView; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; @@ -14,10 +13,10 @@ public class RefreshHandler extends AbstractHandler { .getActiveWorkbenchWindow(event).getActivePage().findView( ResultListView.ID); view.retrieveResults(); - SlcExecutionListView selView = (SlcExecutionListView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage().findView( - SlcExecutionListView.ID); - selView.retrieveResults(); + // ProcessListView pView = (ProcessListView) HandlerUtil + // .getActiveWorkbenchWindow(event).getActivePage().findView( + // ProcessListView.ID); + // pView.retrieveResults(); return null; } diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/services/TestManagerServiceAdapter.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/services/TestManagerServiceAdapter.java index 1b2684f70..15de03a1d 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/services/TestManagerServiceAdapter.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/services/TestManagerServiceAdapter.java @@ -1,7 +1,5 @@ package org.argeo.slc.client.ui.services; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.argeo.slc.SlcException; import org.argeo.slc.client.ui.ClientUiPlugin; import org.argeo.slc.core.attachment.Attachment; @@ -18,8 +16,8 @@ import org.eclipse.ui.handlers.IHandlerService; /** In memory access to a test manager service */ public class TestManagerServiceAdapter implements TreeTestResultListener { - private static final Log log = LogFactory - .getLog(TestManagerServiceAdapter.class); + // private static final Log log = LogFactory + // .getLog(TestManagerServiceAdapter.class); private Boolean onlyOnClose = false; diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/SlcExecutionListView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java similarity index 95% rename from eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/SlcExecutionListView.java rename to eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java index 959c69964..36a4b9764 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/SlcExecutionListView.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java @@ -20,11 +20,11 @@ import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.ui.part.ViewPart; -public class SlcExecutionListView extends ViewPart { +public class ProcessListView extends ViewPart { private final static Log log = LogFactory - .getLog(SlcExecutionListView.class); + .getLog(ProcessListView.class); - public static final String ID = "org.argeo.slc.client.ui.SlcExecutionListView"; + public static final String ID = "org.argeo.slc.client.ui.ProcessListView"; private TableViewer viewer; -- 2.39.2