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 8b22a9037..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 @@ -5,39 +5,40 @@ import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.sirius.tools.api.ui.IExternalJavaAction; +import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.dialogs.ElementListSelectionDialog; + import ros.Parameter; -import ros.ParameterBoolean; -import ros.ParameterStringType; import ros.ParameterType; -import ros.impl.ParameterBooleanImpl; +import ros.impl.ParameterArrayTypeImpl; +import ros.impl.ParameterBase64TypeImpl; import ros.impl.ParameterBooleanTypeImpl; import ros.impl.ParameterDateTypeImpl; import ros.impl.ParameterDoubleTypeImpl; -import ros.impl.ParameterImpl; import ros.impl.ParameterIntegerTypeImpl; -import ros.impl.ParameterStringImpl; import ros.impl.ParameterStringTypeImpl; -import ros.impl.ParameterTypeImpl; public class ExternalJavaActionNewParameter implements IExternalJavaAction { + public IFile modelFile; protected IWorkbench workbench; protected IStructuredSelection selection; //public static final List FILE_EXTENSIONS = Collections.unmodifiableList(Arrays.asList(ComponentInterfaceEditorPlugin.INSTANCE.getString("_UI_ComponentInterfaceEditorFilenameExtensions").split("\\s*,\\s*"))); protected ExecutionEvent event; + EList subtypes; + EList subtypes_; + EList combos; + EList subtypes_string; + public ExternalJavaActionNewParameter() { // TODO Auto-generated constructor stub @@ -60,28 +61,99 @@ 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"}); + dlg.setElements( new Object[] {"Boolean","String","Integer","Double","Base64", "Array"});/** "List","Struc","Date"*/ dlg.open(); Object selected_type = dlg.getFirstResult(); - if (selected_type.toString() == "Boolean") { + type = GetSelectedType(selected_type.toString(), activeShell); + /**if (selected_type.toString() == "List") { + type = new ParameterListTypeImpl(); + } + if (selected_type.toString() == "Struc") { + type = new ParameterStructTypeImpl(); + }*/ + param.setType(type); + } + + @SuppressWarnings("null") + public ParameterType GetSelectedType(String selected_type, Shell activeShell) { + ParameterType type = null; + if (selected_type== "Boolean") { type = new ParameterBooleanTypeImpl(); } - if (selected_type.toString() == "String") { + if (selected_type == "String") { type = new ParameterStringTypeImpl(); } - if (selected_type.toString() == "Integer") { + if (selected_type == "Integer") { type = new ParameterIntegerTypeImpl(); } - if (selected_type.toString() == "Date") { + /**if (selected_type == "Date") { type = new ParameterDateTypeImpl(); - } + }*/ if (selected_type.toString() == "Double") { type = new ParameterDoubleTypeImpl(); } - param.setType(type); + if (selected_type.toString() == "Base64") { + type = new ParameterBase64TypeImpl(); + } + if (selected_type.toString() == "Array") { + ParameterType subtype = null; + type = new ParameterArrayTypeImpl(); + ElementListSelectionDialog dlg = new ElementListSelectionDialog(activeShell, new LabelProvider()); + dlg.setTitle("ArraySubtype"); + dlg.setMessage("Select a type for the elements of your Array:"); + dlg.setElements( new Object[] {"Boolean","String","Integer","Date","Double","Base64", "List", "Array","Struc"}); + dlg.open(); + Object selected_subtype = dlg.getFirstResult(); + subtype = GetSelectedType(selected_subtype.toString(), activeShell); + ((ParameterArrayTypeImpl) type).setType(subtype); + } + /**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 = 0; + if (dlg.open() == 0) { + String param = dlg.getValue(); + try { + lenght = Integer.parseInt(param); + } catch (NumberFormatException e){ + lenght = 1; + } + } + for (int i=1;i * @generated */ - protected ParameterArrayTypeImpl() { + public ParameterArrayTypeImpl() { super(); } diff --git a/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterBase64TypeImpl.java b/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterBase64TypeImpl.java index 2ded72d34..746fce600 100644 --- a/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterBase64TypeImpl.java +++ b/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterBase64TypeImpl.java @@ -43,7 +43,7 @@ public class ParameterBase64TypeImpl extends ParameterTypeImpl implements Parame * * @generated */ - protected ParameterBase64TypeImpl() { + public ParameterBase64TypeImpl() { super(); } diff --git a/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterListTypeImpl.java b/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterListTypeImpl.java index 619a1a30a..1ffa7a6ff 100644 --- a/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterListTypeImpl.java +++ b/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterListTypeImpl.java @@ -62,7 +62,7 @@ public class ParameterListTypeImpl extends ParameterTypeImpl implements Paramete * * @generated */ - protected ParameterListTypeImpl() { + public ParameterListTypeImpl() { super(); } diff --git a/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterStructTypeImpl.java b/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterStructTypeImpl.java index b154e82ed..f2376dbf7 100644 --- a/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterStructTypeImpl.java +++ b/plugins/de.fraunhofer.ipa.ros/src/ros/impl/ParameterStructTypeImpl.java @@ -47,7 +47,7 @@ public class ParameterStructTypeImpl extends ParameterTypeImpl implements Parame * * @generated */ - protected ParameterStructTypeImpl() { + public ParameterStructTypeImpl() { super(); }