From: Bruno Sinou Date: Fri, 5 Nov 2010 17:27:52 +0000 (+0000) Subject: + Clean some code X-Git-Tag: argeo-slc-2.1.7~1127 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=53af7f3e924d388392d26dc13add1a20031acb82;hp=66987e290ce56f148b08d5cffd7025ba926ef2f3;p=gpl%2Fargeo-slc.git + Clean some code + reorganize perspective + add icons... git-svn-id: https://svn.argeo.org/slc/trunk@3850 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/icons/slc_execution_perspective.gif b/eclipse/plugins/org.argeo.slc.client.rcp/icons/slc_execution_perspective.gif new file mode 100644 index 000000000..b8ca14a8b Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.rcp/icons/slc_execution_perspective.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml b/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml index 8b78bb368..36f23ee95 100644 --- a/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml +++ b/eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml @@ -14,9 +14,10 @@ + id="org.argeo.slc.client.ui.perspectives.slcExecution" + icon="icons/slc_execution_perspective.gif"> - - - diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/OK.png b/eclipse/plugins/org.argeo.slc.client.ui/icons/OK.png deleted file mode 100644 index 04ab8b0be..000000000 Binary files a/eclipse/plugins/org.argeo.slc.client.ui/icons/OK.png and /dev/null differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/batch.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/batch.gif new file mode 100644 index 000000000..b8ca14a8b Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/batch.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/clear_batch.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/clear_batch.gif new file mode 100644 index 000000000..28a3785aa Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/clear_batch.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/edit_parameters.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/edit_parameters.gif new file mode 100644 index 000000000..94eedf6f9 Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/edit_parameters.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/error.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/error.gif new file mode 100644 index 000000000..64b438488 Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/error.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/execution_module.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/execution_module.gif new file mode 100644 index 000000000..983932fcc Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/execution_module.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/launch.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/launch.gif new file mode 100644 index 000000000..ec477ea43 Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/launch.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/passed.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/passed.gif new file mode 100644 index 000000000..23c97f09e Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/passed.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/passed.png b/eclipse/plugins/org.argeo.slc.client.ui/icons/passed.png new file mode 100644 index 000000000..04ab8b0be Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/passed.png differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/process_details.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/process_details.gif new file mode 100644 index 000000000..c81630a08 Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/process_details.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/processes.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/processes.gif new file mode 100644 index 000000000..364c0e70b Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/processes.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/processes.png b/eclipse/plugins/org.argeo.slc.client.ui/icons/processes.png new file mode 100644 index 000000000..364c0e70b Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/processes.png differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/remove_one.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/remove_one.gif new file mode 100644 index 000000000..2cd9c5444 Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/remove_one.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/result_details.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/result_details.gif new file mode 100644 index 000000000..4017f6dbd Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/result_details.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/results.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/results.gif new file mode 100644 index 000000000..0dc862cbd Binary files /dev/null and b/eclipse/plugins/org.argeo.slc.client.ui/icons/results.gif differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/sample.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/sample.gif deleted file mode 100644 index 34fb3c9d8..000000000 Binary files a/eclipse/plugins/org.argeo.slc.client.ui/icons/sample.gif and /dev/null differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/icons/slc-launch.gif b/eclipse/plugins/org.argeo.slc.client.ui/icons/slc-launch.gif deleted file mode 100644 index b8ca14a8b..000000000 Binary files a/eclipse/plugins/org.argeo.slc.client.ui/icons/slc-launch.gif and /dev/null differ diff --git a/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml b/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml index ed9362c46..b6f4dd1e0 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml +++ b/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml @@ -6,47 +6,54 @@ @@ -96,19 +103,6 @@ name="Result UUID"> - - - - - - @@ -155,16 +149,19 @@ locationURI="toolbar:org.argeo.slc.client.ui.processBuilderView"> diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/ClientUiPlugin.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/ClientUiPlugin.java index 805fdc2b0..7148f0f54 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/ClientUiPlugin.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/ClientUiPlugin.java @@ -75,10 +75,10 @@ public class ClientUiPlugin extends AbstractUIPlugin { reg.put("agent", getImageDescriptor("icons/computer.png")); reg.put("executionModule", getImageDescriptor("icons/archive.png")); reg.put("folder", getImageDescriptor("icons/folder.png")); - // reg.put("flow", getImageDescriptor("icons/slc-launch.gif")); reg.put("flow", getImageDescriptor("icons/system.png")); - reg.put("passedTest", getImageDescriptor("icons/OK.png")); - reg.put("failedTest", getImageDescriptor("icons/error.png")); + reg.put("processes", getImageDescriptor("icons/processes.gif")); + reg.put("passedTest", getImageDescriptor("icons/passed.gif")); + reg.put("failedTest", getImageDescriptor("icons/error.gif")); } public BundleContext getBundleContext() { diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/EditRealizedFlowDetailsHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/EditRealizedFlowDetailsHandler.java deleted file mode 100644 index f26e29f47..000000000 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/EditRealizedFlowDetailsHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.argeo.slc.client.ui.commands; - -import org.argeo.slc.client.oxm.OxmInterface; -import org.argeo.slc.client.ui.views.ProcessParametersView; -import org.argeo.slc.process.RealizedFlow; -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 - * - * Command handler to display and edit the attributes of a given - * Realizedflow. The corresponding RealizedFlow is passed via command - * parameters and unmarshalled with the oxmBean which is injected by - * Spring. - * - * Note thet passing an index of -1 will cause the reset of the View - * (used among others when removing processes from the batch). - */ - -public class EditRealizedFlowDetailsHandler extends AbstractHandler { - - // IoC - private OxmInterface oxmBean; - - public Object execute(ExecutionEvent event) throws ExecutionException { - // We pass Realized flow through command parameters as XML - String rfAsXml = event - .getParameter("org.argeo.slc.client.commands.realizedFlowAsXml"); - int index = new Integer( - event.getParameter("org.argeo.slc.client.commands.realizedFlowIndex")) - .intValue(); - try { - ProcessParametersView ppView = (ProcessParametersView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage() - .showView(ProcessParametersView.ID); - - if (index == -1) - ppView.setRealizedFlow(-1, null); - else { - RealizedFlow rf = (RealizedFlow) oxmBean.unmarshal(rfAsXml); - ppView.setRealizedFlow(index, rf); - - } - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - // IoC - public void setOxmBean(OxmInterface oxmBean) { - this.oxmBean = oxmBean; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/perspectives/SlcExecution.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/perspectives/SlcExecution.java index bb533cb76..f50ea1814 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/perspectives/SlcExecution.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/perspectives/SlcExecution.java @@ -11,28 +11,34 @@ public class SlcExecution implements IPerspectiveFactory { layout.setEditorAreaVisible(false); layout.setFixed(false); - IFolderLayout topLeft = layout.createFolder("topLeft", - IPageLayout.LEFT, 0.7f, editorArea); - topLeft.addView("org.argeo.slc.client.ui.executionModulesView"); + // Create the main ui layout + + // For a vertical split, the part on top gets the specified ratio of the + // current space and the part on bottom gets the rest. Likewise, for a + // horizontal split, the part at left gets the specified ratio of the + // current space. + IFolderLayout main = layout.createFolder("main", IPageLayout.RIGHT, + 0.3f, editorArea); + IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, + 0.3f, editorArea); + + IFolderLayout bottom = layout.createFolder("bottom", + IPageLayout.BOTTOM, 0.65f, "main"); IFolderLayout topRight = layout.createFolder("topRight", - IPageLayout.RIGHT, 0.3f, editorArea); - topRight.addView("org.argeo.slc.client.ui.resultListView"); - topRight.addPlaceholder("org.argeo.slc.client.ui.resultDetailView:UUID-*"); - - IFolderLayout bottomRight = layout.createFolder("bottomRight", - IPageLayout.BOTTOM, 0.6f, "topRight"); - bottomRight.addView("org.argeo.slc.client.ui.processListView"); - bottomRight - .addPlaceholder("org.argeo.slc.client.ui.processDetailView:UUID-*"); - - IFolderLayout bottomLeft = layout.createFolder("bottomLeft", - IPageLayout.BOTTOM, 0.6f, "topLeft"); - bottomLeft.addView("org.argeo.slc.client.ui.processBuilderView"); - IFolderLayout paramsEditor = layout.createFolder("paramsEditor", - IPageLayout.RIGHT, 0.6f, "bottomLeft"); - paramsEditor.addView("org.argeo.slc.client.ui.processParametersView"); + IPageLayout.RIGHT, 0.6f, "main"); + + // add the views to the corresponding place holder + left.addView("org.argeo.slc.client.ui.executionModulesView"); + left.addView("org.argeo.slc.client.ui.resultListView"); + + main.addView("org.argeo.slc.client.ui.processBuilderView"); + main.addPlaceholder("org.argeo.slc.client.ui.resultDetailView:UUID-*"); + main.addPlaceholder("org.argeo.slc.client.ui.processDetailView:UUID-*"); + + bottom.addView("org.argeo.slc.client.ui.processListView"); + topRight.addView("org.argeo.slc.client.ui.processParametersView"); } } diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java index 847463e83..7ca534e0f 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java @@ -11,17 +11,19 @@ import org.eclipse.jface.viewers.TextCellEditor; /** * - * @author bsinou * - * This class implements the ability to edit and save various type of + * 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 this EditingSupport is tightly coupled with both + * 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 the * processes in ProcessBuilderView as stored as an ordered list. + + @author bsinou + * */ public class ProcessParametersEditingSupport extends EditingSupport { diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessBuilderView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessBuilderView.java index e0e5aec16..5d62983f9 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessBuilderView.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessBuilderView.java @@ -17,10 +17,6 @@ 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.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.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; @@ -40,10 +36,7 @@ import org.eclipse.swt.layout.GridData; 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.PartInitException; import org.eclipse.ui.part.ViewPart; /** @@ -145,7 +138,7 @@ public class ProcessBuilderView extends ViewPart { // we clear the list realizedFlows = new ArrayList(); curSelectedRow = -1; - refreshParameterview(null); + refreshParameterview(); viewer.refresh(); } @@ -156,56 +149,30 @@ public class ProcessBuilderView extends ViewPart { else realizedFlows.remove(curSelectedRow); curSelectedRow = -1; - refreshParameterview(null); + refreshParameterview(); viewer.refresh(); } // calling this method with index =-1 will cause the reset of the view. - private void refreshParameterview(RealizedFlow rf) { - IWorkbench iw = ClientUiPlugin.getDefault().getWorkbench(); - IHandlerService handlerService = (IHandlerService) iw - .getService(IHandlerService.class); + private void refreshParameterview() { + // We choose to directly access the view rather than going through + // commands. + ProcessParametersView ppView; try { - // get the command from plugin.xml - IWorkbenchWindow window = iw.getActiveWorkbenchWindow(); - ICommandService cmdService = (ICommandService) window - .getService(ICommandService.class); - Command cmd = cmdService.getCommand(EDIT_CMD); - - ArrayList parameters = new ArrayList(); - - IParameter iparam; - Parameterization params; - - // The current index to be able to records changes on - // parameters - iparam = cmd.getParameter(INDEX_PARAM); - params = new Parameterization(iparam, - (new Integer(curSelectedRow)).toString()); - parameters.add(params); - - if (curSelectedRow != -1) { - // The current Realized flow marshalled as XML - String result = oxmBean.marshal(rf); - iparam = cmd.getParameter(FLOWASXML_PARAM); - params = new Parameterization(iparam, result); - 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()); + 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); } - } // Return the list of the processes to execute. @@ -274,7 +241,7 @@ public class ProcessBuilderView extends ViewPart { if (obj instanceof RealizedFlow) { RealizedFlow rf = (RealizedFlow) obj; curSelectedRow = realizedFlows.indexOf(rf); - refreshParameterview(rf); + refreshParameterview(); } } } @@ -320,7 +287,8 @@ public class ProcessBuilderView extends ViewPart { return false; RealizedFlow rf = (RealizedFlow) oxmBean.unmarshal(fdXml); realizedFlows.add(rf); - + curSelectedRow = realizedFlows.indexOf(rf); + refreshParameterview(); getViewer().refresh(); return true; }