From 4cfe93b7b5880c09fcec3187eae6f9cc458f5340 Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Tue, 9 Nov 2010 21:41:49 +0000 Subject: [PATCH] Add ability to open excel files in Sparta RCP UI when running on windows. git-svn-id: https://svn.argeo.org/slc/trunk@3890 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../META-INF/spring/commands.xml | 2 ++ .../META-INF/spring/views.xml | 2 -- .../org.argeo.slc.client.ui/icons/excel.png | Bin 0 -> 817 bytes .../org.argeo.slc.client.ui/plugin.xml | 15 ++++++++-- .../commands/ResultDetailsDisplayHandler.java | 16 +++++++++++ .../client/ui/perspectives/SlcExecution.java | 2 ++ .../client/ui/views/ProcessBuilderView.java | 1 + .../slc/client/ui/views/ResultDetailView.java | 2 +- .../slc/client/ui/views/ResultListView.java | 27 ++++++++++++++++-- 9 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/excel.png diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/commands.xml b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/commands.xml index 5312a33a4..5321691ee 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/commands.xml +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/commands.xml @@ -20,6 +20,8 @@ class="org.argeo.slc.client.ui.commands.ResultDetailsDisplayHandler" scope="prototype"> + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/views.xml b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/views.xml index 74b7d9262..6854192fc 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/views.xml +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/views.xml @@ -23,8 +23,6 @@ - - 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 index 0000000000000000000000000000000000000000..eb6158eb5ca9c4b64c81e70e0fd894dbc8e2bed9 GIT binary patch literal 817 zcmV-11J3-3P)hdKqhFO_H1|Vn1E?(=|cjAh_&P}y{{^`u< zcYD@PK?$)4i~7o9*6F_$F$4lR(d4AAvrez^(88Hk+)+B7E)M3jc=Ewl4$S^`_qwSF zA%qz@=c2EOsz@0qB1IqsqJU)HaG&+}%`-OM8YqW{K85hqj@4&V9vz!Cm_n0-W#f;# zeEpJde%vdgRn5?(+PY=W*z~|lT2-mtown({ll8&3S5+lWz5K}LTRW{k{eJn3Qz!SU zQ`@qI_n2;K?RG~pYJ9=dj-RWgG;P&wEuoAxL~Q)<>x0b=dED^Outj&xQ^rA;u3pw| zca_ClTh_d9cxXg_U!lLRl0`xU@$=UXO|_dRdtXfKwPawmnf(LC7u}-U>8k6}3u|{8 zs9LHr>MIJZGD^r9h|q2yF24Wuh+PM^yMN9GP1$khlDkdyCY}D{kg}jEf-(kW5jBY> z0rB29ZhG-r=i_R{;+1k0?A-sBM;AP6(k1i9ZuixR4?MqXOvphQgCYj~RnXKKL~J9Q zIDNz~XMfO{ZhUg&BTtMyXJqDVqc<x643?SvKHx004lTvR=0a5$dUw z>Xb470000$S;ka1sfH4I-R8njUol7M4dtApOahDylptpYswf1hD#CwFoz6oEA>(SIECU&IQ%a}GXdnC!9$70`0uH1B00000NkvXXu0mjf!8w72 literal 0 HcmV?d00001 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/plugin.xml b/eclipse/plugins/runtime/org.argeo.slc.client.ui/plugin.xml index b6f4dd1e0..fa05ca859 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui/plugin.xml +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/plugin.xml @@ -27,6 +27,14 @@ name="Result details" restorable="true"> + - + + - + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java index 98c502f3e..7fb71bea9 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java @@ -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 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/perspectives/SlcExecution.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/perspectives/SlcExecution.java index f50ea1814..acb72db3b 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/perspectives/SlcExecution.java +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/perspectives/SlcExecution.java @@ -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"); diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java index bc4f262b9..32c3a7e4b 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java @@ -138,6 +138,7 @@ public class ProcessBuilderView extends ViewPart { viewer.refresh(); } + // Remove the selected process from the batch public void removeSelected() { if (curSelectedRow == -1) diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultDetailView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultDetailView.java index 6d9f90162..9901fcd1b 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultDetailView.java +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultDetailView.java @@ -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: diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java index c61f8de34..446548803 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java @@ -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; -- 2.39.2