From 8807022197ea1738f7c6c9927114027b72adffd1 Mon Sep 17 00:00:00 2001 From: ipa-nhg Date: Tue, 2 Jun 2020 17:41:48 +0200 Subject: [PATCH] update graphical interface for parameters and added Arrays --- .../description/ros.odesign | 16 ++- .../ExternalJavaActionNewParameter.java | 105 ++++++------------ 2 files changed, 49 insertions(+), 72 deletions(-) diff --git a/plugins/de.fraunhofer.ipa.ros.sirius/description/ros.odesign b/plugins/de.fraunhofer.ipa.ros.sirius/description/ros.odesign index 06fa8c1a5..616adb96c 100644 --- a/plugins/de.fraunhofer.ipa.ros.sirius/description/ros.odesign +++ b/plugins/de.fraunhofer.ipa.ros.sirius/description/ros.odesign @@ -4,7 +4,7 @@ - + - - @@ -199,6 +199,16 @@ + diff --git a/plugins/de.fraunhofer.ipa.ros.sirius/src/de/fraunhofer/ipa/ros/sirius/ExternalJavaActionNewParameter.java b/plugins/de.fraunhofer.ipa.ros.sirius/src/de/fraunhofer/ipa/ros/sirius/ExternalJavaActionNewParameter.java index c84d0df2e..8ffef6878 100644 --- a/plugins/de.fraunhofer.ipa.ros.sirius/src/de/fraunhofer/ipa/ros/sirius/ExternalJavaActionNewParameter.java +++ b/plugins/de.fraunhofer.ipa.ros.sirius/src/de/fraunhofer/ipa/ros/sirius/ExternalJavaActionNewParameter.java @@ -1,28 +1,17 @@ package de.fraunhofer.ipa.ros.sirius; -import java.util.ArrayList; import java.util.Collection; import java.util.Map; -import javax.swing.JOptionPane; - import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.resources.IFile; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.sirius.tools.api.ui.IExternalJavaAction; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.dialogs.ElementListSelectionDialog; @@ -35,7 +24,6 @@ import ros.impl.ParameterDateTypeImpl; import ros.impl.ParameterDoubleTypeImpl; import ros.impl.ParameterIntegerTypeImpl; -import ros.impl.ParameterListTypeImpl; import ros.impl.ParameterStringTypeImpl; @@ -48,6 +36,8 @@ public class ExternalJavaActionNewParameter implements IExternalJavaAction { protected ExecutionEvent event; EList subtypes; EList subtypes_; + EList combos; + EList subtypes_string; public ExternalJavaActionNewParameter() { @@ -71,12 +61,11 @@ public void execute(Collection arg0, Map arg1 Parameter param = param_collection.iterator().next(); ParameterType type = null; - dlg.setElements( new Object[] {"Boolean","String","Integer","Date","Double","Base64", "List", "Array","Struc"}); + dlg.setElements( new Object[] {"Boolean","String","Integer","Double","Base64", "Array"});/** "List","Struc","Date"*/ dlg.open(); Object selected_type = dlg.getFirstResult(); type = GetSelectedType(selected_type.toString(), activeShell); - /**if (selected_type.toString() == "List") { type = new ParameterListTypeImpl(); } @@ -86,16 +75,6 @@ public void execute(Collection arg0, Map arg1 param.setType(type); } - public void AddTotheList (String newType) { - System.out.println(newType); - subtypes_.add(newType); - //subtypes.add(GetSelectedType(newType,activeShell)); - System.out.println("!!!!!!!!"); - System.out.println(subtypes_); - } - - - @SuppressWarnings("null") public ParameterType GetSelectedType(String selected_type, Shell activeShell) { ParameterType type = null; @@ -108,9 +87,9 @@ public ParameterType GetSelectedType(String selected_type, Shell activeShell) { if (selected_type == "Integer") { type = new ParameterIntegerTypeImpl(); } - if (selected_type == "Date") { + /**if (selected_type == "Date") { type = new ParameterDateTypeImpl(); - } + }*/ if (selected_type.toString() == "Double") { type = new ParameterDoubleTypeImpl(); } @@ -129,63 +108,51 @@ public ParameterType GetSelectedType(String selected_type, Shell activeShell) { subtype = GetSelectedType(selected_subtype.toString(), activeShell); ((ParameterArrayTypeImpl) type).setType(subtype); } - if (selected_type.toString() == "List") { - + /**if (selected_type.toString() == "List") { + EList combos = null; type = new ParameterListTypeImpl(); InputDialog dlg = new InputDialog(activeShell, "Lenght of the list parameter", null, "2",null); - int lenght; + int lenght = 0; if (dlg.open() == 0) { String param = dlg.getValue(); try { lenght = Integer.parseInt(param); } catch (NumberFormatException e){ - lenght = 1; - } - //activeShell.setSize(250,250); - GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 1; - activeShell.setLayout(gridLayout); - new Label(activeShell, SWT.NULL).setText("List parameter definition: "); - - for (int i=1;i