Fix a few bugs on RCP UI
authorBruno Sinou <bsinou@argeo.org>
Mon, 22 Nov 2010 18:39:46 +0000 (18:39 +0000)
committerBruno Sinou <bsinou@argeo.org>
Mon, 22 Nov 2010 18:39:46 +0000 (18:39 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@3912 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

eclipse/plugins/runtime/org.argeo.slc.client.rcp/plugin.xml
eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/commands.xml
eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/views.xml
eclipse/plugins/runtime/org.argeo.slc.client.ui/plugin.xml
eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ManageBundlesHandler.java [new file with mode: 0644]
eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java
eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java
eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java
eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java

index 36f23ee95faeef2f28b294edeaf968185b07db60..93b54de71b2a61bf89ffd38d58144070cbddc64c 100644 (file)
@@ -28,6 +28,7 @@
                id="fileMenu"
                label="File">
             <command
+                  id="exitCommand"
                   commandId="org.argeo.slc.client.rcp.commands.Exit"
                   label="Exit"
                   style="push"
index 484094cf9f67b841220ad85e438e64eae52da40d..5df3ab1b0032bf76bae97e5e106c83fe043ea2e3 100644 (file)
@@ -36,4 +36,7 @@
        <bean id="org.argeo.slc.client.ui.clearBatch" class="org.argeo.slc.client.ui.commands.ClearBatchHandler"
                scope="prototype">
        </bean>
+       <bean id="org.argeo.slc.client.ui.manageBundles" class="org.argeo.slc.client.ui.commands.ManageBundlesHandler"
+       scope="prototype">
+       </bean>
 </beans>
index 6854192fcd035818331f5f3d3e797b35274f8a25..ba6a8ec944e880e8aa19f9885eb063a197bf5968 100644 (file)
@@ -34,7 +34,6 @@
                scope="prototype">
                <property name="slcExecutionDao" ref="slcExecutionDao" />
                <property name="contentProvider" ref="processDetailContentProvider" />
-               <property name="labelProvider" ref="processDetailLabelProvider" />
        </bean>
 
        <bean id="org.argeo.slc.client.ui.processBuilderView" class="org.argeo.slc.client.ui.views.ProcessBuilderView"
index f2a665d5b5f528e35e4cbed2014fb5476e587573..3c626c793ae199aa8f2bb29042143332491b0a87 100644 (file)
                        name="Result Name">
                        </commandParameter>
        </command>
+   <command 
+               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
+               id="org.argeo.slc.client.ui.manageBundles"
+               name="ManageBundles">
+       </command>
     </extension>
    <extension
         point="org.eclipse.ui.bindings">
          </menu>
       </menuContribution>
       -->
+       <menuContribution
+            locationURI="menu:fileMenu">
+            <!-- Should be implemented in later version.
+            <command
+                  commandId="org.argeo.slc.client.ui.manageBundles"
+                  label="Manage Bundles"
+                  style="push"
+                  tooltip="Add or remove plugins at run time">
+            </command> -->
+      </menuContribution>
       <menuContribution
             locationURI="toolbar:org.argeo.slc.client.ui.resultListView">
             <command
                   commandId="org.argeo.slc.client.ui.refreshResultList"
                   icon="icons/refresh.png"
                   label="Refresh"
-                  style="toggle"
                   tooltip="Refresh the result list">
             </command>
         </menuContribution>
diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ManageBundlesHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ManageBundlesHandler.java
new file mode 100644 (file)
index 0000000..81b1090
--- /dev/null
@@ -0,0 +1,100 @@
+package org.argeo.slc.client.ui.commands;\r
+\r
+import org.apache.commons.logging.Log;\r
+import org.apache.commons.logging.LogFactory;\r
+import org.argeo.slc.client.ui.ClientUiPlugin;\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.jface.dialogs.TitleAreaDialog;\r
+import org.eclipse.swt.widgets.DirectoryDialog;\r
+import org.eclipse.swt.widgets.Shell;\r
+\r
+/**\r
+ * Command handler to manage existing bundles; add or remove specific ones.\r
+ * \r
+ * @author bsinou\r
+ * \r
+ */\r
+\r
+public class ManageBundlesHandler extends AbstractHandler {\r
+       private static final Log log = LogFactory\r
+                       .getLog(ManageBundlesHandler.class);\r
+\r
+       // private static final String DEFAULT_BUNDLE_DIR = "tmp";\r
+\r
+       public Object execute(ExecutionEvent event) throws ExecutionException {\r
+\r
+               Shell shell = ClientUiPlugin.getDefault().getWorkbench()\r
+                               .getActiveWorkbenchWindow().getShell();\r
+               // LaunchConfigurationsDialog lcd;\r
+               // see http://kickjava.com/src/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java.htm\r
+               // to have more ideas about what to do.\r
+               \r
+               TitleAreaDialog tad = new TitleAreaDialog(shell);\r
+               tad.setTitle("Manage Bundles");\r
+               tad.open();\r
+\r
+               DirectoryDialog dialog2 = new DirectoryDialog(shell);\r
+               String path = dialog2.open();\r
+\r
+               if (path == null)\r
+                       // action canceled by user\r
+                       return null;\r
+               log.debug("Path chosen by user : " + path);\r
+\r
+               \r
+               // the following does not work : it doesn't display anything.\r
+               // Label label = new Label(shell, SWT.WRAP);\r
+               // label.setText("This is a long text string that will wrap when the dialog is resized.");\r
+               // List list = new List(shell, SWT.BORDER | SWT.H_SCROLL |\r
+               // SWT.V_SCROLL);\r
+               // list.setItems(new String[] { "Item 1", "Item 2" });\r
+               // Button button1 = new Button(shell, SWT.PUSH);\r
+               // button1.setText("OK");\r
+               // Button button2 = new Button(shell, SWT.PUSH);\r
+               // button2.setText("Cancel");\r
+               //\r
+               // final int insetX = 4, insetY = 4;\r
+               // FormLayout formLayout = new FormLayout();\r
+               // formLayout.marginWidth = insetX;\r
+               // formLayout.marginHeight = insetY;\r
+               // shell.setLayout(formLayout);\r
+               //\r
+               // Point size = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+               // final FormData labelData = new FormData(size.x, SWT.DEFAULT);\r
+               // labelData.left = new FormAttachment(0, 0);\r
+               // labelData.right = new FormAttachment(100, 0);\r
+               // label.setLayoutData(labelData);\r
+               //\r
+               // FormData button2Data = new FormData();\r
+               // button2Data.right = new FormAttachment(100, -insetX);\r
+               // button2Data.bottom = new FormAttachment(100, 0);\r
+               // button2.setLayoutData(button2Data);\r
+               //\r
+               // FormData button1Data = new FormData();\r
+               // button1Data.right = new FormAttachment(button2, -insetX);\r
+               // button1Data.bottom = new FormAttachment(100, 0);\r
+               // button1.setLayoutData(button1Data);\r
+               //\r
+               // FormData listData = new FormData();\r
+               // listData.left = new FormAttachment(0, 0);\r
+               // listData.right = new FormAttachment(100, 0);\r
+               // listData.top = new FormAttachment(label, insetY);\r
+               // listData.bottom = new FormAttachment(button2, -insetY);\r
+               // list.setLayoutData(listData);\r
+               //\r
+               // shell.pack();\r
+               // shell.open();\r
+               //\r
+               // Display display = shell.getDisplay();\r
+               // while (!shell.isDisposed()) {\r
+               // if (!display.readAndDispatch())\r
+               // display.sleep();\r
+               // }\r
+               // display.dispose();\r
+\r
+               return null;\r
+       }\r
+       \r
+}\r
index 32c3a7e4bd61041408cca5927ff770b509659b3f..1ea1d1361b0580ba84d328d0a3047b57ef7a9cf9 100644 (file)
@@ -138,7 +138,6 @@ public class ProcessBuilderView extends ViewPart {
                viewer.refresh();
        }
 
-       
        // Remove the selected process from the batch
        public void removeSelected() {
                if (curSelectedRow == -1)
@@ -239,6 +238,7 @@ public class ProcessBuilderView extends ViewPart {
                                RealizedFlow rf = (RealizedFlow) obj;
                                curSelectedRow = realizedFlows.indexOf(rf);
                                refreshParameterview();
+                               setFocus();
                        }
                }
        }
