Add ability to open excel files in Sparta RCP UI when running on windows.
authorBruno Sinou <bsinou@argeo.org>
Tue, 9 Nov 2010 21:41:49 +0000 (21:41 +0000)
committerBruno Sinou <bsinou@argeo.org>
Tue, 9 Nov 2010 21:41:49 +0000 (21:41 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@3890 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

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/icons/excel.png [new file with mode: 0644]
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/ResultDetailsDisplayHandler.java
eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/perspectives/SlcExecution.java
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/ResultDetailView.java
eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java

index 5312a33a4eeb5c36503d82844d99665839ac0570..5321691eeff4170182a4d4f6e6208caf2061a8ac 100644 (file)
@@ -20,6 +20,8 @@
                class="org.argeo.slc.client.ui.commands.ResultDetailsDisplayHandler"
                scope="prototype">
        </bean>
+       <!-- <bean id="org.argeo.slc.client.ui.displayResultDetailsWithExcel" class="org.argeo.slc.client.ui.commands.ResultDetailsExcelHandler" 
+               scope="prototype"> </bean> -->
        <bean id="org.argeo.slc.client.ui.launchBatch" class="org.argeo.slc.client.ui.commands.LaunchBatchHandler"
                scope="prototype">
        </bean>
index 74b7d9262e2bf20fb2d40089fb68f788c02a463f..6854192fcd035818331f5f3d3e797b35274f8a25 100644 (file)
@@ -23,8 +23,6 @@
                <property name="contentProvider" ref="resultDetailContentProvider" />
                <property name="labelProvider" ref="resultDetailLabelProvider" />
        </bean>
-
-
        <bean id="org.argeo.slc.client.ui.processListView" class="org.argeo.slc.client.ui.views.ProcessListView"
                scope="prototype">
                <property name="slcExecutionDao" ref="slcExecutionDao" />
diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/excel.png b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/excel.png
new file mode 100644 (file)
index 0000000..eb6158e
Binary files /dev/null and b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/excel.png differ
index b6f4dd1e0670d4b50c6fa982b0f314c2ba8308ff..fa05ca859ffec933aca434efc9bb4e17a8680f28 100644 (file)
          name="Result details"
          restorable="true">
    </view>
+ <!--  <view
+         allowMultiple="true"
+         class="org.argeo.eclipse.spring.SpringExtensionFactory"
+         icon="icons/excel.png"
+         id="org.argeo.slc.client.ui.resultExcelView"
+         name="Result details (Excel)"
+         restorable="true">
+   </view> -->
    <view
          id="org.argeo.slc.client.ui.processListView"
          class="org.argeo.eclipse.spring.SpringExtensionFactory"
                        name="Result UUID">
                        </commandParameter>
        </command>
-   </extension>
+    </extension>
    <extension
         point="org.eclipse.ui.bindings">
      <key
    <extension
          id="menu:org.eclipse.ui.main.menu"
          point="org.eclipse.ui.menus">
+      <!-- commented menu so that it does not show up on sparta
+               TODO : add a specific bundle with only a pluggin.xml for SLC / no sparta specific menus
       <menuContribution
             locationURI="menu:org.eclipse.ui.main.menu?after=fileMenu">
          <menu
             </command>
          </menu>
       </menuContribution>
+      -->
       <menuContribution
             locationURI="toolbar:org.eclipse.ui.main.toolbar">
          <toolbar
                tooltip="Remove selected process from process builder view.">
          </command>
       </menuContribution>
-   </extension>
+  </extension>
 </plugin>
index 98c502f3e6789c2a92aaca4d4f549c423bae92da..7fb71bea9162a77cea481dc76cae83db6c11be92 100644 (file)
@@ -1,9 +1,11 @@
 package org.argeo.slc.client.ui.commands;
 
 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.PartInitException;
 import org.eclipse.ui.handlers.HandlerUtil;
 
 /**
@@ -25,6 +27,20 @@ public class ResultDetailsDisplayHandler extends AbstractHandler {
                String uuid = event
                                .getParameter("org.argeo.slc.client.commands.resultUuid");
 
+               // TODO : remove this.
+               if (uuid == null || "".equals(uuid)) {
+                       try {
+                               ResultListView pbv = (ResultListView) HandlerUtil
+                                               .getActiveWorkbenchWindow(event).getActivePage()
+                                               .showView(ResultListView.ID);
+                               uuid = pbv.getSelectedResult();
+                       } 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
index f50ea1814802d6fb449b57b386042bb555029209..acb72db3be4499daa13363e1f921bda135e7739d 100644 (file)
@@ -34,6 +34,8 @@ public class SlcExecution implements IPerspectiveFactory {
 
                main.addView("org.argeo.slc.client.ui.processBuilderView");
                main.addPlaceholder("org.argeo.slc.client.ui.resultDetailView:UUID-*");
+               // main.addView("org.argeo.slc.client.ui.resultExcelView");
+               // main.addPlaceholder("org.argeo.slc.client.ui.resultExcelView:UUID-*");
                main.addPlaceholder("org.argeo.slc.client.ui.processDetailView:UUID-*");
 
                bottom.addView("org.argeo.slc.client.ui.processListView");
index bc4f262b989f58965c34450a3a125b147eff814d..32c3a7e4bd61041408cca5927ff770b509659b3f 100644 (file)
@@ -138,6 +138,7 @@ public class ProcessBuilderView extends ViewPart {
                viewer.refresh();
        }
 
+       
        // Remove the selected process from the batch
        public void removeSelected() {
                if (curSelectedRow == -1)
index 6d9f901622e7881fe39161318947a79c96eafce2..9901fcd1bfeced69a70f1122e663b80ff9aac015 100644 (file)
@@ -57,7 +57,7 @@ public class ResultDetailView extends ViewPart {
                        // 0 and it will look as if the column didn't exist.
                        switch (i) {
                        case 0:
-                               column.setWidth(130);
+                               column.setWidth(230);
                        case 1:
                                column.setWidth(200);
                        default:
index c61f8de348de45e2c35628b32989c772b145a43f..446548803ef3996e17fe1b982181b3e912a351cf 100644 (file)
@@ -13,6 +13,7 @@ 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.MenuManager;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
@@ -25,6 +26,7 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
 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;
@@ -49,6 +51,15 @@ public class ResultListView extends ViewPart {
                viewer.setContentProvider(new ViewContentProvider());
                viewer.setInput(getViewSite());
                viewer.addDoubleClickListener(new ViewDoubleClickListener());
+
+               // Context Menu for the end user to choose what kind of display he wants
+               // Problem to dynamically add parameters linked with the current
+               // selected object
+               MenuManager menuManager = new MenuManager();
+               Menu menu = menuManager.createContextMenu(viewer.getControl());
+               viewer.getControl().setMenu(menu);
+               getSite().registerContextMenu(menuManager, viewer);
+
        }
 
        protected Table createTable(Composite parent) {
@@ -56,7 +67,7 @@ public class ResultListView extends ViewPart {
                                | SWT.FULL_SELECTION | 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;
@@ -77,6 +88,17 @@ public class ResultListView extends ViewPart {
                return table;
        }
 
+       // TODO : Improve this method.
+       public String getSelectedResult() {
+               Object obj = ((IStructuredSelection) viewer.getSelection())
+                               .getFirstElement();
+
+               if (obj == null || !(obj instanceof ResultAttributes))
+                       return null;
+               else
+                       return ((ResultAttributes) obj).getUuid();
+       }
+
        // View Specific inner class
        protected static class ViewContentProvider implements
                        IStructuredContentProvider {
@@ -135,6 +157,7 @@ public class ResultListView extends ViewPart {
        }
 
        // Handle Events
+
        /**
         * The ResultAttributes expose a part of the information contained in the
         * TreeTestResult, It has the same UUID as the corresponding treeTestResult.
@@ -189,7 +212,7 @@ public class ResultListView extends ViewPart {
                }
        }
 
-       // Ioc
+       // IoC
        public void setTestResultCollectionDao(
                        TreeTestResultCollectionDao testResultCollectionDao) {
                this.testResultCollectionDao = testResultCollectionDao;