From: Mathieu Baudier Date: Mon, 27 Jun 2011 11:59:15 +0000 (+0000) Subject: Remove new UI prototype X-Git-Tag: argeo-slc-2.1.7~928 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=da80480f09f8efc5e0278ed992e17e586b0a0e62;hp=918580bf6039346b6bd6891d475c77487a702d4b;p=gpl%2Fargeo-slc.git Remove new UI prototype git-svn-id: https://svn.argeo.org/slc/trunk@4626 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/eclipse/modules/org.argeo.slc.client.agent/.project b/eclipse/modules/org.argeo.slc.client.agent/.project deleted file mode 100644 index ea10bad43..000000000 --- a/eclipse/modules/org.argeo.slc.client.agent/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.client.agent - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/eclipse/modules/org.argeo.slc.client.agent/.settings/org.eclipse.pde.core.prefs b/eclipse/modules/org.argeo.slc.client.agent/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index 957026bad..000000000 --- a/eclipse/modules/org.argeo.slc.client.agent/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Mon Sep 20 12:50:19 CEST 2010 -eclipse.preferences.version=1 -pluginProject.extensions=false -resolve.requirebundle=false diff --git a/eclipse/modules/org.argeo.slc.client.agent/META-INF/MANIFEST.MF b/eclipse/modules/org.argeo.slc.client.agent/META-INF/MANIFEST.MF deleted file mode 100644 index f34b228d3..000000000 --- a/eclipse/modules/org.argeo.slc.client.agent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,8 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Agent -Bundle-SymbolicName: org.argeo.slc.client.agent -Bundle-Version: 0.13.1.SNAPSHOT -Import-Package: org.argeo.slc.core.runtime, - org.argeo.slc.execution, - org.argeo.slc.runtime diff --git a/eclipse/modules/org.argeo.slc.client.agent/META-INF/spring/client-osgi.xml b/eclipse/modules/org.argeo.slc.client.agent/META-INF/spring/client-osgi.xml deleted file mode 100644 index 5d3eced59..000000000 --- a/eclipse/modules/org.argeo.slc.client.agent/META-INF/spring/client-osgi.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/eclipse/modules/org.argeo.slc.client.agent/META-INF/spring/client.xml b/eclipse/modules/org.argeo.slc.client.agent/META-INF/spring/client.xml deleted file mode 100644 index 5d7b3c047..000000000 --- a/eclipse/modules/org.argeo.slc.client.agent/META-INF/spring/client.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/eclipse/modules/org.argeo.slc.client.agent/build.properties b/eclipse/modules/org.argeo.slc.client.agent/build.properties deleted file mode 100644 index 5f22cdd44..000000000 --- a/eclipse/modules/org.argeo.slc.client.agent/build.properties +++ /dev/null @@ -1 +0,0 @@ -bin.includes = META-INF/ diff --git a/eclipse/modules/org.argeo.slc.client.hibernate/.project b/eclipse/modules/org.argeo.slc.client.hibernate/.project deleted file mode 100644 index 635608798..000000000 --- a/eclipse/modules/org.argeo.slc.client.hibernate/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.argeo.slc.client.hibernate - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/eclipse/modules/org.argeo.slc.client.hibernate/.settings/org.eclipse.pde.core.prefs b/eclipse/modules/org.argeo.slc.client.hibernate/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index b0517fad6..000000000 --- a/eclipse/modules/org.argeo.slc.client.hibernate/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Wed Sep 22 12:14:13 CEST 2010 -eclipse.preferences.version=1 -pluginProject.extensions=false -resolve.requirebundle=false diff --git a/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/MANIFEST.MF b/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/MANIFEST.MF deleted file mode 100644 index be1074d3d..000000000 --- a/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Hibernate Interface for RCP Client -Bundle-SymbolicName: org.argeo.slc.client.hibernate -Bundle-Version: 0.13.1.SNAPSHOT -Require-Bundle: org.eclipse.ui;resolution:=optional, - org.eclipse.rap.ui;resolution:=optional -Import-Package: org.aopalliance.aop;version="1.0.0", - org.argeo.slc.client.aspects, - org.argeo.slc.client.contentprovider, - org.argeo.slc.client.ui, - org.argeo.slc.core.structure.tree, - org.argeo.slc.core.test.tree, - org.argeo.slc.dao.process, - org.argeo.slc.dao.test.tree, - org.hibernate, - org.hibernate.classic, - org.springframework.aop;version="2.5.6.SEC01", - org.springframework.aop.aspectj.annotation;version="2.5.6.SEC01", - org.springframework.aop.framework;version="2.5.6.SEC01", - org.springframework.transaction;version="2.5.6.SEC01" diff --git a/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/spring/core.xml b/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/spring/core.xml deleted file mode 100644 index 027c50d41..000000000 --- a/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/spring/core.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/spring/osgi.xml b/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/spring/osgi.xml deleted file mode 100644 index 55bdfa70a..000000000 --- a/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/spring/osgi.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - This bundle is the bridge between the slc RCP - client - and hibernate implementation of the model. - - Corresponding java classes - are implemented - in the org.client.slc.client.core bundle. - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/spring/transaction.xml b/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/spring/transaction.xml deleted file mode 100644 index b60b4f10f..000000000 --- a/eclipse/modules/org.argeo.slc.client.hibernate/META-INF/spring/transaction.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/eclipse/modules/org.argeo.slc.client.hibernate/build.properties b/eclipse/modules/org.argeo.slc.client.hibernate/build.properties deleted file mode 100644 index 5f22cdd44..000000000 --- a/eclipse/modules/org.argeo.slc.client.hibernate/build.properties +++ /dev/null @@ -1 +0,0 @@ -bin.includes = META-INF/ diff --git a/eclipse/modules/pom.xml b/eclipse/modules/pom.xml deleted file mode 100644 index 9fd4f84bf..000000000 --- a/eclipse/modules/pom.xml +++ /dev/null @@ -1,25 +0,0 @@ - - 4.0.0 - - org.argeo.slc - eclipse - 0.13.1-SNAPSHOT - - org.argeo.slc.eclipse - modules - bundles - SLC Eclipse Modules - - - - org.argeo.maven.plugins - maven-argeo-osgi-plugin - true - - org.argeo.slc.eclipse.modules.bundles - - - - - \ No newline at end of file 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 4c36c0118..65e447d31 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 @@ -11,7 +11,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.listeners, org.argeo.slc.client.ui.views Import-Package: javax.jcr;version="2.0.0", javax.jcr.nodetype;version="2.0.0", diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ClearBatchHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ClearBatchHandler.java deleted file mode 100644 index eb6809c1f..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ClearBatchHandler.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.argeo.slc.client.ui.commands; - -import org.argeo.slc.client.ui.views.ProcessBuilderView; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * - * @author bsinou - * - * Remove all processes from the batch built in the ProcessBuilderView - * - * NOTE : only one batch is supported with this command, if more than - * one batch is planned, this class must be updated with parameter. - */ -public class ClearBatchHandler extends AbstractHandler { - // private final static Log log = - // LogFactory.getLog(ClearBatchHandler.class); - - public Object execute(ExecutionEvent event) throws ExecutionException { - ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage() - .findView(ProcessBuilderView.ID); - pbView.clearBatch(); - return null; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ExecutionModulesViewRefreshHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ExecutionModulesViewRefreshHandler.java deleted file mode 100644 index 849be5e8e..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ExecutionModulesViewRefreshHandler.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.argeo.slc.client.ui.commands; - -import org.argeo.slc.client.ui.views.ExecutionModulesView; -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 ExecutionModulesViewRefreshHandler extends AbstractHandler { - - public Object execute(ExecutionEvent event) throws ExecutionException { - ExecutionModulesView eView = (ExecutionModulesView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage() - .findView(ExecutionModulesView.ID); - eView.refreshView(); - return null; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/LaunchBatchHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/LaunchBatchHandler.java deleted file mode 100644 index 1263164c8..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/LaunchBatchHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.argeo.slc.client.ui.commands; - -import org.argeo.slc.client.ui.views.ProcessBuilderView; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Launch the batch built in the ProcessBuilderView - * - * NOTE : only one batch is supported with this command, if more than one batch - * is planned, this class must be updated with parameter. - */ -public class LaunchBatchHandler extends AbstractHandler { - // private final static Log log = - // LogFactory.getLog(LaunchBatchHandler.class); - - public Object execute(ExecutionEvent event) throws ExecutionException { - ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage() - .findView(ProcessBuilderView.ID); - pbView.launchBatch(); - return null; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ManageBundlesHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ManageBundlesHandler.java deleted file mode 100644 index 8d916dfaa..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ManageBundlesHandler.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.argeo.slc.client.ui.commands; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.client.ui.ClientUiPlugin; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.swt.widgets.Shell; - -/** - * Command handler to manage existing bundles; add or remove specific ones. - * - * @author bsinou - * - */ - -public class ManageBundlesHandler extends AbstractHandler { - private static final Log log = LogFactory - .getLog(ManageBundlesHandler.class); - - // private static final String DEFAULT_BUNDLE_DIR = "tmp"; - - public Object execute(ExecutionEvent event) throws ExecutionException { - - Shell shell = ClientUiPlugin.getDefault().getWorkbench() - .getActiveWorkbenchWindow().getShell(); - // LaunchConfigurationsDialog lcd; - // see http://kickjava.com/src/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java.htm - // to have more ideas about what to do. - - TitleAreaDialog tad = new TitleAreaDialog(shell); - tad.setTitle("Manage Bundles"); - tad.open(); - - - // RCP Specific, commented for now. - // DirectoryDialog dialog2 = new DirectoryDialog(shell); - // String path = dialog2.open(); - // - // if (path == null) - // // action canceled by user - // return null; - // log.debug("Path chosen by user : " + path); - - // the following does not work : it doesn't display anything. - // Label label = new Label(shell, SWT.WRAP); - // label.setText("This is a long text string that will wrap when the dialog is resized."); - // List list = new List(shell, SWT.BORDER | SWT.H_SCROLL | - // SWT.V_SCROLL); - // list.setItems(new String[] { "Item 1", "Item 2" }); - // Button button1 = new Button(shell, SWT.PUSH); - // button1.setText("OK"); - // Button button2 = new Button(shell, SWT.PUSH); - // button2.setText("Cancel"); - // - // final int insetX = 4, insetY = 4; - // FormLayout formLayout = new FormLayout(); - // formLayout.marginWidth = insetX; - // formLayout.marginHeight = insetY; - // shell.setLayout(formLayout); - // - // Point size = label.computeSize(SWT.DEFAULT, SWT.DEFAULT); - // final FormData labelData = new FormData(size.x, SWT.DEFAULT); - // labelData.left = new FormAttachment(0, 0); - // labelData.right = new FormAttachment(100, 0); - // label.setLayoutData(labelData); - // - // FormData button2Data = new FormData(); - // button2Data.right = new FormAttachment(100, -insetX); - // button2Data.bottom = new FormAttachment(100, 0); - // button2.setLayoutData(button2Data); - // - // FormData button1Data = new FormData(); - // button1Data.right = new FormAttachment(button2, -insetX); - // button1Data.bottom = new FormAttachment(100, 0); - // button1.setLayoutData(button1Data); - // - // FormData listData = new FormData(); - // listData.left = new FormAttachment(0, 0); - // listData.right = new FormAttachment(100, 0); - // listData.top = new FormAttachment(label, insetY); - // listData.bottom = new FormAttachment(button2, -insetY); - // list.setLayoutData(listData); - // - // shell.pack(); - // shell.open(); - // - // Display display = shell.getDisplay(); - // while (!shell.isDisposed()) { - // if (!display.readAndDispatch()) - // display.sleep(); - // } - // display.dispose(); - - return null; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java deleted file mode 100644 index cdc28812b..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.argeo.slc.client.ui.commands; - -import org.argeo.slc.client.ui.views.ProcessDetailView; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Command handler to set visible or create a ProcessDetailView. UUID of the - * process is passed via command parameters. - * - * @author bsinou - * - */ - -public class ProcessDetailsDisplayHandler extends AbstractHandler { - // private static final Log log = LogFactory - // .getLog(ProcessDetailsDisplayHandler.class); - - public Object execute(ExecutionEvent event) throws ExecutionException { - - // We pass the UUID of the process we want to display via command - // parameters. - String uuid = event - .getParameter("org.argeo.slc.client.commands.processUuid"); - - // mode = 1 : VIEW_ACTIVATE, Show view mode that indicates the view - // should be made visible and activated. Use of this mode has the same - // effect as calling showView. - try { - ProcessDetailView pView = (ProcessDetailView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage() - .showView(ProcessDetailView.ID, "UUID-" + uuid, 1); - pView.setUuid(uuid); - pView.retrieveResults(); - } catch (Exception e) { - e.printStackTrace(); - } - - return null; - } -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java deleted file mode 100644 index 47f9d0041..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.argeo.slc.client.ui.commands; - -import org.argeo.slc.client.ui.views.ProcessListView; -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 ProcessListViewRefreshHandler extends AbstractHandler { - - public Object execute(ExecutionEvent event) throws ExecutionException { - 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/main/java/org/argeo/slc/client/ui/commands/RemoveSelectedProcessFromBatchHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/RemoveSelectedProcessFromBatchHandler.java deleted file mode 100644 index 12e8de0ff..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/RemoveSelectedProcessFromBatchHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.argeo.slc.client.ui.commands; - -import org.argeo.slc.client.ui.views.ProcessBuilderView; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * - * @author bsinou - * - * Launch the batch built in the ProcessBuilderView - * - * NOTE : only one batch is supported with this command, if more than - * one batch is planned, this class must be updated with parameter. - */ - -public class RemoveSelectedProcessFromBatchHandler extends AbstractHandler { - // private final static Log log = - // LogFactory.getLog(RemoveSelectedProcessFromBatchHandler.class); - - public Object execute(ExecutionEvent event) throws ExecutionException { - ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage() - .findView(ProcessBuilderView.ID); - pbView.removeSelected(); - return null; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/RemoveSelectedResultFromResultList.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/RemoveSelectedResultFromResultList.java deleted file mode 100644 index 2eb0854f9..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/RemoveSelectedResultFromResultList.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.argeo.slc.client.ui.commands; - -import org.argeo.slc.client.ui.views.ResultListView; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * - * @author bsinou - * - * Launch the batch built in the ProcessBuilderView - * - * NOTE : only one batch is supported with this command, if more than - * one batch is planned, this class must be updated with parameter. - */ - -public class RemoveSelectedResultFromResultList extends AbstractHandler { - public final static String ID = "org.argeo.slc.client.ui.removeSelectedResultFromResultList"; - - // private final static Log log = - // LogFactory.getLog(RemoveSelectedProcessFromBatchHandler.class); - - public Object execute(ExecutionEvent event) throws ExecutionException { - ResultListView rlView = (ResultListView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage() - .findView(ResultListView.ID); - rlView.removeSelected(); - return null; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java deleted file mode 100644 index 52bce6bc3..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.argeo.slc.client.ui.commands; - -import java.util.Iterator; -import java.util.List; - -import org.argeo.slc.client.ui.views.ResultDetailView; -import org.argeo.slc.client.ui.views.ResultListView; -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Command handler to set visible or create a ResultDetailView. UUID of the - * testResult is passed via command parameters. - * - * @author bsinou - * - */ - -public class ResultDetailsDisplayHandler extends AbstractHandler { - // private static final Log log = LogFactory - // .getLog(ResultDetailsDisplayHandler.class); - - public final static String ID = "org.argeo.slc.client.ui.displayResultDetails"; - - public Object execute(ExecutionEvent event) throws ExecutionException { - - // We rather directly retrieve the corresponding view than use command - // parameters. - - // We pass the UUID of the test result we want to display via command - // parameters. - // String uuid = event - // .getParameter("org.argeo.slc.client.commands.resultUuid"); - - // TODO : remove this. - // if (uuid == null || "".equals(uuid)) { - // try { - // } catch (PartInitException e) { - // // TODO Auto-generated catch block - // e.printStackTrace(); - // } - // - // } - - // mode = 2 : VIEW_VISIBLE, Show view mode that indicates the view - // should be created or made visible if already created . - // mode = 1 : VIEW_ACTIVATE, Show view mode that indicates the view - // should be made visible and activated. Use of this mode has the same - // effect as calling - try { - ResultListView rlv = (ResultListView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage() - .findView(ResultListView.ID); - List ids = rlv.getSelectedResultsId(); - - ResultDetailView rView; - Iterator it = ids.iterator(); - while (it.hasNext()) { - String uuid = it.next(); - rView = (ResultDetailView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage() - .showView(ResultDetailView.ID, "UUID-" + uuid, 1); - rView.setUuid(uuid); - rView.retrieveResults(); - } - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java deleted file mode 100644 index 23fa87916..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.argeo.slc.client.ui.commands; - -import org.argeo.slc.client.ui.views.ResultListView; -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 ResultListViewRefreshHandler extends AbstractHandler { - - public Object execute(ExecutionEvent event) throws ExecutionException { - ResultListView view = (ResultListView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage() - .findView(ResultListView.ID); - view.retrieveResults(); - return null; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/controllers/ProcessController.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/controllers/ProcessController.java index 20a769c69..7d0a76ad5 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/controllers/ProcessController.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/controllers/ProcessController.java @@ -15,10 +15,8 @@ import org.argeo.slc.jcr.SlcJcrConstants; import org.argeo.slc.jcr.SlcJcrUtils; import org.argeo.slc.jcr.SlcNames; import org.argeo.slc.jcr.execution.JcrExecutionProcess; -import org.argeo.slc.process.SlcExecution; import org.argeo.slc.runtime.SlcAgent; import org.argeo.slc.runtime.SlcAgentFactory; -import org.argeo.slc.services.SlcExecutionService; /** * We use a separate class (not in UI components) so that it can be a singleton @@ -26,17 +24,8 @@ import org.argeo.slc.services.SlcExecutionService; */ public class ProcessController { private final static Log log = LogFactory.getLog(ProcessController.class); - private SlcExecutionService slcExecutionService; private Map agentFactories = new HashMap(); - public void execute(SlcAgent agent, SlcExecution slcExecution) { - slcExecutionService.newExecution(slcExecution); - agent.process(slcExecution); - if (log.isDebugEnabled()) - log.debug("SlcExecution " + slcExecution.getUuid() - + " launched on Agent " + agent.toString()); - } - public void process(Node processNode) { JcrExecutionProcess process = new JcrExecutionProcess(processNode); try { @@ -75,10 +64,6 @@ public class ProcessController { } } - public void setSlcExecutionService(SlcExecutionService slcExecutionService) { - this.slcExecutionService = slcExecutionService; - } - public synchronized void register(SlcAgentFactory agentFactory, Map properties) { String path = properties.get(SlcJcrConstants.PROPERTY_PATH); diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java deleted file mode 100644 index c34159b7e..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.argeo.slc.client.ui.listeners; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.client.ui.ClientUiPlugin; -import org.argeo.slc.core.attachment.Attachment; -import org.argeo.slc.core.attachment.SimpleAttachment; -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.core.test.tree.TreeTestResultListener; -import org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest; -import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest; -import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest; -import org.argeo.slc.msg.test.tree.ResultPartRequest; -import org.argeo.slc.services.TestManagerService; -import org.argeo.slc.test.TestResultPart; -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 Boolean onlyOnClose = false; - - private TestManagerService testManagerService; - - public void resultPartAdded(TreeTestResult testResult, - TestResultPart testResultPart) { - if (onlyOnClose) - return; - - if (testResult.getResultParts().size() == 1 - && testResult.getResultParts().values().iterator().next() - .getParts().size() == 1) { - CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( - testResult); - testManagerService.createTreeTestResult(req); - } else { - ResultPartRequest req = new ResultPartRequest(testResult); - testManagerService.addResultPart(req); - } - } - - public void close(TreeTestResult testResult) { - - if (onlyOnClose) { - CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( - testResult); - testManagerService.createTreeTestResult(req); - } else { - CloseTreeTestResultRequest req = new CloseTreeTestResultRequest( - testResult); - testManagerService.closeTreeTestResult(req); - } - - // TODO : clean this -> pb of thread && commandID hardCoded. - // We force the refresh of the list view. - ClientUiPlugin.getDefault().getWorkbench().getDisplay() - .syncExec(new Runnable() { - public void run() { - IHandlerService handlerService = (IHandlerService) ClientUiPlugin - .getDefault().getWorkbench() - .getService(IHandlerService.class); - try { - handlerService - .executeCommand( - "org.argeo.slc.client.ui.refreshResultList", - null); - handlerService - .executeCommand( - "org.argeo.slc.client.ui.refreshProcessList", - null); - - } catch (Exception e) { - log.error("Cannot refresh views: " + e); - } - } - } - - ); - - } - - public void addAttachment(TreeTestResult testResult, Attachment attachment) { - if (onlyOnClose) - return; - AddTreeTestResultAttachmentRequest req = new AddTreeTestResultAttachmentRequest(); - req.setResultUuid(testResult.getUuid()); - req.setAttachment((SimpleAttachment) attachment); - testManagerService.addAttachment(req); - - } - - /** Publishes the test result only when it gets closed. */ - public void setOnlyOnClose(Boolean onlyOnClose) { - this.onlyOnClose = onlyOnClose; - } - - public void setTestManagerService(TestManagerService testManagerService) { - this.testManagerService = testManagerService; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ExecutionModulesContentProvider.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ExecutionModulesContentProvider.java deleted file mode 100644 index 059d8611a..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ExecutionModulesContentProvider.java +++ /dev/null @@ -1,260 +0,0 @@ -package org.argeo.slc.client.ui.providers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.SortedMap; -import java.util.TreeMap; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.eclipse.ui.TreeParent; -import org.argeo.slc.execution.ExecutionFlowDescriptor; -import org.argeo.slc.execution.ExecutionModuleDescriptor; -import org.argeo.slc.runtime.SlcAgent; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; - -public class ExecutionModulesContentProvider implements ITreeContentProvider { - private final static Log log = LogFactory - .getLog(ExecutionModulesContentProvider.class); - - // IoC - private List slcAgents; - - public Object[] getChildren(Object parent) { - if (parent instanceof ExecutionModuleNode) { - ExecutionModuleNode executionModuleNode = (ExecutionModuleNode) parent; - ExecutionModuleDescriptor emd = executionModuleNode.getDescriptor(); - - // Terminate the building of UI specific object emd - emd = executionModuleNode - .getAgentNode() - .getAgent() - .getExecutionModuleDescriptor(emd.getName(), - emd.getVersion()); - executionModuleNode.cacheDescriptor(emd); - - // This is not recursive, e.g. ExecutionModuleNode build a Tree of - // specific - // treeObject and cache it in the cacheDescriptor. - // Then we only have TreeObjects - return executionModuleNode.getChildren(); - } else if (parent instanceof AgentNode) { - AgentNode agentNode = (AgentNode) parent; - - if (log.isTraceEnabled()) - log.trace("Scan agent " + agentNode); - - agentNode.clearChildren(); - for (ExecutionModuleDescriptor desc : agentNode.getAgent() - .listExecutionModuleDescriptors()) { - agentNode.addChild(new ExecutionModuleNode(agentNode, desc)); - } - - return agentNode.getChildren(); - } else if (parent instanceof TreeParent) { - return ((TreeParent) parent).getChildren(); - } else if (parent instanceof FlowNode) { - return new Object[0]; - } else { - List agentNodes = new ArrayList(); - for (SlcAgent slcAgent : slcAgents) { - agentNodes.add(new AgentNode(slcAgent)); - } - return agentNodes.toArray(); - } - } - - public Object getParent(Object node) { - // if (node instanceof TreeObject) { - // return ((TreeObject) node).getParent(); - // } - return null; - } - - public boolean hasChildren(Object parent) { - if (parent instanceof TreeParent && ((TreeParent) parent).isLoaded()) { - return ((TreeParent) parent).hasChildren(); - } else if (parent instanceof AgentNode) { - return true; - } else if (parent instanceof ExecutionModuleNode) { - return true; - } - return false; - } - - public void inputChanged(Viewer v, Object oldInput, Object newInput) { - } - - public void dispose() { - } - - public Object[] getElements(Object parent) { - return getChildren(parent); - } - - - - public class AgentNode extends TreeParent { - private final SlcAgent agent; - - public AgentNode(SlcAgent agent) { - super(agent.toString()); - this.agent = agent; - } - - public SlcAgent getAgent() { - return agent; - } - } - - public class ExecutionModuleNode extends TreeParent { - private final AgentNode agentNode; - private ExecutionModuleDescriptor descriptor; - private Map flowDescriptors; - - public ExecutionModuleNode(AgentNode agentNode, - ExecutionModuleDescriptor descriptor) { - super(descriptor.toString()); - this.agentNode = agentNode; - this.descriptor = descriptor; - - } - - public AgentNode getAgentNode() { - return agentNode; - } - - public ExecutionModuleDescriptor getDescriptor() { - return descriptor; - } - - public void cacheDescriptor(ExecutionModuleDescriptor descriptor) { - this.descriptor = descriptor; - - SortedMap folderNodes = new TreeMap(); - flowDescriptors = new HashMap(); - - for (ExecutionFlowDescriptor fd : descriptor.getExecutionFlows()) { - // Find, format and store path and label values for each flow - // descritor: - - // we format name of type path="" & name="path/toTest/Test" to : - // path="path/toTest/" name="Test" - String path; - String label; - int lastSlash = fd.getName().lastIndexOf('/'); - if ((fd.getPath() == null || fd.getPath().trim().equals("")) - && lastSlash >= 0) { - path = fd.getName().substring(0, lastSlash); - label = fd.getName().substring(lastSlash + 1); - } else { - path = fd.getPath(); - label = fd.getName(); - } - - if (path == null || path.trim().equals("") - || path.trim().equals("/")) { - // directChildren.put(name, new FlowNode(name, this)); - addChild(new FlowNode(label, fd.getName(), fd, this)); - } else { - FolderNode folderNode = mkdirs(this, path, folderNodes); - folderNode.addChild(new FlowNode(label, fd.getName(), fd, - this)); - } - - flowDescriptors.put(fd.getName(), fd); - } - // TODO: make it readonly - } - - protected FolderNode mkdirs(TreeParent root, String path, - SortedMap folderNodes) { - // Normalize - if (path.charAt(0) != '/') - path = '/' + path; - if (path.charAt(path.length() - 1) == '/') - path = path.substring(0, path.length() - 1); - - if (folderNodes.containsKey(path)) - return folderNodes.get(path); - - int lastIndx = path.lastIndexOf('/'); - String folderName; - String parentPath; - if (lastIndx >= 0) { - folderName = path.substring(lastIndx + 1); - parentPath = path.substring(0, lastIndx); - } else { - folderName = path; - parentPath = ""; - } - - TreeParent parent; - if (parentPath.equals("")) - parent = root; - else - parent = mkdirs(root, parentPath, folderNodes); - FolderNode newFolder = new FolderNode(folderName); - parent.addChild(newFolder); - folderNodes.put(path, newFolder); - return newFolder; - } - - public Map getFlowDescriptors() { - return flowDescriptors; - } - - } - - /** - * - * @author bsinou - * - * The implementation of a vernice of a given slc process. Note that - * we store the parent node (execution module node) & the - * ExecutionFlowDescriptor. - */ - public class FlowNode extends TreeParent { - - private final String flowName; - private final ExecutionModuleNode executionModuleNode; - private final ExecutionFlowDescriptor executionFlowDescriptor; - - public FlowNode(String label, String flowName, - ExecutionFlowDescriptor executionFlowDescriptor, - ExecutionModuleNode parent) { - super(label); - this.flowName = flowName; - this.executionFlowDescriptor = executionFlowDescriptor; - this.executionModuleNode = parent; - } - - public String getFlowName() { - return flowName; - } - - public ExecutionModuleNode getExecutionModuleNode() { - return executionModuleNode; - } - - public ExecutionFlowDescriptor getExecutionFlowDescriptor() { - return executionFlowDescriptor; - } - - } - - public class FolderNode extends TreeParent { - public FolderNode(String name) { - super(name); - } - - } - - // IoC - public void setSlcAgents(List slcAgents) { - this.slcAgents = slcAgents; - } -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java deleted file mode 100644 index 03ef4fc25..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java +++ /dev/null @@ -1,170 +0,0 @@ -package org.argeo.slc.client.ui.providers; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.client.ui.views.ProcessBuilderView; -import org.argeo.slc.client.ui.views.ProcessParametersView; -import org.argeo.slc.core.execution.PrimitiveAccessor; -import org.argeo.slc.core.execution.PrimitiveUtils; -import org.argeo.slc.core.execution.RefSpecAttribute; -import org.argeo.slc.core.execution.RefValue; -import org.argeo.slc.core.execution.RefValueChoice; -import org.argeo.slc.execution.ExecutionSpec; -import org.argeo.slc.execution.ExecutionSpecAttribute; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnViewer; -import org.eclipse.jface.viewers.ComboBoxCellEditor; -import org.eclipse.jface.viewers.EditingSupport; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TextCellEditor; - -/** - * - * - * Implements the ability to edit and save various type of parameter of a given - * process. Parameter values are directly saved as soon as the focus on a given - * field is lost. - * - * - * Note that EditingSupport is tightly coupled with both ProcessParametersView - * and ProcessBuilderView; it cannot serve as a generic EditingSupport as is. - * Note also that it assumes that processes in the ProcessBuilderView are stored - * as an ordered list. - * - * @author bsinou - * - */ - -public class ProcessParametersEditingSupport extends EditingSupport { - - private final static Log log = LogFactory - .getLog(ProcessParametersEditingSupport.class); - - private CellEditor strEditor; - // private ComboBoxCellEditor comboEditor; - // private int column; - - // So that we can update corresponding process - private int curProcessIndex; - private ProcessBuilderView pbView; - - // To populate drop down lists - private ExecutionSpec executionSpec; - - // To persist combo box elements indexes - Map> comboBoxes = new HashMap>(); - - public ProcessParametersEditingSupport(ColumnViewer viewer, int column) { - super(viewer); - strEditor = new TextCellEditor(((TableViewer) viewer).getTable()); - // TODO : add cell validators. - } - - @Override - protected CellEditor getCellEditor(Object element) { - - // TODO : check if all parameter always have a linked attribute. - if (element instanceof ProcessParametersView.ObjectWithName) { - ProcessParametersView.ObjectWithName own = (ProcessParametersView.ObjectWithName) element; - ExecutionSpecAttribute esa = executionSpec.getAttributes().get( - own.name); - if (esa != null) { - // Paramater is a primitive with no list of choices linked by - // the specs - if (own.obj instanceof PrimitiveAccessor - && !(esa instanceof RefSpecAttribute)) - return strEditor; - else if (esa instanceof RefSpecAttribute) { - RefSpecAttribute rsa = (RefSpecAttribute) esa; - - Iterator choices = rsa.getChoices() - .iterator(); - List items = new ArrayList(); - while (choices.hasNext()) { - items.add(choices.next().getName()); - } - - // persists order of the elements in the current combo box - comboBoxes.put(own.name, items); - - String[] itemsStr = new String[items.size()]; - ComboBoxCellEditor comboEditor = new ComboBoxCellEditor( - ((TableViewer) getViewer()).getTable(), - items.toArray(itemsStr)); - return comboEditor; - } - } - } - if (log.isTraceEnabled()) { - log.warn(" No cell Editor fits for element : " + element.toString() - + " of class : " + element.getClass().getName()); - } - return null; - } - - @Override - protected boolean canEdit(Object element) { - if (element instanceof ProcessParametersView.ObjectWithName) { - ProcessParametersView.ObjectWithName own = (ProcessParametersView.ObjectWithName) element; - ExecutionSpecAttribute esa = executionSpec.getAttributes().get( - own.name); - if (esa != null && !esa.getIsFrozen()) - return true; - } - return false; - } - - @Override - protected Object getValue(Object element) { - ProcessParametersView.ObjectWithName own = (ProcessParametersView.ObjectWithName) element; - - if (own.obj instanceof PrimitiveAccessor) { - PrimitiveAccessor pv = (PrimitiveAccessor) own.obj; - return pv.getValue().toString(); - } else if (own.obj instanceof RefValue) { - RefValue rv = (RefValue) own.obj; - List values = comboBoxes.get(own.name); - return values.indexOf(rv.getRef()); - } else - return "unsupported param type"; - } - - @Override - protected void setValue(Object element, Object value) { - ProcessParametersView.ObjectWithName own = (ProcessParametersView.ObjectWithName) element; - if (own.obj instanceof PrimitiveAccessor) { - PrimitiveAccessor pv = (PrimitiveAccessor) own.obj; - if (PrimitiveUtils.typeAsClass(pv.getType()) != null) - pv.setValue(value); - pbView.updateParameter(curProcessIndex, own.name, own.obj); - getViewer().update(element, null); - } else if (own.obj instanceof RefValue) { - RefValue rv = (RefValue) own.obj; - List values = comboBoxes.get(own.name); - rv.setRef(values.get(((Integer) value).intValue())); - getViewer().update(element, null); - } - - } - - // Store the index of the process which parameters are being edited - public void setCurrentProcessIndex(int index) { - this.curProcessIndex = index; - } - - public void setCurrentExecutionSpec(ExecutionSpec executionSpec) { - this.executionSpec = executionSpec; - } - - public void setCurrentProcessBuilderView( - ProcessBuilderView processbuilderView) { - this.pbView = processbuilderView; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ExecutionModulesView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ExecutionModulesView.java deleted file mode 100644 index 008b65545..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ExecutionModulesView.java +++ /dev/null @@ -1,220 +0,0 @@ -package org.argeo.slc.client.ui.views; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import java.util.UUID; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.SlcException; -import org.argeo.slc.client.ui.SlcImages; -import org.argeo.slc.client.ui.controllers.ProcessController; -import org.argeo.slc.client.ui.providers.ExecutionModulesContentProvider; -import org.argeo.slc.client.ui.providers.ExecutionModulesContentProvider.FlowNode; -import org.argeo.slc.execution.ExecutionModuleDescriptor; -import org.argeo.slc.process.RealizedFlow; -import org.argeo.slc.process.SlcExecution; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.DragSourceEvent; -import org.eclipse.swt.dnd.DragSourceListener; -import org.eclipse.swt.dnd.TextTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; - -public class ExecutionModulesView extends ViewPart { - private final static Log log = LogFactory - .getLog(ExecutionModulesView.class); - - public static final String ID = "org.argeo.slc.client.ui.executionModulesView"; - - private TreeViewer viewer; - - // Ioc - private IContentProvider contentProvider; - //private OxmInterface oxmBean; - private ProcessController processController; - - public void createPartControl(Composite parent) { - viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - viewer.setContentProvider(contentProvider); - viewer.setLabelProvider(new ViewLabelProvider()); - viewer.setInput(getViewSite()); - viewer.addDoubleClickListener(new ViewDoubleClickListener()); - int operations = DND.DROP_COPY | DND.DROP_MOVE; - Transfer[] tt = new Transfer[] { TextTransfer.getInstance() }; - viewer.addDragSupport(operations, tt, new ViewDragListener()); - } - - public void setFocus() { - viewer.getControl().setFocus(); - } - - public TreeViewer getViewer() { - return viewer; - } - - public void refreshView() { - viewer.setInput(getViewSite()); - } - - class ViewLabelProvider extends LabelProvider implements - ITableLabelProvider { - public String getColumnText(Object obj, int index) { - if (obj instanceof ExecutionModulesContentProvider.ExecutionModuleNode) { - ExecutionModuleDescriptor emd = ((ExecutionModulesContentProvider.ExecutionModuleNode) obj) - .getDescriptor(); - if (emd.getLabel() != null) { - return emd.getLabel(); - } else { - return getText(emd); - } - } else - return getText(obj); - } - - public Image getColumnImage(Object obj, int index) { - return getImage(obj); - } - - public Image getImage(Object obj) { - if (obj instanceof ExecutionModulesContentProvider.AgentNode) - return SlcImages.AGENT; - else if (obj instanceof ExecutionModulesContentProvider.ExecutionModuleNode) - return SlcImages.MODULE; - else if (obj instanceof ExecutionModulesContentProvider.FolderNode) - return SlcImages.FOLDER; - else if (obj instanceof ExecutionModulesContentProvider.FlowNode) - return SlcImages.FLOW; - else - return PlatformUI.getWorkbench().getSharedImages() - .getImage(ISharedImages.IMG_OBJ_ELEMENT); - } - } - - class ViewDoubleClickListener implements IDoubleClickListener { - public void doubleClick(DoubleClickEvent evt) { - Object obj = ((IStructuredSelection) evt.getSelection()) - .getFirstElement(); - if (obj instanceof ExecutionModulesContentProvider.FlowNode) { - ExecutionModulesContentProvider.FlowNode fn = (ExecutionModulesContentProvider.FlowNode) obj; - - List realizedFlows = new ArrayList(); - RealizedFlow realizedFlow = new RealizedFlow(); - realizedFlow.setModuleName(fn.getExecutionModuleNode() - .getDescriptor().getName()); - realizedFlow.setModuleVersion(fn.getExecutionModuleNode() - .getDescriptor().getVersion()); - realizedFlow.setFlowDescriptor(fn.getExecutionModuleNode() - .getFlowDescriptors().get(fn.getFlowName())); - realizedFlows.add(realizedFlow); - - SlcExecution slcExecution = new SlcExecution(); - slcExecution.setUuid(UUID.randomUUID().toString()); - slcExecution.setRealizedFlows(realizedFlows); - slcExecution.setHost(fn.getExecutionModuleNode().getAgentNode() - .getAgent().toString()); - processController.execute(fn.getExecutionModuleNode() - .getAgentNode().getAgent(), slcExecution); - } - } - - } - - class ViewDragListener implements DragSourceListener { - - public void dragStart(DragSourceEvent event) { - System.out.println("Start Drag"); - } - - public void dragSetData(DragSourceEvent event) { - - // System.out.println("dragSetData: " + event); - - IStructuredSelection selection = (IStructuredSelection) viewer - .getSelection(); - if (selection.getFirstElement() instanceof ExecutionModulesContentProvider.FlowNode) { - - if (TextTransfer.getInstance().isSupportedType(event.dataType)) { - ExecutionModulesContentProvider.FlowNode flowNode = (ExecutionModulesContentProvider.FlowNode) selection - .getFirstElement(); - - Properties props = new Properties(); - flowNodeAsProperties(props, flowNode); - props.setProperty("agentId", flowNode - .getExecutionModuleNode().getAgentNode().getAgent() - .getAgentUuid()); - props.setProperty("host", flowNode.getExecutionModuleNode() - .getAgentNode().getAgent().toString()); - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - try { - props.store(out, ""); - event.data = new String(out.toByteArray()); - } catch (IOException e) { - throw new SlcException( - "Cannot transform realized flow", e); - } finally { - IOUtils.closeQuietly(out); - } - } - } - } - - public void dragFinished(DragSourceEvent event) { - System.out.println("Finished Drag"); - } - - protected void flowNodeAsProperties(Properties props, FlowNode fn) { - - RealizedFlow realizedFlow = new RealizedFlow(); - realizedFlow.setModuleName(fn.getExecutionModuleNode() - .getDescriptor().getName()); - realizedFlow.setModuleVersion(fn.getExecutionModuleNode() - .getDescriptor().getVersion()); - realizedFlow.setFlowDescriptor(fn.getExecutionFlowDescriptor()); - - // As we want to have the effective ExecutionSpec and not a - // reference; we store it at the RealizeFlow level : thus the - // marshaller will store the object and not only a reference. - realizedFlow.setExecutionSpec(fn.getExecutionFlowDescriptor() - .getExecutionSpec()); - -// props.setProperty("RealizedFlowAsXml", -// oxmBean.marshal(realizedFlow)); -// System.out -// .println(oxmBean.marshal(fn.getExecutionFlowDescriptor())); - - } - - } - - // IoC - public void setContentProvider(IContentProvider contentProvider) { - this.contentProvider = contentProvider; - } - - public void setProcessController(ProcessController processController) { - this.processController = processController; - } - -// public void setOxmBean(OxmInterface oxmBean) { -// this.oxmBean = oxmBean; -// } - -} \ No newline at end of file diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java deleted file mode 100644 index c293cb38b..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java +++ /dev/null @@ -1,301 +0,0 @@ -package org.argeo.slc.client.ui.views; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import java.util.UUID; - -import org.apache.commons.io.IOUtils; -import org.argeo.slc.SlcException; -import org.argeo.slc.client.ui.ClientUiPlugin; -import org.argeo.slc.client.ui.controllers.ProcessController; -import org.argeo.slc.process.RealizedFlow; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.runtime.SlcAgent; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerDropAdapter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.dnd.DND; -import org.eclipse.swt.dnd.TextTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.dnd.TransferData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.ViewPart; - -/** - * Display a list of processes that are to be launched as batch. For the moment - * being, only one agent by batch is enabled. The batch is constructed by - * dropping process from the ExecutionModuleView. Wrong type of data dropped in - * this view raises an error. - * - * @author bsinou - * - */ -public class ProcessBuilderView extends ViewPart { - // private final static Log log = - // LogFactory.getLog(ProcessBuilderView.class); - - public static final String ID = "org.argeo.slc.client.ui.processBuilderView"; - - private TableViewer viewer; - private List realizedFlows = new ArrayList(); - private String currentAgentUuid = null; - private String host = null; - - // TODO find a better way to get index of the current selected row - // used in removeSelected - private int curSelectedRow = -1; - - // IoC - //private OxmInterface oxmBean; - private ProcessController processController; - private List slcAgents; - - public void createPartControl(Composite parent) { - Table table = createTable(parent); - viewer = new TableViewer(table); - viewer.setLabelProvider(new ViewLabelProvider()); - viewer.setContentProvider(new ViewContentProvider()); - viewer.addSelectionChangedListener(new SelectionChangedListener()); - - int operations = DND.DROP_COPY | DND.DROP_MOVE; - Transfer[] tt = new Transfer[] { TextTransfer.getInstance() }; - viewer.addDropSupport(operations, tt, new ViewDropListener(viewer)); - - viewer.setInput(getViewSite()); - } - - protected Table createTable(Composite parent) { - int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL - | SWT.FULL_SELECTION; - - Table table = new Table(parent, style); - - table.setLinesVisible(true); - table.setHeaderVisible(true); - - TableColumn column = new TableColumn(table, SWT.LEFT, 0); - column.setText("Module"); - column.setWidth(200); - - column = new TableColumn(table, SWT.LEFT, 1); - column.setText("Flow"); - column.setWidth(200); - - return table; - } - - protected void execute() { - // TODO: use agent proxy to retrieve it - SlcAgent agent = null; - SlcExecution slcExecution = new SlcExecution(); - slcExecution.setUuid(UUID.randomUUID().toString()); - slcExecution.setRealizedFlows(realizedFlows); - processController.execute(agent, slcExecution); - } - - public void setFocus() { - viewer.getControl().setFocus(); - } - - // update one of the parameter of a given RealizedFlow - public void updateParameter(int realizedFlowIndex, String paramName, - Object value) { - RealizedFlow curRealizedFlow = realizedFlows.get(realizedFlowIndex); - curRealizedFlow.getFlowDescriptor().getValues().put(paramName, value); - } - - // clear the realizedFlow - public void clearBatch() { - // we clear the list - realizedFlows = new ArrayList(); - curSelectedRow = -1; - refreshParameterview(); - viewer.refresh(); - } - - // Remove the selected process from the batch - public void removeSelected() { - if (curSelectedRow == -1) - return; - else - realizedFlows.remove(curSelectedRow); - curSelectedRow = -1; - refreshParameterview(); - viewer.refresh(); - } - - // calling this method with index =-1 will cause the reset of the view. - private void refreshParameterview() { - // We choose to directly access the view rather than going through - // commands. - ProcessParametersView ppView; - try { - ppView = (ProcessParametersView) ClientUiPlugin.getDefault() - .getWorkbench().getActiveWorkbenchWindow().getActivePage() - .showView(ProcessParametersView.ID); - - if (curSelectedRow == -1) - ppView.setRealizedFlow(-1, null); - else - ppView.setRealizedFlow(curSelectedRow, - realizedFlows.get(curSelectedRow)); - } catch (PartInitException e) { - throw new SlcException( - "Cannot Retrieve ProcessParameterView to edit parameters of selected process", - e); - } - } - - // Launches the execution of listed realized flow with specified parameters. - public void launchBatch() { - SlcExecution slcExecution = new SlcExecution(); - slcExecution.setUuid(UUID.randomUUID().toString()); - - slcExecution.setRealizedFlows(realizedFlows); - slcExecution.setHost(host); - - // TODO : insure that the concept has been well understood & the - // specification respected - SlcAgent curAgent; - for (int i = 0; i < slcAgents.size(); i++) { - if (currentAgentUuid == null) - throw new SlcException( - "Cannot launch a batch if no agent is specified"); - if (currentAgentUuid.equals(slcAgents.get(i).getAgentUuid())) { - curAgent = slcAgents.get(i); - processController.execute(curAgent, slcExecution); - break; - } - } - } - - // Specific Providers for the current view. - protected class ViewContentProvider implements IStructuredContentProvider { - public void inputChanged(Viewer arg0, Object arg1, Object arg2) { - } - - public void dispose() { - } - - public Object[] getElements(Object obj) { - return realizedFlows.toArray(); - } - } - - protected class ViewLabelProvider extends LabelProvider implements - ITableLabelProvider { - public String getColumnText(Object obj, int index) { - RealizedFlow rf = (RealizedFlow) obj; - switch (index) { - case 0: - return rf.getModuleName(); - case 1: - return rf.getFlowDescriptor().getName(); - } - return getText(obj); - } - - public Image getColumnImage(Object obj, int index) { - return null; - } - - } - - // Parameter view is updated each time a new line is selected - class SelectionChangedListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent evt) { - - IStructuredSelection curSelection = (IStructuredSelection) evt - .getSelection(); - Object obj = curSelection.getFirstElement(); - - if (obj instanceof RealizedFlow) { - RealizedFlow rf = (RealizedFlow) obj; - curSelectedRow = realizedFlows.indexOf(rf); - refreshParameterview(); - setFocus(); - } - } - } - - // Implementation of the Drop Listener - protected class ViewDropListener extends ViewerDropAdapter { - - public ViewDropListener(Viewer viewer) { - super(viewer); - } - - @Override - public boolean performDrop(Object data) { - - Properties props = new Properties(); - - // TODO : Handle wrong type of dropped data - ByteArrayInputStream in = new ByteArrayInputStream(data.toString() - .getBytes()); - try { - props.load(in); - } catch (IOException e) { - throw new SlcException("Cannot create read flow node", e); - } finally { - IOUtils.closeQuietly(in); - } - - String agentId = props.getProperty("agentId"); - if (currentAgentUuid == null) { - currentAgentUuid = agentId; - host = props.getProperty("host"); - } else if (!currentAgentUuid.equals(agentId)) { - // TODO: as for now, we can only construct batch on a single - // Agent, must be upgraded to enable batch on various agent. - throw new SlcException( - "Cannot create batch on two (or more) distinct agents", - null); - } - - String fdXml = props.getProperty("RealizedFlowAsXml"); - if (fdXml == null) - return false; - RealizedFlow rf = null;//(RealizedFlow) oxmBean.unmarshal(fdXml); - realizedFlows.add(rf); - curSelectedRow = realizedFlows.indexOf(rf); - refreshParameterview(); - getViewer().refresh(); - return true; - } - - @Override - public boolean validateDrop(Object target, int operation, - TransferData transferType) { - return true; - } - } - - // IoC - public void setSlcAgents(List slcAgents) { - this.slcAgents = slcAgents; - } - -// public void setOxmBean(OxmInterface oxmBean) { -// this.oxmBean = oxmBean; -// } - - public void setProcessController(ProcessController processController) { - this.processController = processController; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java deleted file mode 100644 index 714cb19c6..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.argeo.slc.client.ui.views; - -import org.argeo.slc.dao.process.SlcExecutionDao; -import org.argeo.slc.process.SlcExecution; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.part.ViewPart; - -/** - * Multi-instance view that enables to browse the details of a given - * SlcExecution - * - * @author bsinou - * - */ - -public class ProcessDetailView extends ViewPart { - // private final static Log log = - // LogFactory.getLog(ProcessDetailView.class); - public static final String ID = "org.argeo.slc.client.ui.processDetailView"; - - private TreeViewer viewer; - - private String uuid; - private SlcExecution se; - - // IoC - private IContentProvider contentProvider; - private SlcExecutionDao slcExecutionDao; - - public void createPartControl(Composite parent) { - viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - viewer.setContentProvider(contentProvider); - viewer.setLabelProvider(new ProcessDetailLabelProvider()); - // viewer.setInput(getViewSite()); - } - - public void setFocus() { - viewer.getControl().setFocus(); - } - - public TreeViewer getViewer() { - return viewer; - } - - public void retrieveResults() { - se = slcExecutionDao.getSlcExecution(uuid); - viewer.setInput(se); - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - // Inner Class - public class ProcessDetailLabelProvider extends LabelProvider implements - ITableLabelProvider { - public String getColumnText(Object obj, int index) { - // log.debug(sessionFactory.getClass().toString()); - - SlcExecution se = (SlcExecution) obj; - switch (index) { - - case 0: - return getText(se.getStartDate()); - case 1: - return se.getHost(); - case 2: - return se.getUuid(); - case 3: - return se.currentStep().getType(); - } - return getText(obj); - } - - public Image getColumnImage(Object obj, int index) { - return null; - } - - } - - // IoC - public void setContentProvider(IContentProvider contentProvider) { - this.contentProvider = contentProvider; - } - - public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) { - this.slcExecutionDao = slcExecutionDao; - } -} \ No newline at end of file diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessListView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessListView.java deleted file mode 100644 index 862dab429..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessListView.java +++ /dev/null @@ -1,164 +0,0 @@ -package org.argeo.slc.client.ui.views; - -import java.util.ArrayList; - -import org.argeo.slc.SlcException; -import org.argeo.slc.client.ui.ClientUiPlugin; -import org.argeo.slc.dao.process.SlcExecutionDao; -import org.argeo.slc.process.SlcExecution; -import org.eclipse.core.commands.Command; -import org.eclipse.core.commands.IParameter; -import org.eclipse.core.commands.Parameterization; -import org.eclipse.core.commands.ParameterizedCommand; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.commands.ICommandService; -import org.eclipse.ui.handlers.IHandlerService; -import org.eclipse.ui.part.ViewPart; - -/** - * This class display the list of all processes that have run in the - * corresponding agent. Currently, the local agent. - * - * @author bsinou - * - */ -public class ProcessListView extends ViewPart { - // private final static Log log = LogFactory.getLog(ProcessListView.class); - - public static final String ID = "org.argeo.slc.client.ui.processListView"; - - private TableViewer viewer; - - // IoC - private SlcExecutionDao slcExecutionDao; - private ITableLabelProvider tableLabelProvider; - private IStructuredContentProvider structuredContentProvider; - - public void createPartControl(Composite parent) { - Table table = createTable(parent); - viewer = new TableViewer(table); - viewer.setLabelProvider(tableLabelProvider); - viewer.setContentProvider(structuredContentProvider); - viewer.setInput(getViewSite()); - viewer.addDoubleClickListener(new ViewDoubleClickListener()); - - } - - protected Table createTable(Composite parent) { - int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL - | SWT.FULL_SELECTION; - // does not function with RAP, commented for the moment being - // | SWT.HIDE_SELECTION; - - Table table = new Table(parent, style); - - // GridData gridData = new GridData(GridData.FILL_BOTH); - // gridData.grabExcessVerticalSpace = true; - // gridData.grabExcessHorizontalSpace = true; - // gridData.horizontalSpan = 3; - // table.setLayoutData(gridData); - - table.setLinesVisible(true); - table.setHeaderVisible(true); - - TableColumn column = new TableColumn(table, SWT.LEFT, 0); - column.setText("Date"); - column.setWidth(200); - - column = new TableColumn(table, SWT.LEFT, 1); - column.setText("Host"); - column.setWidth(100); - - column = new TableColumn(table, SWT.LEFT, 2); - column.setText("Id"); - column.setWidth(300); - - column = new TableColumn(table, SWT.LEFT, 3); - column.setText("Status"); - column.setWidth(100); - - return table; - } - - public void setFocus() { - viewer.getControl().setFocus(); - } - - public void retrieveResults() { - viewer.setInput(slcExecutionDao.listSlcExecutions()); - } - - // Handle Events - class ViewDoubleClickListener implements IDoubleClickListener { - public void doubleClick(DoubleClickEvent evt) { - Object obj = ((IStructuredSelection) evt.getSelection()) - .getFirstElement(); - - if (obj instanceof SlcExecution) { - SlcExecution se = (SlcExecution) obj; - - IWorkbench iw = ClientUiPlugin.getDefault().getWorkbench(); - IHandlerService handlerService = (IHandlerService) iw - .getService(IHandlerService.class); - try { - // get the command from plugin.xml - IWorkbenchWindow window = iw.getActiveWorkbenchWindow(); - ICommandService cmdService = (ICommandService) window - .getService(ICommandService.class); - Command cmd = cmdService - .getCommand("org.argeo.slc.client.ui.displayProcessDetails"); - - ArrayList parameters = new ArrayList(); - - // get the parameter - IParameter iparam = cmd - .getParameter("org.argeo.slc.client.commands.processUuid"); - Parameterization params = new Parameterization(iparam, - se.getUuid()); // "testUUID");// - parameters.add(params); - - // build the parameterized command - ParameterizedCommand pc = new ParameterizedCommand(cmd, - parameters.toArray(new Parameterization[parameters - .size()])); - - // execute the command - handlerService = (IHandlerService) window - .getService(IHandlerService.class); - handlerService.executeCommand(pc, null); - - } catch (Exception e) { - e.printStackTrace(); - throw new SlcException("Problem while rendering result. " - + e.getMessage()); - } - } - } - } - - // IoC - public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) { - this.slcExecutionDao = slcExecutionDao; - } - - public void setTableLabelProvider(ITableLabelProvider tableLabelProvider) { - this.tableLabelProvider = tableLabelProvider; - } - - public void setStructuredContentProvider( - IStructuredContentProvider structuredContentProvider) { - this.structuredContentProvider = structuredContentProvider; - } - -} \ No newline at end of file diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java deleted file mode 100644 index 5ffcf2ac4..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java +++ /dev/null @@ -1,222 +0,0 @@ -package org.argeo.slc.client.ui.views; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.client.ui.ClientUiPlugin; -import org.argeo.slc.client.ui.providers.ProcessParametersEditingSupport; -import org.argeo.slc.core.execution.PrimitiveAccessor; -import org.argeo.slc.core.execution.RefValue; -import org.argeo.slc.process.RealizedFlow; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.ui.part.ViewPart; - -/** - * This view, directly linked with the ProcessBuilderView enables - * the display and editing the parameters of a given process. - * - * - * Note that for a given RealizedFlow : - * - * + parameters value are set using - * RealizedFlow.ExecutionFlowDescriptor.values, that might have - * default values - * - * + possible "values" for a given parameters are stored in - * RealizedFlow.ExecutionSpec. - * - */ -public class ProcessParametersView extends ViewPart { - private static final Log log = LogFactory - .getLog(ProcessParametersView.class); - - public static final String ID = "org.argeo.slc.client.ui.processParametersView"; - - // This map stores actual values : - // * default values (if defined) at instantiation time - // * values filled-in or modified by the end-user - private Map values; - - // This map stores the spec of the attributes used to offer the end user - // some choices. - // private Map specAttributes; - - // We must keep a reference to the current EditingSupport so that we can - // update the index of the process being updated - ProcessParametersEditingSupport ppEditingSupport; - - // view attributes - private TableViewer viewer; - - public void createPartControl(Composite parent) { - viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL - | SWT.V_SCROLL | SWT.FULL_SELECTION); - createColumns(viewer); - - // WARNING - // for the moment being, we support only one process builder at a time - // we set the corresponding view in the editor here. - ProcessBuilderView pbView = (ProcessBuilderView) ClientUiPlugin - .getDefault().getWorkbench().getActiveWorkbenchWindow() - .getActivePage().findView(ProcessBuilderView.ID); - ppEditingSupport.setCurrentProcessBuilderView(pbView); - - viewer.setLabelProvider(new ViewLabelProvider()); - viewer.setContentProvider(new ViewContentProvider()); - viewer.setInput(getViewSite()); - - } - - // This will create the columns for the table - private void createColumns(TableViewer viewer) { - - String[] titles = { "Attribute name", "value" }; - int[] bounds = { 200, 200 }; - - for (int i = 0; i < titles.length; i++) { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(titles[i]); - column.getColumn().setWidth(bounds[i]); - column.getColumn().setResizable(true); - column.getColumn().setMoveable(true); - if (i == 1) { - // we create the used EditingSupport and enable editing support - // for value Column - ppEditingSupport = new ProcessParametersEditingSupport(viewer, - i); - column.setEditingSupport(ppEditingSupport); - } - } - Table table = viewer.getTable(); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - } - - public void setFocus() { - viewer.getControl().setFocus(); - } - - // set class attributes, refresh the lists of process paramaters to edit. - public void setRealizedFlow(int index, RealizedFlow rf) { - // force the cleaning of the view - if (index == -1) { - viewer.setInput(null); - return; - } - // we store the index of the edited Process in the editor so that it can - // save entries modified by the end user. - ppEditingSupport.setCurrentProcessIndex(index); - - // We also store corresponding ExecutionSpec to be able to retrieve - // possible values for dropdown lists - ppEditingSupport.setCurrentExecutionSpec(rf.getExecutionSpec()); - // ExecutionSpec es = rf.getExecutionSpec(); - // if (es != null && es.getAttributes() != null) - // parameters = es.getAttributes(); - // if (parameters != null) - // viewer.setInput(parameters); - - values = rf.getFlowDescriptor().getValues(); - // specAttributes = rf.getFlowDescriptor().getExecutionSpec() - // .getAttributes(); - - if (values != null) - viewer.setInput(values); - else - // No parameters to edit, we reset the view. - viewer.setInput(null); - - } - - // Inner Classes we should use ExecutionSpecAttribute instead of values - // see below - protected class ViewContentProvider implements IStructuredContentProvider { - public void inputChanged(Viewer arg0, Object arg1, Object arg2) { - } - - public void dispose() { - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - // we cast the Map to List - public Object[] getElements(Object obj) { - - if (obj instanceof Map && ((Map) obj).size() != 0) { - List list = new ArrayList(); - Map map = (Map) obj; - for (String key : map.keySet()) { - list.add(new ObjectWithName(key, map.get(key))); - } - return list.toArray(); - } else { - return new Object[0]; - } - } - } - - protected class ViewLabelProvider extends LabelProvider implements - ITableLabelProvider { - - public String getColumnText(Object obj, int index) { - // NOTE : the passed object is a line of the table !!! - - if (obj instanceof ObjectWithName) { - ObjectWithName own = (ObjectWithName) obj; - switch (index) { - case 0: - return own.name; - case 1: - if (own.obj instanceof PrimitiveAccessor) { - PrimitiveAccessor pa = (PrimitiveAccessor) own.obj; - return pa.getValue().toString(); - } else if (own.obj instanceof RefValue) { - RefValue refValue = (RefValue) own.obj; - return refValue.getRef(); - } else { - if (log.isTraceEnabled()) { - log.warn("Not a Primitive accessor neither a ref Value : " - + own.obj.toString() - + " and class : " - + own.obj.getClass().toString()); - } - return own.obj.toString(); - } - default: - return getText(obj); - } - } else { - return getText(obj); - } - } - - public Image getColumnImage(Object obj, int index) { - return null; - } - - } - - // We add an inner class to enrich the ExecutionSpecAttribute with a name - // so that we can display it. - public class ObjectWithName { - public Object obj; - public String name; - - public ObjectWithName(String name, Object obj) { - this.name = name; - this.obj = obj; - } - } -} \ No newline at end of file diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultDetailView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultDetailView.java deleted file mode 100644 index 840f31d68..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultDetailView.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.argeo.slc.client.ui.views; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.dao.test.tree.TreeTestResultDao; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.part.ViewPart; - -/** - * Multi-instance view that enables to browse the details of a given - * TreeTestResult - * - * @author bsinou - * - */ - -public class ResultDetailView extends ViewPart { - private final static Log log = LogFactory.getLog(ResultDetailView.class); - public static final String ID = "org.argeo.slc.client.ui.resultDetailView"; - - protected String[] columnNames = new String[] { "Test", "Message", - "Exception Msg" }; - - private TreeViewer viewer; - private Tree resultDetailTree; - - private String uuid; - private TreeTestResult ttr; - - // IoC - private IContentProvider contentProvider; - private ITableLabelProvider labelProvider; - private TreeTestResultDao treeTestResultDao; - - public void createPartControl(Composite parent) { - resultDetailTree = new Tree(parent, SWT.MULTI | SWT.H_SCROLL - | SWT.V_SCROLL); - // GridData gd = new GridData(GridData.FILL_HORIZONTAL); - // gd.horizontalSpan = 3; - // resultDetailTree.setLayoutData(gd); - resultDetailTree.setLinesVisible(true); - resultDetailTree.setHeaderVisible(true); - - for (int i = 0; i < columnNames.length; i++) { - TreeColumn column = new TreeColumn(resultDetailTree, SWT.LEFT, i); - column.setText(columnNames[i]); - - // TIP: Don't forget to set the width. If not set it is set to - // 0 and it will look as if the column didn't exist. - switch (i) { - case 0: - column.setWidth(180); - break; - case 1: - column.setWidth(150); - break; - case 2: - column.setWidth(150); - break; - default: - column.setWidth(70); - } - } - viewer = new TreeViewer(resultDetailTree); - viewer.setColumnProperties(columnNames); - - viewer.setContentProvider(contentProvider); - // viewer.setLabelProvider(new ResultDetailLabelProvider()); - if (log.isTraceEnabled()) - log.debug("Injected LabelProvider :" + labelProvider.toString()); - - // TIP: It seems, that if the table has not defined any TreeColumns then - // a plain LabelProvider will be used. Since, we don't provide an - // instance of LabelProvider, a default one will be used and - // the TableLabelProvider is ignored without notice. Took me quite - // a while to find that one out. - viewer.setLabelProvider(labelProvider); - if (log.isTraceEnabled()) - log.debug("Persisted labelProvider :" - + viewer.getLabelProvider().toString()); - - // viewer.expandAll(); - - } - - public void setFocus() { - viewer.getControl().setFocus(); - } - - public TreeViewer getViewer() { - return viewer; - } - - public void retrieveResults() { - ttr = treeTestResultDao.getTestResult(uuid); - viewer.setInput(ttr); - // viewer.setInput(getViewSite()); - - // setFocus(); - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - // IoC - public void setContentProvider(IContentProvider contentProvider) { - this.contentProvider = contentProvider; - } - - public void setLabelProvider(ITableLabelProvider labelProvider) { - this.labelProvider = labelProvider; - } - - public void setTreeTestResultDao(TreeTestResultDao treeTestResultDao) { - this.treeTestResultDao = treeTestResultDao; - } - -} \ No newline at end of file diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java deleted file mode 100644 index cf83ebf01..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java +++ /dev/null @@ -1,455 +0,0 @@ -package org.argeo.slc.client.ui.views; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.ArgeoException; -import org.argeo.eclipse.ui.GenericTableComparator; -import org.argeo.slc.SlcException; -import org.argeo.slc.client.ui.ClientUiPlugin; -import org.argeo.slc.client.ui.commands.RemoveSelectedResultFromResultList; -import org.argeo.slc.client.ui.commands.ResultDetailsDisplayHandler; -import org.argeo.slc.core.test.tree.ResultAttributes; -import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao; -import org.eclipse.core.commands.Command; -import org.eclipse.core.commands.IParameter; -import org.eclipse.core.commands.Parameterization; -import org.eclipse.core.commands.ParameterizedCommand; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.commands.ICommandService; -import org.eclipse.ui.handlers.IHandlerService; -import org.eclipse.ui.menus.CommandContributionItem; -import org.eclipse.ui.menus.CommandContributionItemParameter; -import org.eclipse.ui.part.ViewPart; -import org.eclipse.ui.services.IServiceLocator; - -public class ResultListView extends ViewPart { - private final static Log log = LogFactory.getLog(ResultListView.class); - - public static final String ID = "org.argeo.slc.client.ui.resultListView"; - - // TODO : remove dependency from SLC on Sparta - private final static String DISPLAY_AS_XLS_CMD_ID = "com.capco.sparta.client.ui.displayResultDetailsWithExcel"; - private final static String SAVE_AS_XLS_CMD_ID = "com.capco.sparta.client.ui.saveResultAsExcelFile"; - - private final static String PLATFORM = SWT.getPlatform(); - - private final static String DISPLAY_CMD_ID = ResultDetailsDisplayHandler.ID; - private final static String REMOVE_CMD_ID = RemoveSelectedResultFromResultList.ID; -// private final static String UUID_PARAM_ID = "org.argeo.slc.client.commands.resultUuid"; -// private final static String NAME_PARAM_ID = "org.argeo.slc.client.commands.resultName"; - - private final static SimpleDateFormat dateFormatter = new SimpleDateFormat( - "MM/dd/yy', 'HH:mm:ss"); - - private TableViewer viewer; - private TreeTestResultCollectionDao testResultCollectionDao; - - private CurrentTableComparator comparator; - - private ResultAttributes selectedRa; - - // handle locally which result are shown or not - private List removedResults = new ArrayList(); - - public void createPartControl(Composite parent) { - Table table = createTable(parent); - viewer = new TableViewer(table); - viewer.setLabelProvider(new ViewLabelProvider()); - viewer.setContentProvider(new ViewContentProvider()); - viewer.setInput(getViewSite()); - viewer.addDoubleClickListener(new ViewDoubleClickListener()); - viewer.addSelectionChangedListener(new SelectionChangedListener()); - - // Initializes sort mecanism - // by default we sort by date asc - comparator = new CurrentTableComparator(1, - GenericTableComparator.ASCENDING); - viewer.setComparator(comparator); - - // create the context menu - MenuManager menuManager = new MenuManager(); - Menu menu = menuManager.createContextMenu(viewer.getControl()); - menuManager.addMenuListener(new IMenuListener() { - public void menuAboutToShow(IMenuManager manager) { - contextMenuAboutToShow(manager); - } - }); - - viewer.getControl().setMenu(menu); - getSite().registerContextMenu(menuManager, viewer); - } - - protected Table createTable(Composite parent) { - int style = SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL - | SWT.FULL_SELECTION; - // does not function with RAP, commented for the moment being - // | SWT.HIDE_SELECTION; - - Table table = new Table(parent, style); - // table.addMouseListener(new RightClickListener()); - // GridData gridData = new GridData(GridData.FILL_BOTH); - // gridData.grabExcessVerticalSpace = true; - // gridData.grabExcessHorizontalSpace = true; - // gridData.horizontalSpan = 3; - // table.setLayoutData(gridData); - - table.setLinesVisible(true); - table.setHeaderVisible(true); - - TableColumn column = new TableColumn(table, SWT.LEFT, 0); - column.setText("Test Case"); - column.setWidth(200); - column.addSelectionListener(getSelectionAdapter(column, 0)); - - column = new TableColumn(table, SWT.LEFT, 1); - column.setText("Close Date"); - column.setWidth(130); - column.addSelectionListener(getSelectionAdapter(column, 1)); - - column = new TableColumn(table, SWT.LEFT, 2); - column.setText("UUID"); - column.setWidth(300); - column.addSelectionListener(getSelectionAdapter(column, 2)); - - return table; - } - - // Manage list of the result - public void setFocus() { - viewer.getControl().setFocus(); - } - - /** Initialize the view **/ - public void retrieveResults() { - try { - List lst = testResultCollectionDao - .listResultAttributes(null); - if (log.isTraceEnabled()) - log.trace("Result attributes count: " + lst.size()); - - // handle removed result from the list locally - // Might be optimised. - Iterator it = removedResults.iterator(); - removeResult: while (it.hasNext()) { - ResultAttributes curRa = it.next(); - String curRaId = curRa.getUuid(); - for (Iterator it2 = lst.iterator(); it2 - .hasNext();) { - ResultAttributes tmpRa = it2.next(); - if (tmpRa.getUuid().equals(curRaId)) { - lst.remove(tmpRa); - continue removeResult; - } - } - if (lst.contains(curRa)) - lst.remove(curRa); - } - viewer.setInput(lst); - } catch (Exception e) { - throw new ArgeoException("Cannot refresh the result List", e); - } - } - - public List getSelectedResultsId() { - List resultIds = new ArrayList(); - IStructuredSelection curSelection = (IStructuredSelection) viewer - .getSelection(); - Iterator it = curSelection.iterator(); - while (it.hasNext()) { - ResultAttributes curResult = (ResultAttributes) it.next(); - resultIds.add(curResult.getUuid()); - } - return resultIds; - } - - /** - * Remove selected items from the result list. This process is handled - * locally in the UI side : trying to handle that on the server side throws - * HibernateLazyInit exception, especially when trying to access - * TreeTestResultCollection items. - */ - public void removeSelected() { - IStructuredSelection curSelection = (IStructuredSelection) viewer - .getSelection(); - Iterator it = curSelection.iterator(); - while (it.hasNext()) { - ResultAttributes curResult = (ResultAttributes) it.next(); - if (!removedResults.contains(curResult)) - removedResults.add(curResult); - } - retrieveResults(); - } - - // View Specific inner class - - // Handle Events - class SelectionChangedListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent evt) { - - IStructuredSelection curSelection = (IStructuredSelection) evt - .getSelection(); - Object obj = curSelection.getFirstElement(); - - if (obj instanceof ResultAttributes) { - selectedRa = (ResultAttributes) obj; - } - } - } - - // Relatively useless in the current case. - // Yet we keep it as sample code to show how we can implement a context menu - // which commands are dynamically linked to the selected item of a control - protected void refreshCommand(IMenuManager menuManager, - IServiceLocator locator, String cmdId, String label, String iconPath) { - IContributionItem ici = menuManager.find(cmdId); - if (ici != null) - menuManager.remove(ici); - CommandContributionItemParameter contributionItemParameter = new CommandContributionItemParameter( - locator, null, cmdId, SWT.PUSH); - - // Set Params - contributionItemParameter.label = label; - contributionItemParameter.icon = ClientUiPlugin - .getImageDescriptor(iconPath); - - - // if (!REMOVE_CMD_ID.equals(cmdId)) { - // Map params = new HashMap(); - // params.put(UUID_PARAM_ID, selectedRa.getUuid()); - // params.put(NAME_PARAM_ID, - // (selectedRa.getAttributes().get("testCase") == null) ? null - // : selectedRa.getAttributes().get("testCase")); - // contributionItemParameter.parameters = params; - // } - - CommandContributionItem cci = new CommandContributionItem( - contributionItemParameter); - cci.setId(cmdId); - menuManager.add(cci); - } - - /** - * Defines the commands that will pop up in the context menu. Might be - * overriden by user to add or remove certain commands. - **/ - protected void contextMenuAboutToShow(IMenuManager menuManager) { - - IWorkbenchWindow window = ClientUiPlugin.getDefault().getWorkbench() - .getActiveWorkbenchWindow(); - - refreshCommand(menuManager, window, DISPLAY_CMD_ID, - "Display selected as tree", "icons/result_details.gif"); - // We only show this command on windows OS - if (PLATFORM.equals("win32") || PLATFORM.equals("wpf")) { - refreshCommand(menuManager, window, DISPLAY_AS_XLS_CMD_ID, - "Display selected with Excel", "icons/excel.png"); - } - refreshCommand(menuManager, window, SAVE_AS_XLS_CMD_ID, - "Save selected as Excel files", "icons/excel.png"); - - refreshCommand(menuManager, window, REMOVE_CMD_ID, "Remove selected", - "icons/removeAll.png"); - - } - - // Providers - protected static class ViewContentProvider implements - IStructuredContentProvider { - - public void inputChanged(Viewer arg0, Object arg1, Object arg2) { - } - - public void dispose() { - } - - @SuppressWarnings("unchecked") - public Object[] getElements(Object obj) { - if (obj instanceof List) { - return ((List) obj).toArray(); - } else { - return new Object[0]; - } - } - } - - protected class ViewLabelProvider extends LabelProvider implements - ITableLabelProvider { - public String getColumnText(Object obj, int index) { - ResultAttributes ra = (ResultAttributes) obj; - switch (index) { - case 0: - return (ra.getAttributes().get("testCase") == null) ? null : ra - .getAttributes().get("testCase"); - case 1: - // otherwise we get null pointer exception when the test is not - // closed yet. - return (ra.getCloseDate() == null) ? null : dateFormatter - .format(ra.getCloseDate()); - case 2: - return ra.getUuid(); - } - return getText(obj); - } - - public Image getColumnImage(Object obj, int index) { - return null; - } - - } - - // Sort Mecanism - private class CurrentTableComparator extends GenericTableComparator { - - public CurrentTableComparator(int colIndex, int direction) { - super(colIndex, direction); - } - - @Override - public int compare(Viewer viewer, Object r1, Object r2) { - - int rc = 0; - ResultAttributes ra1 = (ResultAttributes) r1; - ResultAttributes ra2 = (ResultAttributes) r2; - - switch (propertyIndex) { - case 0: - if (ra1.getAttributes().get("testCase") == null) - rc = -1; - else if (ra2.getAttributes().get("testCase") == null) - rc = 1; - else - rc = ra1.getAttributes().get("testCase") - .compareTo(ra2.getAttributes().get("testCase")); - break; - case 1: - // result with close date == null are put at the end : either - // they are nor finished or in error - if (ra1.getCloseDate() == null) - rc = 1; - else if (ra2.getCloseDate() == null) - rc = -1; - else - rc = ra1.getCloseDate().compareTo(ra2.getCloseDate()); - break; - case 2: - rc = ra1.getUuid().compareTo(ra2.getUuid()); - break; - } - - if (direction == DESCENDING) { - rc = -rc; - } - return rc; - } - } - - private SelectionAdapter getSelectionAdapter(final TableColumn column, - final int index) { - - SelectionAdapter selectionAdapter = new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - - comparator.setColumn(index); - int dir = viewer.getTable().getSortDirection(); - if (viewer.getTable().getSortColumn() == column) { - dir = dir == SWT.UP ? SWT.DOWN : SWT.UP; - } else { - dir = SWT.DOWN; - } - viewer.getTable().setSortDirection(dir); - viewer.getTable().setSortColumn(column); - viewer.refresh(); - } - }; - return selectionAdapter; - } - - // Handle Events - - /** - * The ResultAttributes expose a part of the information contained in the - * TreeTestResult, It has the same UUID as the corresponding treeTestResult. - */ - class ViewDoubleClickListener implements IDoubleClickListener { - public void doubleClick(DoubleClickEvent evt) { - Object obj = ((IStructuredSelection) evt.getSelection()) - .getFirstElement(); - - if (obj instanceof ResultAttributes) { - ResultAttributes ra = (ResultAttributes) obj; - IWorkbench iw = ClientUiPlugin.getDefault().getWorkbench(); - IHandlerService handlerService = (IHandlerService) iw - .getService(IHandlerService.class); - try { - // get the command from plugin.xml - IWorkbenchWindow window = iw.getActiveWorkbenchWindow(); - ICommandService cmdService = (ICommandService) window - .getService(ICommandService.class); - Command cmd = cmdService - .getCommand("org.argeo.slc.client.ui.displayResultDetails"); - - // log.debug("cmd : " + cmd); - ArrayList parameters = new ArrayList(); - - // get the parameter - IParameter iparam = cmd - .getParameter("org.argeo.slc.client.commands.resultUuid"); - - Parameterization params = new Parameterization(iparam, - ra.getUuid()); - parameters.add(params); - - // build the parameterized command - ParameterizedCommand pc = new ParameterizedCommand(cmd, - parameters.toArray(new Parameterization[parameters - .size()])); - - // execute the command - handlerService = (IHandlerService) window - .getService(IHandlerService.class); - handlerService.executeCommand(pc, null); - - } catch (Exception e) { - e.printStackTrace(); - throw new SlcException("Problem while rendering result. " - + e.getMessage()); - } - } - } - } - - // IoC - public void setTestResultCollectionDao( - TreeTestResultCollectionDao testResultCollectionDao) { - this.testResultCollectionDao = testResultCollectionDao; - } -} diff --git a/eclipse/pom.xml b/eclipse/pom.xml index 39e990a6a..96fff67cf 100644 --- a/eclipse/pom.xml +++ b/eclipse/pom.xml @@ -11,8 +11,6 @@ SLC Eclipse pom - runtime - modules plugins \ No newline at end of file diff --git a/eclipse/runtime/org.argeo.slc.client.core/.classpath b/eclipse/runtime/org.argeo.slc.client.core/.classpath deleted file mode 100644 index 92f19d2ff..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/eclipse/runtime/org.argeo.slc.client.core/.project b/eclipse/runtime/org.argeo.slc.client.core/.project deleted file mode 100644 index 83312680f..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.argeo.slc.client.core - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/eclipse/runtime/org.argeo.slc.client.core/.settings/org.eclipse.jdt.core.prefs b/eclipse/runtime/org.argeo.slc.client.core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 91bcc67af..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Tue Sep 28 09:36:19 CEST 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/eclipse/runtime/org.argeo.slc.client.core/.settings/org.eclipse.pde.core.prefs b/eclipse/runtime/org.argeo.slc.client.core/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index bcfe289e2..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Wed Sep 22 12:21:25 CEST 2010 -eclipse.preferences.version=1 -pluginProject.extensions=false -resolve.requirebundle=false diff --git a/eclipse/runtime/org.argeo.slc.client.core/META-INF/MANIFEST.MF b/eclipse/runtime/org.argeo.slc.client.core/META-INF/MANIFEST.MF deleted file mode 100644 index a79376c48..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/META-INF/MANIFEST.MF +++ /dev/null @@ -1,28 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Core -Bundle-SymbolicName: org.argeo.slc.client.core -Bundle-Version: 0.13.1.SNAPSHOT -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Export-Package: org.argeo.slc.client.aspects, - org.argeo.slc.client.contentprovider -Require-Bundle: org.springframework.orm;bundle-version="2.5.6", - org.eclipse.ui;resolution:=optional, - org.eclipse.rap.ui;resolution:=optional -Import-Package: org.apache.commons.io;version="1.4.0", - org.apache.commons.logging;version="1.1.1", - org.argeo.eclipse.spring, - org.argeo.eclipse.ui, - org.argeo.slc.client.ui, - org.argeo.slc.core.structure.tree, - org.argeo.slc.core.test.tree, - org.argeo.slc.dao.process, - org.argeo.slc.dao.test.tree, - org.argeo.slc.process, - org.argeo.slc.test, - org.aspectj.lang, - org.aspectj.lang.annotation, - org.hibernate, - org.hibernate.classic, - org.springframework.beans.factory;version="2.5.6.SEC01", - org.springframework.transaction;version="2.5.6.SEC01" diff --git a/eclipse/runtime/org.argeo.slc.client.core/build.properties b/eclipse/runtime/org.argeo.slc.client.core/build.properties deleted file mode 100644 index 5fc538bc8..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -source.. = src/main/java/ -output.. = target/classes/ -bin.includes = META-INF/,\ - . diff --git a/eclipse/runtime/org.argeo.slc.client.core/pom.xml b/eclipse/runtime/org.argeo.slc.client.core/pom.xml deleted file mode 100644 index 54dc62515..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - 4.0.0 - - org.argeo.slc.eclipse - runtime - 0.13.1-SNAPSHOT - .. - - org.argeo.slc.client.core - SLC Eclipse Core - jar - - - - org.argeo.commons.eclipse - org.argeo.eclipse.ui - ${version.argeo-commons} - - - - - org.argeo.commons.eclipse - org.argeo.eclipse.dep.rcp - ${version.argeo-commons} - provided - - - - - org.argeo.slc.runtime - org.argeo.slc.core - ${version.slc} - - - - org.springframework - org.springframework.context - - - org.springframework - org.springframework.transaction - - - org.springframework - org.springframework.orm - - - - - - org.hibernate - com.springsource.org.hibernate - - - - org.aspectj - com.springsource.org.aspectj.runtime - - - diff --git a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/aspects/ContentProviderAspect.java b/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/aspects/ContentProviderAspect.java deleted file mode 100644 index 810922707..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/aspects/ContentProviderAspect.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.argeo.slc.client.aspects; - -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; -import org.hibernate.LockMode; -import org.hibernate.SessionFactory; - -/** - * Intercepts all calls to get methods of the - * org.argeo.slc.client.contentprovider package to insure that objects that are - * to be rendered in views are correctly linked to the hibernate session. - * - * @author bsinou - * - */ - -@Aspect -public class ContentProviderAspect { - - // private final static Log log = LogFactory - // .getLog(ContentProviderAspect.class); - - private SessionFactory sessionFactory; - - // We select here only getters from classes of the contentprovider package - // that need to get data from hibernate - - // PointCuts - @Pointcut("(execution (* org.argeo.slc.client.contentprovider.ProcessListTableLabelProvider.get*(..)) && args(o,..))" - + " || (execution (* org.argeo.slc.client.contentprovider.ProcessDetailContentProvider.get*(..)) && args(o,..))" - + " || (execution (* org.argeo.slc.client.contentprovider.ResultDetailContentProvider.getElements(..)) && args(o,..))") - void contentProviderGetterWrapper(Object o) { - } - - // Advices - @Around("contentProviderGetterWrapper(o)") - public Object aroundGetWrapper(ProceedingJoinPoint thisJoinPoint, Object o) - throws Throwable { - - // if (o instanceof ViewSite) { - // return thisJoinPoint.proceed(); - // } - - // TODO : find a mean to handle session & manager with txManager - // in order to not have to re-begin a transaction here. - sessionFactory.getCurrentSession().beginTransaction(); - - // reassociate a transient instance with a session (LockMode.NONE). - sessionFactory.getCurrentSession().lock(o, LockMode.NONE); - - Object result = thisJoinPoint.proceed(); - sessionFactory.getCurrentSession().getTransaction().commit(); - return result; - } - - // IoC - public void setSessionFactory(SessionFactory sessionFactory) { - this.sessionFactory = sessionFactory; - } -} diff --git a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessDetailContentProvider.java b/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessDetailContentProvider.java deleted file mode 100644 index 497e29851..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessDetailContentProvider.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.argeo.slc.client.contentprovider; - -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.slc.process.RealizedFlow; -import org.argeo.slc.process.SlcExecution; -import org.argeo.slc.process.SlcExecutionStep; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; - -/** - * Basic tree view of the chosen process details. For now, only a basic list of - * details is displayed, not a tree. - */ -public class ProcessDetailContentProvider implements ITreeContentProvider { - private final static Log log = LogFactory - .getLog(ProcessDetailContentProvider.class); - - private SlcExecution slcExecution; - - // private List slcAgents; - - public Object[] getChildren(Object parent) { - if (parent instanceof SlcExecution) { - slcExecution = (SlcExecution) parent; - - List steps = slcExecution.getSteps(); - List realizedFlows = slcExecution.getRealizedFlows(); - - for (int i = 0; i < steps.size(); i++) { - log.debug("step[" + i + "] : " + steps.get(i).getType()); - } - for (int i = 0; i < realizedFlows.size(); i++) { - log.debug("step[" + i + "] : " - + realizedFlows.get(i).toString()); - } - - log.debug(" Realized flows : "); - return steps.toArray(); - } - // if (parent instanceof ExecutionModuleNode) { - // ExecutionModuleNode executionModuleNode = (ExecutionModuleNode) - // parent; - // ExecutionModuleDescriptor emd = - // executionModuleNode.getDescriptor(); - // emd = executionModuleNode.getAgentNode().getAgent() - // .getExecutionModuleDescriptor(emd.getName(), - // emd.getVersion()); - // executionModuleNode.cacheDescriptor(emd); - // // for (String flowName : - // executionModuleNode.getFlowDescriptors() - // // .keySet()) { - // // executionModuleNode.addChild(new FlowNode(flowName, - // // executionModuleNode)); - // // } - // return executionModuleNode.getChildren(); - // } else if (parent instanceof AgentNode) { - // AgentNode agentNode = (AgentNode) parent; - // - // if (log.isTraceEnabled()) - // log.trace("Scan agent " + agentNode); - // - // agentNode.clearChildren(); - // for (ExecutionModuleDescriptor desc : agentNode.getAgent() - // .listExecutionModuleDescriptors()) { - // agentNode.addChild(new ExecutionModuleNode(agentNode, desc)); - // } - // - // return agentNode.getChildren(); - // } else if (parent instanceof TreeParent) { - // return ((TreeParent) parent).getChildren(); - // } else if (parent instanceof FlowNode) { - // return new Object[0]; - // } else { - // List agentNodes = new ArrayList(); - // for (SlcAgent slcAgent : slcAgents) { - // agentNodes.add(new AgentNode(slcAgent)); - // } - // return agentNodes.toArray(); - // } - return null; - } - - public Object getParent(Object node) { - // if (node instanceof TreeObject) { - // return ((TreeObject) node).getParent(); - // } - return null; - } - - public boolean hasChildren(Object parent) { - return false; - } - - public void inputChanged(Viewer v, Object oldInput, Object newInput) { - } - - public void dispose() { - } - - public Object[] getElements(Object parent) { - // return getChildren(parent); - // Here we must duplicate the code otherwise the inner call to method - // getChildren(parent); is not intercepted by AspectJ - if (parent instanceof SlcExecution) { - slcExecution = (SlcExecution) parent; - - List steps = slcExecution.getSteps(); - List realizedFlows = slcExecution.getRealizedFlows(); - - for (int i = 0; i < steps.size(); i++) { - log.debug("step[" + i + "] : " + steps.get(i).getType()); - } - for (int i = 0; i < realizedFlows.size(); i++) { - log.debug("step[" + i + "] : " - + realizedFlows.get(i).toString()); - } - - log.debug(" Realized flows : "); - return steps.toArray(); - } - return null; - } -} diff --git a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessListStructuredContentProvider.java b/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessListStructuredContentProvider.java deleted file mode 100644 index eecf749a1..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessListStructuredContentProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.argeo.slc.client.contentprovider; - -import java.util.List; - -import org.argeo.slc.process.SlcExecution; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.Viewer; - -/** - * @author bsinou - * - * Fill ProcessList view. Deported in an external bundle so that main - * slc ui bundle does not depend on DB implementation. - */ -public class ProcessListStructuredContentProvider implements - IStructuredContentProvider { - - public void inputChanged(Viewer arg0, Object arg1, Object arg2) { - } - - public void dispose() { - } - - @SuppressWarnings("unchecked") - public Object[] getElements(Object obj) { - if (obj instanceof List) { - return ((List) obj).toArray(); - } else { - return new Object[0]; - } - } - - public String getColumnText(Object obj, int index) { - return null; - } - -} diff --git a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessListTableLabelProvider.java b/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessListTableLabelProvider.java deleted file mode 100644 index 049128389..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessListTableLabelProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.argeo.slc.client.contentprovider; - -import org.argeo.slc.process.SlcExecution; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; - -/** - * @author bsinou - * - * Fill ProcessList view. Deported in an external bundle so that main - * slc ui bundle does not depend on DB implementation. - */ -public class ProcessListTableLabelProvider extends LabelProvider implements - ITableLabelProvider { - public String getColumnText(Object obj, int index) { - // log.debug(sessionFactory.getClass().toString()); - - SlcExecution se = (SlcExecution) obj; - switch (index) { - - case 0: - return getText(se.getStartDate()); - case 1: - return se.getHost(); - case 2: - return se.getUuid(); - case 3: - return se.currentStep().getType(); - } - return getText(obj); - } - - public Image getColumnImage(Object obj, int index) { - return null; - } - -} diff --git a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ResultDetailContentProvider.java b/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ResultDetailContentProvider.java deleted file mode 100644 index f04ba5672..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ResultDetailContentProvider.java +++ /dev/null @@ -1,231 +0,0 @@ -package org.argeo.slc.client.contentprovider; - -import java.util.List; -import java.util.SortedMap; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.eclipse.ui.TreeParent; -import org.argeo.slc.core.structure.tree.TreeSPath; -import org.argeo.slc.core.test.tree.PartSubList; -import org.argeo.slc.core.test.tree.TreeTestResult; -import org.argeo.slc.test.TestResultPart; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; - -/** - * Basic tree view of the chosen process details - */ -public class ResultDetailContentProvider implements ITreeContentProvider { - private final static Log log = LogFactory - .getLog(ResultDetailContentProvider.class); - - private TreeTestResult treeTestResult; - - public Object[] getChildren(Object parent) { - if (parent instanceof TreeTestResult) { - if (log.isErrorEnabled()) - log.error("Trying to get children for parent object of type TreeTestResult. " - + "We should not reach this point."); - return null; - } - - if (parent instanceof TreeParent) { - return ((TreeParent) parent).getChildren(); - } - - if (parent instanceof ResultPartNode) { - // we reached a leaf - return null; - } - return null; - } - - public Object getParent(Object node) { - if (node instanceof TreeParent) { - return ((TreeParent) node).getParent(); - } - return null; - } - - public boolean hasChildren(Object parent) { - if (parent instanceof TreeParent && ((TreeParent) parent).isLoaded()) { - return ((TreeParent) parent).hasChildren(); - } - return false; - } - - public void inputChanged(Viewer v, Object oldInput, Object newInput) { - } - - public void dispose() { - } - - public Object[] getElements(Object parent) { - if (parent instanceof TreeTestResult) { - treeTestResult = (TreeTestResult) parent; - - // We wrap domain object in ViewSpecificObjects. - ResultTreeParent root = new ResultTreeParent("Test " - + treeTestResult.getUuid()); - SortedMap partSubLists = treeTestResult - .getResultParts(); - - for (TreeSPath key : partSubLists.keySet()) { - String relPath = key.getAsUniqueString(); - - // get rid of '/' that begins every TreeSPath Unique string - relPath = relPath.substring(1); - String[] pathes = relPath.split("/"); // parse the TreeSPath - ResultTreeParent curTreeParent = root; - - // We create intermediate folders if needed - for (int i = 0; i < pathes.length; i++) { - // if (log.isDebugEnabled()) - // log.debug("i = " + i + " - " + pathes[i]); - - if (curTreeParent.getChildByName(pathes[i]) == null) { - ResultTreeParent child = new ResultTreeParent(pathes[i]); - curTreeParent.addChild(child); - curTreeParent = child; - } else - curTreeParent = (ResultTreeParent) curTreeParent - .getChildByName(pathes[i]); - } - - // We create leafs - List parts = partSubLists.get(key).getParts(); - for (TestResultPart part : parts) { - ResultPartNode node = new ResultPartNode(part.toString(), - part.getStatus(), part.getMessage(), - part.getExceptionMessage()); - curTreeParent.addChild(node); - } - } - - // We must set status isPassed for each node. - setIsPassed(root); - return root.getChildren(); - } - return null; - } - - public void setIsPassed(StatusAware node) { - - if (node instanceof ResultTreeObject) { - ResultTreeObject rto = (ResultTreeObject) node; - rto.isPassed = rto.isPassed(); - return; - } - if (node instanceof ResultTreeParent) { - ResultTreeParent rtp = (ResultTreeParent) node; - // we dig the tree recursivly - for (Object to : rtp.getChildren()) - setIsPassed((StatusAware) to); - // we set is passed - for (Object to : rtp.getChildren()) { - if (!((StatusAware) to).isPassed()) { - rtp.isPassed = false; - return; - } - } - return; - } - } - - // To enable display of color to show if a test is passed or not even when - // hidden. We say a test is in error if its status is FAILED or ERROR (e.g, - // if it has not executed completely due to technical problems). - public interface StatusAware { - public void setPassed(boolean isPassed); - - public boolean isPassed(); - } - - public class ResultTreeParent extends TreeParent implements StatusAware { - - public ResultTreeParent(String name) { - super(name); - } - - private boolean isPassed = true; - - public void setPassed(boolean isPassed) { - this.isPassed = isPassed; - } - - public boolean isPassed() { - return isPassed; - } - } - - public class ResultTreeObject extends TreeParent implements StatusAware { - - public ResultTreeObject(String name) { - super(name); - } - - private boolean isPassed = true; - - public void setPassed(boolean isPassed) { - this.isPassed = isPassed; - } - - public boolean isPassed() { - return isPassed; - } - } - - // Specific inner classes - public class ResultPartNode extends ResultTreeObject { - - private String status; - private String message; - private String exceptionMessage; - - public ResultPartNode(String label, Integer status, String message) { - super(label); - log.debug("Creating new leaf with label : " + label); - handleStatus(status); - this.message = message; - } - - public ResultPartNode(String label, Integer status, String message, - String exceptionMessage) { - super(label); - handleStatus(status); - this.message = message; - this.exceptionMessage = exceptionMessage; - } - - private void handleStatus(Integer status) { - switch (status) { - case 0: - this.status = "PASSED"; - setPassed(true); - break; - case 1: - this.status = "FAILED"; - setPassed(false); - break; - case 2: - this.status = "ERROR"; - setPassed(false); - break; - } - // for the moment being we don't have a relevant label - } - - public String getStatus() { - return status; - } - - public String getMessage() { - return message; - } - - public String getExceptionMessage() { - return exceptionMessage; - } - } -} diff --git a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ResultDetailLabelProvider.java b/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ResultDetailLabelProvider.java deleted file mode 100644 index 137ede440..000000000 --- a/eclipse/runtime/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ResultDetailLabelProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.argeo.slc.client.contentprovider; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.eclipse.ui.TreeParent; -import org.argeo.slc.client.contentprovider.ResultDetailContentProvider.ResultPartNode; -import org.argeo.slc.client.contentprovider.ResultDetailContentProvider.StatusAware; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; - -/** - * @author bsinou - * - * Fill ResultDetail view. Deported in an external bundle so that main - * slc ui bundle does not depend on DB implementation. - */ -public class ResultDetailLabelProvider extends LabelProvider implements - ITableLabelProvider { - private static final Log log = LogFactory - .getLog(ResultDetailLabelProvider.class); - - // TODO : find a solution to get the icons here. - // Images - // public final static Image FAILED = ClientUiPlugin.getImageDescriptor( - // "icons/failed.gif").createImage(); - // public final static Image PASSED = ClientUiPlugin.getImageDescriptor( - // "icons/passed.gif").createImage(); - - public String getColumnText(Object obj, int index) { - - if (obj instanceof ResultPartNode) { - ResultPartNode rpn = (ResultPartNode) obj; - switch (index) { - // case 0: - // if (log.isDebugEnabled()) - // log.debug("Get col text, index = 0 & rpn.toString=" - // + rpn.toString()); - // return rpn.toString(); - case 0: - return rpn.getStatus().toString(); - case 1: - return rpn.getMessage(); - case 2: - return rpn.getExceptionMessage(); - } - return getText(obj); - } - - if (obj instanceof TreeParent) { - if (index == 0) { - if (log.isDebugEnabled()) - log.debug("In GetTreeParent text, index = 0 & label =" - + ((TreeParent) obj).getName()); - - return ((TreeParent) obj).getName(); - } else - return null; - } - - return null; - } - - public Image getImage(Object element) { - if (element instanceof StatusAware) { - // Package use conflict problem when getting the icons, uncomment - // Images definition above and update Manifest to get it. - - // if (((StatusAware) element).isPassed()) - // return PASSED; - // else - // return FAILED; - } - return null; - } - - public Image getColumnImage(Object obj, int index) { - if (index == 0) - return getImage(obj); - else - return null; - } -} diff --git a/eclipse/runtime/org.argeo.slc.client.oxm/.classpath b/eclipse/runtime/org.argeo.slc.client.oxm/.classpath deleted file mode 100644 index 54b896ef3..000000000 --- a/eclipse/runtime/org.argeo.slc.client.oxm/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/eclipse/runtime/org.argeo.slc.client.oxm/.project b/eclipse/runtime/org.argeo.slc.client.oxm/.project deleted file mode 100644 index 02b4cb480..000000000 --- a/eclipse/runtime/org.argeo.slc.client.oxm/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.argeo.slc.client.oxm - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/eclipse/runtime/org.argeo.slc.client.oxm/META-INF/MANIFEST.MF b/eclipse/runtime/org.argeo.slc.client.oxm/META-INF/MANIFEST.MF deleted file mode 100644 index c744c3120..000000000 --- a/eclipse/runtime/org.argeo.slc.client.oxm/META-INF/MANIFEST.MF +++ /dev/null @@ -1,12 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Version: 0.13.1.SNAPSHOT -Bundle-Name: Test Bundle to solve use case issues -Bundle-SymbolicName: org.argeo.slc.client.oxm -Export-Package: org.argeo.slc.client.oxm -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.ui;resolution:=optional -Import-Package: org.argeo.slc, - org.springframework.core, - org.springframework.oxm, - org.springframework.xml.transform diff --git a/eclipse/runtime/org.argeo.slc.client.oxm/META-INF/spring/osgi.xml b/eclipse/runtime/org.argeo.slc.client.oxm/META-INF/spring/osgi.xml deleted file mode 100644 index 310890ebf..000000000 --- a/eclipse/runtime/org.argeo.slc.client.oxm/META-INF/spring/osgi.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - This bundle is a dummy one to try to solve issues on - the OSGI dep management - - - - - - - - - - - \ No newline at end of file diff --git a/eclipse/runtime/org.argeo.slc.client.oxm/META-INF/spring/oxm.xml b/eclipse/runtime/org.argeo.slc.client.oxm/META-INF/spring/oxm.xml deleted file mode 100644 index b1bc1f9bf..000000000 --- a/eclipse/runtime/org.argeo.slc.client.oxm/META-INF/spring/oxm.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/eclipse/runtime/org.argeo.slc.client.oxm/build.properties b/eclipse/runtime/org.argeo.slc.client.oxm/build.properties deleted file mode 100644 index 5fc538bc8..000000000 --- a/eclipse/runtime/org.argeo.slc.client.oxm/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -source.. = src/main/java/ -output.. = target/classes/ -bin.includes = META-INF/,\ - . diff --git a/eclipse/runtime/org.argeo.slc.client.oxm/pom.xml b/eclipse/runtime/org.argeo.slc.client.oxm/pom.xml deleted file mode 100644 index b153652d6..000000000 --- a/eclipse/runtime/org.argeo.slc.client.oxm/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - 4.0.0 - - org.argeo.slc.eclipse - runtime - 0.13.1-SNAPSHOT - .. - - org.argeo.slc.client.oxm - SLC Eclipse Oxm - jar - - - - - org.argeo.commons.eclipse - org.argeo.eclipse.dep.rcp - ${version.argeo-commons} - provided - - - - org.eclipse.core - org.eclipse.core.runtime - - - - - org.argeo.slc.runtime - org.argeo.slc.core - ${version.slc} - - - - - - org.springframework.ws - org.springframework.oxm - - - org.springframework.ws - org.springframework.xml - - - - diff --git a/eclipse/runtime/org.argeo.slc.client.oxm/src/main/java/org/argeo/slc/client/oxm/OxmBean.java b/eclipse/runtime/org.argeo.slc.client.oxm/src/main/java/org/argeo/slc/client/oxm/OxmBean.java deleted file mode 100644 index 5ea94d2b8..000000000 --- a/eclipse/runtime/org.argeo.slc.client.oxm/src/main/java/org/argeo/slc/client/oxm/OxmBean.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.argeo.slc.client.oxm; - -import org.argeo.slc.SlcException; -import org.springframework.oxm.Marshaller; -import org.springframework.oxm.Unmarshaller; -import org.springframework.xml.transform.StringResult; -import org.springframework.xml.transform.StringSource; - -public class OxmBean implements OxmInterface { - - private Marshaller marshaller; - private Unmarshaller unmarshaller; - - public void init() { - } - - public Object unmarshal(String result) { - Object res; - if (result == null) - throw new SlcException("Cannot unmarshall empty string "); - try { - res = unmarshaller.unmarshal(new StringSource(result)); - } catch (Exception e) { - throw new SlcException("Could not unmarshall " + result, e); - } - return res; - } - - public String marshal(Object graph) { - StringResult result = new StringResult(); - try { - marshaller.marshal(graph, result); - } catch (Exception e) { - throw new SlcException("Cannot Marshal object " + graph.toString() - + " - " + e); - } - return result.toString(); - } - - // IoC - public void setMarshaller(Marshaller marshaller) { - this.marshaller = marshaller; - } - - public void setUnmarshaller(Unmarshaller unmarshaller) { - this.unmarshaller = unmarshaller; - } -} diff --git a/eclipse/runtime/org.argeo.slc.client.oxm/src/main/java/org/argeo/slc/client/oxm/OxmInterface.java b/eclipse/runtime/org.argeo.slc.client.oxm/src/main/java/org/argeo/slc/client/oxm/OxmInterface.java deleted file mode 100644 index dd430106c..000000000 --- a/eclipse/runtime/org.argeo.slc.client.oxm/src/main/java/org/argeo/slc/client/oxm/OxmInterface.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.argeo.slc.client.oxm; - -public interface OxmInterface { - - public String marshal(Object graph); - - public Object unmarshal(String result); - -} diff --git a/eclipse/runtime/pom.xml b/eclipse/runtime/pom.xml deleted file mode 100644 index eed86db3b..000000000 --- a/eclipse/runtime/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - 4.0.0 - - org.argeo.slc - eclipse - 0.13.1-SNAPSHOT - - org.argeo.slc.eclipse - runtime - SLC Eclipse Runtime - pom - - org.argeo.slc.client.oxm - org.argeo.slc.client.core - - - - - . - - plugin.xml - META-INF/** - icons/** - - - - -