From 0cbe31318c9154e0ad7c77885fb10ec2c822836c Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Mon, 22 Nov 2010 18:39:46 +0000 Subject: [PATCH] Fix a few bugs on RCP UI git-svn-id: https://svn.argeo.org/slc/trunk@3912 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org.argeo.slc.client.rcp/plugin.xml | 1 + .../META-INF/spring/commands.xml | 3 + .../META-INF/spring/views.xml | 1 - .../org.argeo.slc.client.ui/plugin.xml | 16 ++- .../ui/commands/ManageBundlesHandler.java | 100 ++++++++++++++++++ .../client/ui/views/ProcessBuilderView.java | 2 +- .../client/ui/views/ProcessDetailView.java | 1 - .../ui/views/ProcessParametersView.java | 7 +- .../slc/client/ui/views/ResultListView.java | 1 - 9 files changed, 123 insertions(+), 9 deletions(-) create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ManageBundlesHandler.java diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.rcp/plugin.xml b/eclipse/plugins/runtime/org.argeo.slc.client.rcp/plugin.xml index 36f23ee95..93b54de71 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.rcp/plugin.xml +++ b/eclipse/plugins/runtime/org.argeo.slc.client.rcp/plugin.xml @@ -28,6 +28,7 @@ id="fileMenu" label="File"> + + 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 6854192fc..ba6a8ec94 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 @@ -34,7 +34,6 @@ scope="prototype"> - + + @@ -149,13 +154,22 @@ --> + + + 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 index 000000000..81b109074 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ManageBundlesHandler.java @@ -0,0 +1,100 @@ +package org.argeo.slc.client.ui.commands; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.client.ui.ClientUiPlugin; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Shell; + +/** + * Command handler to manage existing bundles; add or remove specific ones. + * + * @author bsinou + * + */ + +public class ManageBundlesHandler extends AbstractHandler { + private static final Log log = LogFactory + .getLog(ManageBundlesHandler.class); + + // private static final String DEFAULT_BUNDLE_DIR = "tmp"; + + public Object execute(ExecutionEvent event) throws ExecutionException { + + Shell shell = ClientUiPlugin.getDefault().getWorkbench() + .getActiveWorkbenchWindow().getShell(); + // LaunchConfigurationsDialog lcd; + // see http://kickjava.com/src/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java.htm + // to have more ideas about what to do. + + TitleAreaDialog tad = new TitleAreaDialog(shell); + tad.setTitle("Manage Bundles"); + tad.open(); + + DirectoryDialog dialog2 = new DirectoryDialog(shell); + String path = dialog2.open(); + + if (path == null) + // action canceled by user + return null; + log.debug("Path chosen by user : " + path); + + + // the following does not work : it doesn't display anything. + // Label label = new Label(shell, SWT.WRAP); + // label.setText("This is a long text string that will wrap when the dialog is resized."); + // List list = new List(shell, SWT.BORDER | SWT.H_SCROLL | + // SWT.V_SCROLL); + // list.setItems(new String[] { "Item 1", "Item 2" }); + // Button button1 = new Button(shell, SWT.PUSH); + // button1.setText("OK"); + // Button button2 = new Button(shell, SWT.PUSH); + // button2.setText("Cancel"); + // + // final int insetX = 4, insetY = 4; + // FormLayout formLayout = new FormLayout(); + // formLayout.marginWidth = insetX; + // formLayout.marginHeight = insetY; + // shell.setLayout(formLayout); + // + // Point size = label.computeSize(SWT.DEFAULT, SWT.DEFAULT); + // final FormData labelData = new FormData(size.x, SWT.DEFAULT); + // labelData.left = new FormAttachment(0, 0); + // labelData.right = new FormAttachment(100, 0); + // label.setLayoutData(labelData); + // + // FormData button2Data = new FormData(); + // button2Data.right = new FormAttachment(100, -insetX); + // button2Data.bottom = new FormAttachment(100, 0); + // button2.setLayoutData(button2Data); + // + // FormData button1Data = new FormData(); + // button1Data.right = new FormAttachment(button2, -insetX); + // button1Data.bottom = new FormAttachment(100, 0); + // button1.setLayoutData(button1Data); + // + // FormData listData = new FormData(); + // listData.left = new FormAttachment(0, 0); + // listData.right = new FormAttachment(100, 0); + // listData.top = new FormAttachment(label, insetY); + // listData.bottom = new FormAttachment(button2, -insetY); + // list.setLayoutData(listData); + // + // shell.pack(); + // shell.open(); + // + // Display display = shell.getDisplay(); + // while (!shell.isDisposed()) { + // if (!display.readAndDispatch()) + // display.sleep(); + // } + // display.dispose(); + + return null; + } + +} 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 32c3a7e4b..1ea1d1361 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,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(); } } } diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java index 944207eb1..714cb19c6 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java @@ -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()); } diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java index 2c4871423..402f7675a 100644 --- a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java @@ -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 values; // This map stores the spec of the attributes used to offer the end user // some choices. - private Map specAttributes; + //private Map 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); 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 25855b1fc..fd6233932 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 @@ -183,7 +183,6 @@ public class ResultListView extends ViewPart { private void contextMenuAboutToShow(IMenuManager menuManager) { - IContributionItem[] items = menuManager.getItems(); IWorkbenchWindow window = ClientUiPlugin.getDefault().getWorkbench() .getActiveWorkbenchWindow(); -- 2.39.2