Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse')
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/Activator.java73
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ConverterNotfoundException.java70
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ConverterRegistry.java153
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ObjectToBooleanConverter.java50
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ObjectToIntegerConverter.java49
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToBooleanConverter.java38
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToEENumConverter.java71
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToEnumerationConverter.java51
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToIntegerConverter.java37
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToStringConverter.java38
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/FeatureValueUtils.java133
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionConfigurationModelCreation.java29
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionCreationElementValidator.java38
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionEditHelperAdvice.java179
14 files changed, 0 insertions, 1009 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/Activator.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/Activator.java
deleted file mode 100644
index f0e88f6b739..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/Activator.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014, 2016 CEA LIST, Christian W. Damus, and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) - Initial API and implementation
- * Christian W. Damus - bug 485220
- *
- /*****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.extendedtypes.emf"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /** Logging helper */
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- log = null;
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ConverterNotfoundException.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ConverterNotfoundException.java
deleted file mode 100644
index 09ccf5237bc..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ConverterNotfoundException.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.converter;
-
-import org.eclipse.uml2.uml.ValueSpecification;
-
-
-/**
- * Exception thrown when no converter was found
- */
-public class ConverterNotfoundException extends Exception {
-
- /** serialization id */
- private static final long serialVersionUID = -8863603362830475612L;
-
- /** target parameter type */
- private final Class<?> parameterType;
-
- /** source value instance */
- private final ValueSpecification valueInstance;
-
- /**
- * Creates a new {@link ConverterNotfoundException}.
- *
- * @param parameterType
- * the target type of the value
- * @param valueInstance
- * the value specification defining the entering value and type
- */
- public ConverterNotfoundException(Class<?> parameterType, ValueSpecification valueInstance) {
- this.parameterType = parameterType;
- this.valueInstance = valueInstance;
- }
-
- /**
- * Returns the target parameter type
- *
- * @return the target parameter type
- */
- public Class<?> getParameterType() {
- return parameterType;
- }
-
- /**
- * Returns the value specification defining the entering value and type
- *
- * @return the value specification defining the entering value and type
- */
- public ValueSpecification getValueInstance() {
- return valueInstance;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getMessage() {
- return "Converter not found for target type: " + getParameterType() + " and for initial value: " + getValueInstance();
- }
-
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ConverterRegistry.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ConverterRegistry.java
deleted file mode 100644
index bdca51a8a42..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ConverterRegistry.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.converter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.databinding.conversion.IConverter;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.uml2.uml.Enumeration;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * Registry to store onverters.
- */
-public class ConverterRegistry {
-
- /** singleton instance */
- private static ConverterRegistry instance;
-
- /** map to store converters, identified by their class */
- private Map<Class<?>, IConverter> converterMaps = new HashMap<Class<?>, IConverter>();
-
- /**
- * Constructor (not visible: singleton pattern)
- */
- private ConverterRegistry() {
- }
-
- /**
- * Returns the single instance of this registry
- *
- * @return the single instance of this registry
- */
- public static synchronized ConverterRegistry getSingleton() {
- if (instance == null) {
- instance = new ConverterRegistry();
- instance.initializeRegistry();
- }
- return instance;
- }
-
- /**
- * Initialize the registry
- */
- protected void initializeRegistry() {
- converterMaps.put(String.class, new ValueSpecificationToStringConverter());
- converterMaps.put(int.class, new ValueSpecificationToIntegerConverter());
- converterMaps.put(boolean.class, new ValueSpecificationToBooleanConverter());
- converterMaps.put(Enumeration.class, new ValueSpecificationToEnumerationConverter());
- converterMaps.put(EEnum.class, new ValueSpecificationToEENumConverter());
- }
-
- /**
- * Returns the converter for the convenient type, from an {@link Object}
- *
- * @param toType
- * the class into which the element should be transformed
- *
- * @return the converter for the convenient type
- */
- public IConverter getConverter(Class<?> toType) {
- return converterMaps.get(toType);
- }
-
- public Object convert(Class<?> parameterType, ValueSpecification valueInstance) throws ConverterNotfoundException {
- // retrieve the converter
- IConverter converter = getConverter(parameterType);
-
- if (converter != null) {
- return converter.convert(valueInstance);
- } else {
- throw new ConverterNotfoundException(parameterType, valueInstance);
- }
- }
-
- // /**
- // * Converts a parameter value into a list of values
- // *
- // * @param context
- // * the context of the evaluation of the query
- // * @param parameterType
- // * the type of the list
- // * @param parameterValue
- // * the parameter value to transform into a list
- // * @return the list of values contained by the parameter value
- // */
- // public List<?> convertToList(final EObject context, final Class<?> parameterType, final ParameterValue parameterValue) {
- // return new ConfigurationSwitch<List<?>>() {
- //
- // /**
- // * {@inheritDoc}
- // */
- // @Override
- // public java.util.List<?> caseConstantParameterValue(ConstantParameterValue constantParameterValue) {
- // IConverter converter = getConverter(parameterType);
- //
- // if(converter != null) {
- // return Arrays.asList(converter.convert(constantParameterValue.getValueInstance()));
- // } else {
- // Activator.log.error("Impossible to find a converter for type: " + parameterType, null);
- // return Collections.emptyList();
- // }
- // };
- //
- // /**
- // * {@inheritDoc}
- // */
- // @Override
- // public java.util.List<?> caseQueryExecutionValue(QueryExecutionValue queryExecutionValue) {
- // // if query returns a list, returns it, else creates an array of one element
- // QueryConfiguration queryConfiguration = queryExecutionValue.getConfiguration();
- // if(!(queryConfiguration instanceof ModiscoQueryConfiguration)) {
- // throw new RuntimeException("List conversion not implemented for this type of configuration. " + queryConfiguration.eClass().getName());
- // }
- // Object executionResult = null;
- // try {
- // executionResult = QueryUtil.evaluateBooleanQuery(context, queryConfiguration);
- // } catch (Exception e) {
- // Activator.log.error(e);
- // }
- // int upperBound = ((ModiscoQueryConfiguration)queryConfiguration).getQuery().getUpperBound();
- // if(upperBound == 1) {
- // return Arrays.asList(executionResult);
- // } else {
- // return (List<?>)executionResult;
- // }
- // };
- //
- // /**
- // * {@inheritDoc}
- // */
- // @Override
- // public java.util.List<?> caseListParameterValue(ListParameterValue listParameterValue) {
- // List<Object> values = new ArrayList<Object>();
- // for(ParameterValue parameterValue : listParameterValue.getValues()) {
- // values.addAll(convertToList(context, parameterType, parameterValue));
- // }
- // return values;
- // };
- //
- // }.doSwitch(parameterValue);
- // }
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ObjectToBooleanConverter.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ObjectToBooleanConverter.java
deleted file mode 100644
index 50bf410e853..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ObjectToBooleanConverter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.converter;
-
-import org.eclipse.core.databinding.conversion.Converter;
-import org.eclipse.core.databinding.conversion.IConverter;
-
-
-/**
- * Converter for Objects to Boolean value
- */
-public class ObjectToBooleanConverter extends Converter implements IConverter {
-
- /**
- * Creates a new ObjectToBooleanConverter
- */
- public ObjectToBooleanConverter() {
- super(Object.class, Boolean.class);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Boolean convert(Object fromObject) {
- if (fromObject == null) {
- return null;
- }
-
- if (fromObject instanceof Boolean) {
- return ((Boolean) fromObject);
- }
-
- if (fromObject instanceof String) {
- return Boolean.valueOf((String) fromObject);
- }
-
- return null;
- }
-
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ObjectToIntegerConverter.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ObjectToIntegerConverter.java
deleted file mode 100644
index e10febbdd80..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ObjectToIntegerConverter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.converter;
-
-import org.eclipse.core.databinding.conversion.Converter;
-import org.eclipse.core.databinding.conversion.IConverter;
-
-/**
- * Converter from an object to an integer
- */
-public class ObjectToIntegerConverter extends Converter implements IConverter {
-
- /**
- * Default constructor.
- */
- public ObjectToIntegerConverter() {
- super(Object.class, Integer.class);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Integer convert(Object fromObject) {
- if (fromObject == null) {
- return null;
- }
-
- if (fromObject instanceof Integer) {
- return (Integer) fromObject;
- }
-
- if (fromObject instanceof String) {
- return Integer.parseInt((String) fromObject);
- }
-
- return null;
- }
-
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToBooleanConverter.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToBooleanConverter.java
deleted file mode 100644
index c50b45f486f..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToBooleanConverter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.converter;
-
-import org.eclipse.core.databinding.conversion.Converter;
-import org.eclipse.core.databinding.conversion.IConverter;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * Converter from a {@link ValueSpecification} to a {@link Boolean} value
- */
-public class ValueSpecificationToBooleanConverter extends Converter implements IConverter {
-
- /**
- * Creates a new ValueSpecificationToBooleanConverter.
- */
- public ValueSpecificationToBooleanConverter() {
- super(ValueSpecification.class, boolean.class);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object convert(Object fromObject) {
- return ((ValueSpecification) fromObject).booleanValue();
- }
-
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToEENumConverter.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToEENumConverter.java
deleted file mode 100644
index d569df6f7b8..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToEENumConverter.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.converter;
-
-import org.eclipse.core.databinding.conversion.Converter;
-import org.eclipse.core.databinding.conversion.IConverter;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.uml2.uml.EnumerationLiteral;
-import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.InstanceValue;
-import org.eclipse.uml2.uml.ValueSpecification;
-import org.eclipse.uml2.uml.VisibilityKind;
-
-
-/**
- * @author RS211865
- */
-public class ValueSpecificationToEENumConverter extends Converter implements IConverter {
-
- /**
- * @param fromType
- * @param toType
- */
- public ValueSpecificationToEENumConverter() {
- super(ValueSpecification.class, EEnum.class);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object convert(Object fromObject) {
- if (fromObject instanceof InstanceValue) {
- InstanceSpecification instanceSpecification = ((InstanceValue) fromObject).getInstance();
- if (instanceSpecification instanceof EnumerationLiteral) {
-
- System.err.println(VisibilityKind.PRIVATE_LITERAL);
- Class<?> eclass = ((EnumerationLiteral) instanceSpecification).getEnumeration().eClass().getInstanceClass();
- System.err.println(eclass.getEnumConstants());
- System.err.println(eclass);
-
-
-
-
-
- // final EEnumLiteral literal = eenum.getEEnumLiteral(umlLiteral.getName());
- // if(literal != null) {
- // return literal.getInstance();
- // }
- // return null;
- //
- System.err.println(instanceSpecification);
-
-
- // return ((EnumerationLiteral)instanceSpecification).;
- }
- }
-
- return fromObject;
- }
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToEnumerationConverter.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToEnumerationConverter.java
deleted file mode 100644
index e7bbeef7d31..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToEnumerationConverter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.converter;
-
-import org.eclipse.core.databinding.conversion.Converter;
-import org.eclipse.core.databinding.conversion.IConverter;
-import org.eclipse.uml2.uml.Enumeration;
-import org.eclipse.uml2.uml.EnumerationLiteral;
-import org.eclipse.uml2.uml.InstanceSpecification;
-import org.eclipse.uml2.uml.InstanceValue;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-
-/**
- * Converter for enumeration values
- */
-public class ValueSpecificationToEnumerationConverter extends Converter implements IConverter {
-
- /**
- * @param fromType
- * @param toType
- */
- public ValueSpecificationToEnumerationConverter() {
- super(ValueSpecification.class, Enumeration.class);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object convert(Object fromObject) {
- if (fromObject instanceof InstanceValue) {
- InstanceSpecification instanceSpecification = ((InstanceValue) fromObject).getInstance();
- if (instanceSpecification instanceof EnumerationLiteral) {
- return (instanceSpecification);
- }
- }
-
- return fromObject;
- }
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToIntegerConverter.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToIntegerConverter.java
deleted file mode 100644
index 98df4ae9388..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToIntegerConverter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.converter;
-
-import org.eclipse.core.databinding.conversion.Converter;
-import org.eclipse.core.databinding.conversion.IConverter;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * Converter from a {@link ValueSpecification} to an {@link Integer}.
- */
-public class ValueSpecificationToIntegerConverter extends Converter implements IConverter {
-
- /**
- * Creates a new {@link ValueSpecificationToIntegerConverter}.
- */
- public ValueSpecificationToIntegerConverter() {
- super(ValueSpecification.class, int.class);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object convert(Object fromObject) {
- return ((ValueSpecification) fromObject).integerValue();
- }
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToStringConverter.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToStringConverter.java
deleted file mode 100644
index 1323d2233f9..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/converter/ValueSpecificationToStringConverter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.converter;
-
-import org.eclipse.core.databinding.conversion.Converter;
-import org.eclipse.core.databinding.conversion.IConverter;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-/**
- * Converter from a {@link ValueSpecification} to an {@link String}.
- */
-public class ValueSpecificationToStringConverter extends Converter implements IConverter {
-
- /**
- * Creates a new {@link ValueSpecificationToStringConverter}.
- */
- public ValueSpecificationToStringConverter() {
- super(ValueSpecification.class, String.class);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object convert(Object fromObject) {
- return ((ValueSpecification) fromObject).stringValue();
- }
-
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/FeatureValueUtils.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/FeatureValueUtils.java
deleted file mode 100644
index 206a271d375..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/FeatureValueUtils.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.setvaluesactionconfiguration;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.papyrus.infra.extendedtypes.Activator;
-import org.eclipse.papyrus.infra.extendedtypes.emf.converter.ConverterNotfoundException;
-import org.eclipse.papyrus.infra.extendedtypes.emf.converter.ConverterRegistry;
-import org.eclipse.papyrus.infra.extendedtypes.emf.setvaluesactionconfiguration.util.SetValuesActionConfigurationSwitch;
-import org.eclipse.uml2.uml.DataType;
-import org.eclipse.uml2.uml.InstanceValue;
-import org.eclipse.uml2.uml.ValueSpecification;
-
-
-/**
- * Utility class to get values from a {@link FeatureValue}
- */
-public class FeatureValueUtils {
-
- protected FeatureValueUtils() {
- // no instanciation, helper class
- }
-
- /**
- * Returns the value to set for a given feature of a given element
- *
- * @param elementToConfigure
- * eobject for which feature is set. This must not be <code>null</code>
- * @param feature
- * {@link EStructuralFeature} to set. This must not be <code>null</code>
- * @param valueModel
- * configuration of the value, stored in the model
- * @return the real value that will be set to the object or <code>null</code> if none could be computed
- */
- public static Object getValue(final EObject elementToConfigure, final EStructuralFeature feature, final FeatureValue featureValue) {
-
- Object result = new SetValuesActionConfigurationSwitch<Object>() {
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseConstantValue(ConstantValue object) {
- ValueSpecification valueSpecification = object.getValueInstance();
-
- if (valueSpecification == null) {
- return null;
- }
-
- try {
- EClassifier type = feature.getEType();
- if (type instanceof EEnum) {
- String value = ((InstanceValue) valueSpecification).getInstance().getName();
- return ((EEnum) type).getEEnumLiteral(value).getInstance();
- // return ConverterRegistry.getSingleton().convert(EEnum.class, valueSpecification);
- } else if (type instanceof EDataType) {
- final EDataType pType = (EDataType) type;
- final String name = pType.getName();
- if ("Boolean".equals(name)) {
- return ConverterRegistry.getSingleton().convert(boolean.class, valueSpecification);
- } else if ("Integer".equals(name)) {
- return ConverterRegistry.getSingleton().convert(int.class, valueSpecification);
- } else if ("Real".equals(name)) {
- return ConverterRegistry.getSingleton().convert(double.class, valueSpecification);
- } else if ("String".equals(name)) {
- return ConverterRegistry.getSingleton().convert(String.class, valueSpecification);
- } else if ("UnlimitedNatural".equals(name)) {
- return ConverterRegistry.getSingleton().convert(int.class, valueSpecification);
- } else { // custom PrimitiveType
- return ConverterRegistry.getSingleton().convert(String.class, valueSpecification);
- }
- } else if (type instanceof DataType) {// FIXME manage the data type
- return ConverterRegistry.getSingleton().convert(String.class, valueSpecification);
- }
- return ConverterRegistry.getSingleton().convert(feature.getEType().getInstanceClass(), valueSpecification);
- } catch (ConverterNotfoundException e) {
- Activator.log.error("Impossible to convert " + valueSpecification + " to fit feature type :" + feature, e);
- }
- return super.caseConstantValue(object);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseQueryExecutionValue(QueryExecutionValue object) {
- throw new UnsupportedOperationException("Query execution values resolution has not been implemented yet");
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseDynamicValue(DynamicValue object) {
- throw new UnsupportedOperationException("Dynamic values resolution has not been implemented yet");
- };
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Object caseListValue(ListValue object) {
- // resolve one by one all features in the values list of this listvalue
- List<Object> results = new ArrayList<Object>();
- for (FeatureValue value : object.getValues()) {
- Object singleResult = getValue(elementToConfigure, feature, value);
- results.add(singleResult);
- }
- return results;
- };
-
- }.doSwitch(featureValue);
- return result;
- }
-
-
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionConfigurationModelCreation.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionConfigurationModelCreation.java
deleted file mode 100644
index 5af9e6fcb2a..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionConfigurationModelCreation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.setvaluesactionconfiguration;
-
-import org.eclipse.papyrus.infra.extendedtypes.IActionConfigurationModelCreation;
-
-/**
- * {@link IActionConfigurationModelCreation} for {@link SetValuesActionConfiguration}
- */
-public class SetValuesActionConfigurationModelCreation implements IActionConfigurationModelCreation<SetValuesActionConfiguration> {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public SetValuesActionConfiguration createConfigurationModel() {
- return SetValuesActionConfigurationFactory.eINSTANCE.createSetValuesActionConfiguration();
- }
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionCreationElementValidator.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionCreationElementValidator.java
deleted file mode 100644
index 9495c16b42a..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionCreationElementValidator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.setvaluesactionconfiguration;
-
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.extendedtypes.IActionCreationElementValidator;
-import org.eclipse.papyrus.infra.extendedtypes.ICreationElementValidator;
-
-/**
- * {@link ICreationElementValidator} for {@link SetValuesActionConfiguration}
- */
-public class SetValuesActionCreationElementValidator implements IActionCreationElementValidator<SetValuesActionConfiguration> {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean canCreate(CreateElementRequest request) {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void init(SetValuesActionConfiguration configuration) {
- }
-}
diff --git a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionEditHelperAdvice.java b/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionEditHelperAdvice.java
deleted file mode 100644
index 3a34685e377..00000000000
--- a/plugins/infra/org.eclipse.papyrus.infra.extendedtypes.emf/src/org/eclipse/papyrus/infra/extendedtypes/emf/setvaluesactionconfiguration/SetValuesActionEditHelperAdvice.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Remi Schnekenburger (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.extendedtypes.emf.setvaluesactionconfiguration;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.infra.extendedtypes.IActionEditHelperAdvice;
-import org.eclipse.papyrus.infra.extendedtypes.emf.Activator;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-
-/**
- * advice for the {@link SetValuesActionConfiguration}
- */
-public class SetValuesActionEditHelperAdvice extends AbstractEditHelperAdvice implements IActionEditHelperAdvice<SetValuesActionConfiguration> {
-
- /** list of the features to set */
- // protected Map<String, FeatureValue> featuresToValues = null;
- /** list of runtime defined features */
- // protected Map<String, FeatureValue> featuresToRuntimeDefinitions = null;
-
- /** list of static defined features */
- protected Map<String, FeatureValue> featuresToStaticDefinitions = null;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void init(SetValuesActionConfiguration configuration) {
- // featuresToRuntimeDefinitions = new HashMap<String, FeatureValue>();
- featuresToStaticDefinitions = new HashMap<String, FeatureValue>();
- if (configuration == null) {
- return;
- }
- for (FeatureToSet featureToSet : configuration.getFeaturesToSet()) {
- featuresToStaticDefinitions.put(featureToSet.getFeatureName(), featureToSet.getValue());
- }
- }
-
- /**
- * Default Constructor
- */
- public SetValuesActionEditHelperAdvice() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean approveRequest(IEditCommandRequest request) {
- return super.approveRequest(request);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected ICommand getBeforeCreateCommand(CreateElementRequest request) {
- return super.getBeforeCreateCommand(request);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected ICommand getAfterCreateCommand(CreateElementRequest request) {
- return super.getAfterCreateCommand(request);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected ICommand getBeforeConfigureCommand(ConfigureRequest request) {
- return super.getBeforeConfigureCommand(request);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected ICommand getAfterConfigureCommand(ConfigureRequest request) {
- ICommand resultCommand = null;
-
- // retrieve eobject
- EObject elementToConfigure = request.getElementToConfigure();
- if (elementToConfigure == null) {
- return null;
- }
- // retrieve edit service to get features from configure command
- IElementEditService service = ElementEditServiceUtils.getCommandProvider(elementToConfigure);
- if (service == null) {
- Activator.log.error("Impossible to get edit service from element: " + elementToConfigure, null);
- return null;
- }
-
- for (Entry<String, FeatureValue> featureEntry : featuresToStaticDefinitions.entrySet()) {
- // retrieve feature value
- ICommand command = getSetFeatureValueCommand(elementToConfigure, featureEntry.getKey(), featureEntry.getValue(), service, request);
- if (command != null) {
- if (resultCommand == null) {
- resultCommand = command;
- } else {
- resultCommand = resultCommand.compose(command);
- }
- }
- }
-
- // if(!featuresToRuntimeDefinitions.isEmpty()) {
- // ICommand command = getDynamicSetFeatureValueCommand(elementToConfigure, featuresToRuntimeDefinitions, service, request);
- // if(command !=null) {
- // if(resultCommand == null) {
- // resultCommand = command;
- // } else {
- // resultCommand = resultCommand.compose(command);
- // }
- // }
- // }
-
-
- if (resultCommand != null) {
- return resultCommand.reduce();
- }
-
-
- return super.getAfterConfigureCommand(request);
- }
-
-
- /**
- * @param elementToConfigure
- * the eobject to configure
- * @param name
- * the name of the feature to set
- * @param value
- * the new value of the feature
- */
- protected ICommand getSetFeatureValueCommand(EObject elementToConfigure, String name, FeatureValue featureValue, IElementEditService service, ConfigureRequest configureRequest) {
- if (name == null) {
- Activator.log.debug("No feature name has been set.");
- return null;
- }
- if (elementToConfigure.eClass() == null) {
- Activator.log.error("Impossible to find EClass from EObject: " + elementToConfigure, null);
- return null;
- }
- // retrieve structural feature for the element to configure
- EStructuralFeature feature = elementToConfigure.eClass().getEStructuralFeature(name);
- if (feature == null) {
- Activator.log.error("Impossible to find feature " + name + " for eobject " + elementToConfigure, null);
- return null;
- }
- Object value = FeatureValueUtils.getValue(elementToConfigure, feature, featureValue);
- SetRequest request = new SetRequest(elementToConfigure, feature, value);
- // duplicate parameters from configure request?
- request.addParameters(configureRequest.getParameters());
- return service.getEditCommand(request);
- }
-}

Back to the top