index 944207eb13f3f6e97124295f8da07d53f8463e37..714cb19c6f3b7e401942bf55b669d279102d052f 100644 (file)
@@ -36,7 +36,6 @@ public class ProcessDetailView extends ViewPart {
        public void createPartControl(Composite parent) {
                viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
                viewer.setContentProvider(contentProvider);
-               // viewer.setLabelProvider(labelProvider);
                viewer.setLabelProvider(new ProcessDetailLabelProvider());
                // viewer.setInput(getViewSite());
        }
index 2c4871423edf87994f6a10e636ed0d6f3bf3904c..402f7675aeb1ca23c0b6f5888b03c030d5992b0b 100644 (file)
@@ -7,7 +7,6 @@ import java.util.Map;
 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.execution.ExecutionSpecAttribute;
 import org.argeo.slc.process.RealizedFlow;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
@@ -42,7 +41,7 @@ public class ProcessParametersView extends ViewPart {
        private Map<String, Object> values;
        // This map stores the spec of the attributes used to offer the end user
        // some choices.
-       private Map<String, ExecutionSpecAttribute> specAttributes;
+       //private Map<String, ExecutionSpecAttribute> specAttributes;
 
        // We must keep a reference to the current EditingSupport so that we can
        // update the index of the process being updated
@@ -120,8 +119,8 @@ public class ProcessParametersView extends ViewPart {
                // viewer.setInput(parameters);
 
                values = rf.getFlowDescriptor().getValues();
-               specAttributes = rf.getFlowDescriptor().getExecutionSpec()
-                               .getAttributes();
+               // specAttributes = rf.getFlowDescriptor().getExecutionSpec()
+               // .getAttributes();
 
                if (values != null)
                        viewer.setInput(values);
index 25855b1fcd7996ec0db4be741bbe8bcb7e008416..fd6233932497b1af810f5e4a685d78a7f4462477 100644 (file)
@@ -183,7 +183,6 @@ public class ResultListView extends ViewPart {
 
        private void contextMenuAboutToShow(IMenuManager menuManager) {
 
-               IContributionItem[] items = menuManager.getItems();
                IWorkbenchWindow window = ClientUiPlugin.getDefault().getWorkbench()
                                .getActiveWorkbenchWindow();