]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Improve RCP
authorMathieu Baudier <mbaudier@argeo.org>
Fri, 6 Aug 2010 16:55:42 +0000 (16:55 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Fri, 6 Aug 2010 16:55:42 +0000 (16:55 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@3759 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

demo/site/org.argeo.slc.demo.log4j/log4j.properties
eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesContentProvider.java
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java

index 6b7f307ef62d1ce58ce21f86911b2b0ce7860f9f..339269ee5491c238aeb404d174d63924c5a166e9 100644 (file)
@@ -9,6 +9,8 @@ log4j.logger.org.argeo.slc.execution.SimpleExecutionSpec=DEBUG
 log4j.logger.org.argeo.security.mvc.ArgeoRememberMeServices=WARN
 log4j.logger.org.argeo.server.mvc=TRACE
 
+log4j.logger.org.argeo.slc.client=TRACE
+
 log4j.logger.org.argeo.slc.jms.JmsAgentProxy=TRACE
 #log4j.logger.org.argeo.slc.jms.JmsAgent=TRACE
 #log4j.logger.org.argeo.server.jcr.mvc.OpenSessionInViewJcrInterceptor=TRACE
index ddb16642ddab84b946a8e77cfd858636f998f326..fef65b567d1cf83cfe01ed4867c6396832b0b4bd 100644 (file)
@@ -17,6 +17,7 @@ Import-Package: org.apache.commons.logging;version="1.1.1",
  org.argeo.eclipse.ui,
  org.argeo.slc.build;version="0.13.0.SNAPSHOT-r3685",
  org.argeo.slc.core.runtime;version="0.13.0.SNAPSHOT-r3701",
+ org.argeo.slc.deploy;version="0.13.0.SNAPSHOT-r3724",
  org.argeo.slc.execution;version="0.13.0.SNAPSHOT-r3685",
  org.argeo.slc.process;version="0.13.0.SNAPSHOT-r3685",
  org.argeo.slc.runtime;version="0.13.0.SNAPSHOT-r3685",
index 8fe82baae7e5a05e52f3f784445f1f52de938ff3..3dea55524eb0b6b1c92127f6d9f59dff5359462f 100644 (file)
@@ -130,25 +130,35 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider {
 
                        SortedMap<String, FolderNode> folderNodes = new TreeMap<String, FolderNode>();
 
-                       // SortedMap<String, FlowNode> directChildren = new TreeMap<String,
-                       // FlowNode>();
-
                        flowDescriptors = new HashMap<String, ExecutionFlowDescriptor>();
                        for (ExecutionFlowDescriptor fd : descriptor.getExecutionFlows()) {
-                               if (log.isTraceEnabled())
-                                       log
-                                                       .trace("path=" + fd.getPath() + ", name="
-                                                                       + fd.getName());
-
-                               String path = fd.getPath();
-                               String name = fd.getName();
+                               // if (log.isTraceEnabled())
+                               // log.trace("fd.path=" + fd.getPath() + ", fd.name="
+                               // + fd.getName());
+
+                               // find path and label
+                               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 (log.isTraceEnabled())
+                               // log.trace("path=" + path + ", label=" + label);
 
-                               if (path == null || path.trim().equals("")) {
+                               if (path == null || path.trim().equals("")
+                                               || path.trim().equals("/")) {
                                        // directChildren.put(name, new FlowNode(name, this));
-                                       addChild(new FlowNode(name, this));
+                                       addChild(new FlowNode(label, fd.getName(), this));
                                } else {
                                        FolderNode folderNode = mkdirs(this, path, folderNodes);
-                                       folderNode.addChild(new FlowNode(name, this));
+                                       folderNode
+                                                       .addChild(new FlowNode(label, fd.getName(), this));
                                }
 
                                flowDescriptors.put(fd.getName(), fd);
@@ -158,6 +168,9 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider {
 
                protected FolderNode mkdirs(TreeParent root, String path,
                                SortedMap<String, FolderNode> folderNodes) {
+                       // Normalize
+                       if (path.charAt(0) != '/')
+                               path = '/' + path;
                        if (path.charAt(path.length() - 1) == '/')
                                path = path.substring(0, path.length() - 1);
 
@@ -165,8 +178,15 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider {
                                return folderNodes.get(path);
 
                        int lastIndx = path.lastIndexOf('/');
-                       String folderName = path.substring(lastIndx + 1);
-                       String parentPath = path.substring(0, lastIndx);
+                       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(""))
@@ -189,8 +209,9 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider {
                private final String flowName;
                private final ExecutionModuleNode executionModuleNode;
 
-               public FlowNode(String flowName, ExecutionModuleNode executionModuleNode) {
-                       super(flowName);
+               public FlowNode(String label, String flowName,
+                               ExecutionModuleNode executionModuleNode) {
+                       super(label);
                        this.flowName = flowName;
                        this.executionModuleNode = executionModuleNode;
                }
index bc0cb889a50bb0645610f25959dfb20da85d399d..ec76070504c7027476de7e39c379e3705d0ce1c5 100644 (file)
@@ -4,6 +4,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.argeo.slc.client.ui.ClientUiPlugin;
+import org.argeo.slc.execution.ExecutionModuleDescriptor;
 import org.argeo.slc.process.RealizedFlow;
 import org.argeo.slc.process.SlcExecution;
 import org.eclipse.jface.viewers.DoubleClickEvent;
@@ -30,7 +31,15 @@ public class ExecutionModulesView extends ViewPart {
        class ViewLabelProvider extends LabelProvider implements
                        ITableLabelProvider {
                public String getColumnText(Object obj, int index) {
-                       return getText(obj);
+                       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) {
@@ -39,14 +48,17 @@ public class ExecutionModulesView extends ViewPart {
 
                public Image getImage(Object obj) {
                        if (obj instanceof ExecutionModulesContentProvider.AgentNode)
-                               return ClientUiPlugin.getDefault().getImageRegistry().get("agent");
+                               return ClientUiPlugin.getDefault().getImageRegistry().get(
+                                               "agent");
                        else if (obj instanceof ExecutionModulesContentProvider.ExecutionModuleNode)
                                return ClientUiPlugin.getDefault().getImageRegistry().get(
                                                "executionModule");
                        else if (obj instanceof ExecutionModulesContentProvider.FolderNode)
-                               return ClientUiPlugin.getDefault().getImageRegistry().get("folder");
+                               return ClientUiPlugin.getDefault().getImageRegistry().get(
+                                               "folder");
                        else if (obj instanceof ExecutionModulesContentProvider.FlowNode)
-                               return ClientUiPlugin.getDefault().getImageRegistry().get("flow");
+                               return ClientUiPlugin.getDefault().getImageRegistry().get(
+                                               "flow");
                        else
                                return PlatformUI.getWorkbench().getSharedImages().getImage(
                                                ISharedImages.IMG_OBJ_ELEMENT);