diff options
Diffstat (limited to 'deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml')
30 files changed, 0 insertions, 2363 deletions
diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/Activator.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/Activator.java deleted file mode 100644 index b0b5e972881..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/Activator.java +++ /dev/null @@ -1,45 +0,0 @@ -/*******************************************************************************
- * Copyright (c) 2010 Mia-Software.
- * 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:
- * Nicolas Bros (Mia-Software)
- *******************************************************************************/
-package org.eclipse.papyrus.sysml.facets;
-
-import org.eclipse.core.runtime.Plugin;
-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.sysml.facets"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- @Override
- public void start(final BundleContext context) throws Exception {
- super.start(context);
- Activator.plugin = this;
- }
-
- @Override
- public void stop(final BundleContext context) throws Exception {
- Activator.plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return Activator.plugin;
- }
-}
diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/NAFlowPortDirection.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/NAFlowPortDirection.java deleted file mode 100644 index fa4ef9b6907..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/NAFlowPortDirection.java +++ /dev/null @@ -1,198 +0,0 @@ -/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.emf.common.util.Enumerator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the literals of the enumeration '<em><b>NA Flow Port Direction</b></em>',
- * and utility methods for working with them.
- * <!-- end-user-doc -->
- *
- * @see org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.PortandflowsPackage#getNAFlowPortDirection()
- * @model instanceClass="org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.NAFlowPortDirection"
- * @generated
- */
-public enum NAFlowPortDirection implements Enumerator {
- /**
- * The '<em><b>NA</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @see #NA_VALUE
- * @generated
- * @ordered
- */
- NA(0, "NA", "N/A");
-
- /**
- * The '<em><b>NA</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>NA</b></em>' literal object isn't clear, there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- *
- * @see #NA
- * @model literal="N/A"
- * @generated
- * @ordered
- */
- public static final int NA_VALUE = 0;
-
- /**
- * An array of all the '<em><b>NA Flow Port Direction</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- private static final NAFlowPortDirection[] VALUES_ARRAY = new NAFlowPortDirection[]{ NA, };
-
- /**
- * A public read-only list of all the '<em><b>NA Flow Port Direction</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public static final List<NAFlowPortDirection> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
-
- /**
- * Returns the '<em><b>NA Flow Port Direction</b></em>' literal with the specified literal value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public static NAFlowPortDirection get(String literal) {
- for(int i = 0; i < VALUES_ARRAY.length; ++i) {
- NAFlowPortDirection result = VALUES_ARRAY[i];
- if(result.toString().equals(literal)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>NA Flow Port Direction</b></em>' literal with the specified name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public static NAFlowPortDirection getByName(String name) {
- for(int i = 0; i < VALUES_ARRAY.length; ++i) {
- NAFlowPortDirection result = VALUES_ARRAY[i];
- if(result.getName().equals(name)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>NA Flow Port Direction</b></em>' literal with the specified integer value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public static NAFlowPortDirection get(int value) {
- switch(value) {
- case NA_VALUE:
- return NA;
- }
- return null;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- private final int value;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- private final String name;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- private final String literal;
-
- /**
- * Only this class can construct instances.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- private NAFlowPortDirection(int value, String name, String literal) {
- this.value = value;
- this.name = name;
- this.literal = literal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public int getValue() {
- return value;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public String getLiteral() {
- return literal;
- }
-
- /**
- * Returns the literal value of the enumerator, which is its string representation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public String toString() {
- return literal;
- }
-
-} //NAFlowPortDirection
diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/PortandflowsFactory.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/PortandflowsFactory.java deleted file mode 100644 index 8517e729810..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/PortandflowsFactory.java +++ /dev/null @@ -1,41 +0,0 @@ -/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows;
-
-import org.eclipse.emf.ecore.EFactory;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- *
- * @see org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.PortandflowsPackage
- * @generated
- */
-public interface PortandflowsFactory extends EFactory {
-
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- PortandflowsFactory eINSTANCE = org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.impl.PortandflowsFactoryImpl.init();
-
- /**
- * Returns the package supported by this factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @return the package supported by this factory.
- * @generated
- */
- PortandflowsPackage getPortandflowsPackage();
-
-} //PortandflowsFactory
diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/PortandflowsPackage.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/PortandflowsPackage.java deleted file mode 100644 index d29c765c961..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/PortandflowsPackage.java +++ /dev/null @@ -1,130 +0,0 @@ -/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows;
-
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- *
- * @see org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.PortandflowsFactory
- * @model kind="package"
- * @generated
- */
-public interface PortandflowsPackage extends EPackage {
-
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- String eNAME = "portandflows";
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- String eNS_URI = "http://www.eclipse.org/papyrus/0.7.0/ExtendedSysML/PortAndFlows";
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- String eNS_PREFIX = "PortAndFlows";
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- PortandflowsPackage eINSTANCE = org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.impl.PortandflowsPackageImpl.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.NAFlowPortDirection
- * <em>NA Flow Port Direction</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @see org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.NAFlowPortDirection
- * @see org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.impl.PortandflowsPackageImpl#getNAFlowPortDirection()
- * @generated
- */
- int NA_FLOW_PORT_DIRECTION = 0;
-
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.NAFlowPortDirection
- * <em>NA Flow Port Direction</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @return the meta object for enum '<em>NA Flow Port Direction</em>'.
- * @see org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.NAFlowPortDirection
- * @generated
- */
- EEnum getNAFlowPortDirection();
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @return the factory that creates the instances of the model.
- * @generated
- */
- PortandflowsFactory getPortandflowsFactory();
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- *
- * @generated
- */
- interface Literals {
-
- /**
- * The meta object literal for the '{@link org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.NAFlowPortDirection
- * <em>NA Flow Port Direction</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @see org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.NAFlowPortDirection
- * @see org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.impl.PortandflowsPackageImpl#getNAFlowPortDirection()
- * @generated
- */
- EEnum NA_FLOW_PORT_DIRECTION = eINSTANCE.getNAFlowPortDirection();
-
- }
-
-} //PortandflowsPackage
diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/impl/PortandflowsFactoryImpl.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/impl/PortandflowsFactoryImpl.java deleted file mode 100644 index 37cb7a4d18d..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/impl/PortandflowsFactoryImpl.java +++ /dev/null @@ -1,149 +0,0 @@ -/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.impl;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-import org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.NAFlowPortDirection;
-import org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.PortandflowsFactory;
-import org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.PortandflowsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Factory</b>.
- * <!-- end-user-doc -->
- *
- * @generated
- */
-public class PortandflowsFactoryImpl extends EFactoryImpl implements PortandflowsFactory {
-
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public static PortandflowsFactory init() {
- try {
- PortandflowsFactory thePortandflowsFactory = (PortandflowsFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/papyrus/0.7.0/ExtendedSysML/PortAndFlows");
- if(thePortandflowsFactory != null) {
- return thePortandflowsFactory;
- }
- } catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new PortandflowsFactoryImpl();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public PortandflowsFactoryImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public EObject create(EClass eClass) {
- switch(eClass.getClassifierID()) {
- default:
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Object createFromString(EDataType eDataType, String initialValue) {
- switch(eDataType.getClassifierID()) {
- case PortandflowsPackage.NA_FLOW_PORT_DIRECTION:
- return createNAFlowPortDirectionFromString(eDataType, initialValue);
- default:
- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public String convertToString(EDataType eDataType, Object instanceValue) {
- switch(eDataType.getClassifierID()) {
- case PortandflowsPackage.NA_FLOW_PORT_DIRECTION:
- return convertNAFlowPortDirectionToString(eDataType, instanceValue);
- default:
- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public NAFlowPortDirection createNAFlowPortDirectionFromString(EDataType eDataType, String initialValue) {
- NAFlowPortDirection result = NAFlowPortDirection.get(initialValue);
- if(result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public String convertNAFlowPortDirectionToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public PortandflowsPackage getPortandflowsPackage() {
- return (PortandflowsPackage)getEPackage();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @deprecated
- * @generated
- */
- @Deprecated
- public static PortandflowsPackage getPackage() {
- return PortandflowsPackage.eINSTANCE;
- }
-
-} //PortandflowsFactoryImpl
diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/impl/PortandflowsPackageImpl.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/impl/PortandflowsPackageImpl.java deleted file mode 100644 index 81111ed61fa..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/extendedsysml/extendedsysml/portandflows/impl/PortandflowsPackageImpl.java +++ /dev/null @@ -1,173 +0,0 @@ -/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.impl;
-
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-import org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.NAFlowPortDirection;
-import org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.PortandflowsFactory;
-import org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.PortandflowsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Package</b>.
- * <!-- end-user-doc -->
- *
- * @generated
- */
-public class PortandflowsPackageImpl extends EPackageImpl implements PortandflowsPackage {
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- private EEnum naFlowPortDirectionEEnum = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the
- * package
- * package URI value.
- * <p>
- * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also performs initialization of the
- * package, or returns the registered package, if one already exists. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.PortandflowsPackage#eNS_URI
- * @see #init()
- * @generated
- */
- private PortandflowsPackageImpl() {
- super(eNS_URI, PortandflowsFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
- *
- * <p>
- * This method is used to initialize {@link PortandflowsPackage#eINSTANCE} when that field is accessed. Clients should not invoke it directly.
- * Instead, they should simply access that field to obtain the package. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static PortandflowsPackage init() {
- if(isInited)
- return (PortandflowsPackage)EPackage.Registry.INSTANCE.getEPackage(PortandflowsPackage.eNS_URI);
-
- // Obtain or create and register package
- PortandflowsPackageImpl thePortandflowsPackage = (PortandflowsPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof PortandflowsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PortandflowsPackageImpl());
-
- isInited = true;
-
- // Create package meta-data objects
- thePortandflowsPackage.createPackageContents();
-
- // Initialize created meta-data
- thePortandflowsPackage.initializePackageContents();
-
- // Mark meta-data to indicate it can't be changed
- thePortandflowsPackage.freeze();
-
-
- // Update the registry and return the package
- EPackage.Registry.INSTANCE.put(PortandflowsPackage.eNS_URI, thePortandflowsPackage);
- return thePortandflowsPackage;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public EEnum getNAFlowPortDirection() {
- return naFlowPortDirectionEEnum;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public PortandflowsFactory getPortandflowsFactory() {
- return (PortandflowsFactory)getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public void createPackageContents() {
- if(isCreated)
- return;
- isCreated = true;
-
- // Create enums
- naFlowPortDirectionEEnum = createEEnum(NA_FLOW_PORT_DIRECTION);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- public void initializePackageContents() {
- if(isInitialized)
- return;
- isInitialized = true;
-
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
-
- // Initialize enums and add enum literals
- initEEnum(naFlowPortDirectionEEnum, NAFlowPortDirection.class, "NAFlowPortDirection");
- addEEnumLiteral(naFlowPortDirectionEEnum, NAFlowPortDirection.NA);
-
- // Create resource
- createResource(eNS_URI);
- }
-
-} //PortandflowsPackageImpl
diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/messages/Messages.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/messages/Messages.java deleted file mode 100644 index fe75aa339c7..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/messages/Messages.java +++ /dev/null @@ -1,40 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2011 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.sysml.facets.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.sysml.facets.messages.messages"; //$NON-NLS-1$
-
- public static String SetRequirementDerivedFromQuery_DeriveReqtCantBeCreated;
-
- public static String SetRequirementDerivedQuery_DeriveReqtCanBeCreated;
-
- public static String SetRequirementMasterQuery_CopyCantBeCreated;
-
- public static String SetRequirementRefinedByQuery_StandardIsNotAppliedOnTheModel;
-
- public static String SetRequirementTextQuery_AssignmentCantBeDone;
-
- public static String SetRequirementTextQuery_NotASysMLRequirement;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/messages/messages.properties b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/messages/messages.properties deleted file mode 100644 index ab7c93339f5..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/messages/messages.properties +++ /dev/null @@ -1,6 +0,0 @@ -SetRequirementDerivedFromQuery_DeriveReqtCantBeCreated=The link DeriveReqt can't be created between {0} and {1}.
-SetRequirementDerivedQuery_DeriveReqtCanBeCreated=The link DeriveReqt can't be created between {0} and {1}.
-SetRequirementMasterQuery_CopyCantBeCreated=The link Copy can't be created between {0} and {1}.
-SetRequirementRefinedByQuery_StandardIsNotAppliedOnTheModel=The required profile Standard is not applied on the model.
-SetRequirementTextQuery_AssignmentCantBeDone=Assignment can't be done.
-SetRequirementTextQuery_NotASysMLRequirement=The edited element is not a SysML Requirement.
diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/portandflows/query/value/getter/GetFlowPortDirectionQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/portandflows/query/value/getter/GetFlowPortDirectionQuery.java deleted file mode 100644 index 636ee52d23c..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/portandflows/query/value/getter/GetFlowPortDirectionQuery.java +++ /dev/null @@ -1,37 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.portandflows.query.value.getter; - -import org.eclipse.emf.common.util.Enumerator; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.NAFlowPortDirection; -import org.eclipse.papyrus.sysml.portandflows.FlowPort; -import org.eclipse.uml2.uml.Port; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to qet the attribute "Direction" of the FlowPort */ -public class GetFlowPortDirectionQuery implements IJavaModelQuery<Port, Enumerator> { - - public Enumerator evaluate(final Port context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - FlowPort flowPort = UMLUtil.getStereotypeApplication(context, FlowPort.class); - if(flowPort != null) { - if(flowPort.isAtomic()) { - return flowPort.getDirection(); - } else { - return NAFlowPortDirection.get(0); - } - } - return null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/portandflows/query/value/getter/GetFlowPortIsAtomicQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/portandflows/query/value/getter/GetFlowPortIsAtomicQuery.java deleted file mode 100644 index bd305a936c1..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/portandflows/query/value/getter/GetFlowPortIsAtomicQuery.java +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.portandflows.query.value.getter; - -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.portandflows.FlowPort; -import org.eclipse.uml2.uml.Port; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to get the derived attribute "isAtomic" of the FlowPort */ -public class GetFlowPortIsAtomicQuery implements IJavaModelQuery<Port, Boolean> { - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) - * - * @param context - * @param parameterValues - * @return - * @throws ModelQueryExecutionException - */ - public Boolean evaluate(final Port context, final ParameterValueList parameterValues) - throws ModelQueryExecutionException { - FlowPort flowPort = UMLUtil.getStereotypeApplication(context, FlowPort.class); - if(flowPort != null) { - return flowPort.isAtomic(); - } - return null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/portandflows/query/value/setter/SetFlowPortDirectionQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/portandflows/query/value/setter/SetFlowPortDirectionQuery.java deleted file mode 100644 index 3517b252da2..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/portandflows/query/value/setter/SetFlowPortDirectionQuery.java +++ /dev/null @@ -1,73 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.portandflows.query.value.setter; - -import org.eclipse.emf.common.util.Enumerator; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.gmf.diagram.common.commands.IdentityCommandWithNotification; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; -import org.eclipse.papyrus.sysml.facets.extendedsysml.extendedsysml.portandflows.NAFlowPortDirection; -import org.eclipse.papyrus.sysml.facets.messages.Messages; -import org.eclipse.papyrus.sysml.portandflows.FlowPort; -import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; -import org.eclipse.uml2.uml.Port; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to qet the attribute "Direction" of the FlowPort */ -public class SetFlowPortDirectionQuery implements IJavaModelQueryWithEditingDomain<Port, Enumerator> { - - public Enumerator evaluate(final Port context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - //nothing to do - return null; - } - - - public Enumerator evaluate(Port context, ParameterValueList parameterValues, EditingDomain editingDomain) throws ModelQueryExecutionException { - FlowPort flowPort = UMLUtil.getStereotypeApplication(context, FlowPort.class); - - if(flowPort != null) { - if(!((parameterValues.isEmpty()) || (parameterValues.get(0) == null))) { - - - - // Retrieve new value from parameter and update if the property value has changed. - Enumerator newValue = (parameterValues.get(0).getValue() instanceof Enumerator) ? (Enumerator)parameterValues.get(0).getValue() : null; - if(!(newValue instanceof NAFlowPortDirection)) {//we do nothing in this case - if(newValue != flowPort.getDirection()) { - try { - TransactionalEditingDomain domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(flowPort); - SetCommand command = new SetCommand(domain, flowPort, PortandflowsPackage.eINSTANCE.getFlowPort_Direction(), newValue); - if(command.canExecute()) { - domain.getCommandStack().execute(command); - } - - } catch (ServiceException e) { - throw new ModelQueryExecutionException(e); - } - - } - } - } - } else { - editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, "The edited element is not a SysML FlowPort.", Type.ERROR))); - } - return null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementBase_ClassQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementBase_ClassQuery.java deleted file mode 100644 index 025ba56a8d6..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementBase_ClassQuery.java +++ /dev/null @@ -1,30 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.getter; - -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to get the text of the requirement */ -public class GetRequirementBase_ClassQuery implements IJavaModelQuery<Class, Class> { - - public Class evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - return (requirement != null) ? requirement.getBase_Class() : null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedFromQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedFromQuery.java deleted file mode 100644 index 83b1f1db01c..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedFromQuery.java +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.getter; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to get the text of the requirement */ -public class GetRequirementDerivedFromQuery implements IJavaModelQuery<Class, Collection<Class>> { - - public Collection<Class> evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - Collection<Class> result = new ArrayList<Class>(); - - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - if(requirement != null) { - for(Requirement current : requirement.getDerivedFrom()) { - result.add(current.getBase_Class()); - } - } - return result; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedQuery.java deleted file mode 100644 index 63eb8e4b9e5..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementDerivedQuery.java +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.getter; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to get the text of the requirement */ -public class GetRequirementDerivedQuery implements IJavaModelQuery<Class, Collection<Class>> { - - public Collection<Class> evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - Collection<Class> result = new ArrayList<Class>(); - - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - if(requirement != null) { - for(Requirement current : requirement.getDerived()) { - result.add(current.getBase_Class()); - } - } - return result; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementIdQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementIdQuery.java deleted file mode 100644 index 7103bc1f514..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementIdQuery.java +++ /dev/null @@ -1,30 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.getter; - -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to get the id of the requirement */ -public class GetRequirementIdQuery implements IJavaModelQuery<Class, String> { - - public String evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - return (requirement != null) ? requirement.getId() : null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementMasterQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementMasterQuery.java deleted file mode 100644 index 55baa02992d..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementMasterQuery.java +++ /dev/null @@ -1,30 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.getter; - -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to get the text of the requirement */ -public class GetRequirementMasterQuery implements IJavaModelQuery<Class, Class> { - - public Class evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - return ((requirement != null) && (requirement.getMaster() != null)) ? requirement.getMaster().getBase_Class() : null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementRefinedByQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementRefinedByQuery.java deleted file mode 100644 index e3d080fc385..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementRefinedByQuery.java +++ /dev/null @@ -1,33 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.getter; - -import java.util.Collection; - -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to get the text of the requirement */ -public class GetRequirementRefinedByQuery implements IJavaModelQuery<Class, Collection<NamedElement>> { - - public Collection<NamedElement> evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - return (requirement != null) ? requirement.getRefinedBy() : null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementSatifiedByQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementSatifiedByQuery.java deleted file mode 100644 index aba70bf3670..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementSatifiedByQuery.java +++ /dev/null @@ -1,33 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.getter; - -import java.util.Collection; - -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to get the text of the requirement */ -public class GetRequirementSatifiedByQuery implements IJavaModelQuery<Class, Collection<NamedElement>> { - - public Collection<NamedElement> evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - return (requirement != null) ? requirement.getSatisfiedBy() : null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTextQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTextQuery.java deleted file mode 100644 index c9f3020182f..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTextQuery.java +++ /dev/null @@ -1,30 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.getter; - -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to get the text of the requirement */ -public class GetRequirementTextQuery implements IJavaModelQuery<Class, String> { - - public String evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - return (requirement != null) ? requirement.getText() : null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTracedToQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTracedToQuery.java deleted file mode 100644 index c454df504f5..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementTracedToQuery.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.getter; - -import java.util.Collection; - -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Query to get the text of the requirement - */ -public class GetRequirementTracedToQuery implements IJavaModelQuery<Class, Collection<NamedElement>> { - - public Collection<NamedElement> evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - return (requirement != null) ? requirement.getTracedTo() : null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementVerifiedByQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementVerifiedByQuery.java deleted file mode 100644 index e1119eeb045..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/getter/GetRequirementVerifiedByQuery.java +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.getter; - -import java.util.Collection; - -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to get the text of the requirement */ - -public class GetRequirementVerifiedByQuery implements IJavaModelQuery<Class, Collection<NamedElement>> { - - public Collection<NamedElement> evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - if(requirement != null) { - return requirement.getVerifiedBy(); - } - return null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementDerivedFromQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementDerivedFromQuery.java deleted file mode 100644 index afb3a5f9fb7..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementDerivedFromQuery.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * - * Copyright (c) 2011 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: - * Vincent Lorenzo(CEA LIST) - initial API and implementation - */ -package org.eclipse.papyrus.sysml.facets.query.value.setter; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.gmf.diagram.common.commands.IdentityCommandWithNotification; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; -import org.eclipse.papyrus.sysml.facets.messages.Messages; -import org.eclipse.papyrus.sysml.requirements.DeriveReqt; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Dependency; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to set the derived attribute "derived" of the requirement */ -public class SetRequirementDerivedFromQuery implements IJavaModelQueryWithEditingDomain<Class, EObject> { - - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) - * - * @param context - * @param parameterValues - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - //nothing to do - return null; - } - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain) - * - * @param arg0 - * @param parameter - * @param arg2 - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(final Class context, final ParameterValueList parameter, final EditingDomain editingDomain) throws ModelQueryExecutionException { - CompositeCommand cmd = new CompositeCommand("Edit the feature /DerivedFrom"); //$NON-NLS-1$ - /* - * we need to do this test, because, the facets can be applied on a default table. - * In this case, we can't be sure the edited element is a Requirement - */ - if(UMLUtil.getStereotypeApplication(context, Requirement.class) != null) { - Requirement req = UMLUtil.getStereotypeApplication(context, Requirement.class); - EList<Dependency> dependencies = context.getClientDependencies(); - EList<Requirement> currentDerivedFrom = req.getDerivedFrom(); - List<Class> currentDerivedFrom_base_Class = new ArrayList<Class>(); - for(Requirement currentReq : currentDerivedFrom) { - currentDerivedFrom_base_Class.add(currentReq.getBase_Class()); - } - - - ModelQueryParameterValue object = parameter.get(0); - Object values = object.getValue(); - Assert.isTrue(values instanceof List<?>); - List<?> newDerivedFrom = (List<?>)values; - - //we destroy the unnecessary Derive_Reqt - for(Dependency current : dependencies) { - if(UMLUtil.getStereotypeApplication(current, DeriveReqt.class) != null) { - EList<NamedElement> suppliers = current.getSuppliers(); - //we assume that there is only one supplier - if(suppliers.size() == 1) { - NamedElement supplier = suppliers.get(0); - if(!newDerivedFrom.contains(supplier)) {//we destroy this dependencies - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(current); - DestroyElementRequest request = new DestroyElementRequest(current, false); - ICommand desroyCommand = provider.getEditCommand(request); - cmd.add(desroyCommand); - } - } - } - } - - for(Object current : (List<?>)values) { - //we create the derive_reqt only if it doesn't exist - - if(!currentDerivedFrom_base_Class.contains(current)) { - if(UMLUtil.getStereotypeApplication(context, Requirement.class) != null) { - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(context); - CreateRelationshipRequest createRequest = new CreateRelationshipRequest(context.getNearestPackage(), context, (EObject)current, SysMLElementTypes.DERIVE_REQT); - cmd.add(provider.getEditCommand(createRequest)); - } else { - - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, NLS.bind(Messages.SetRequirementDerivedFromQuery_DeriveReqtCantBeCreated, context.getName(), ((NamedElement)current).getName()), Type.ERROR)); - } - } - } - } else { - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, Messages.SetRequirementTextQuery_NotASysMLRequirement, Type.ERROR)); - } - editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd)); - return null; - } - -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementDerivedQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementDerivedQuery.java deleted file mode 100644 index 6dcb8676ce5..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementDerivedQuery.java +++ /dev/null @@ -1,133 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.setter; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.gmf.diagram.common.commands.IdentityCommandWithNotification; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; -import org.eclipse.papyrus.sysml.facets.messages.Messages; -import org.eclipse.papyrus.sysml.requirements.DeriveReqt; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Dependency; -import org.eclipse.uml2.uml.DirectedRelationship; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to set the derived attribute "derived" of the requirement */ -public class SetRequirementDerivedQuery implements IJavaModelQueryWithEditingDomain<Class, EObject> { - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) - * - * @param context - * @param parameterValues - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(Class context, ParameterValueList parameterValues) throws ModelQueryExecutionException { - //nothing to do - return null; - } - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain) - * - * @param context - * @param parameterValues - * @param editingDomain - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(Class context, ParameterValueList parameter, EditingDomain editingDomain) throws ModelQueryExecutionException { - CompositeCommand cmd = new CompositeCommand("Edit the feature /Derived"); //$NON-NLS-1$ - if(UMLUtil.getStereotypeApplication(context, Requirement.class) != null) { - Requirement req = UMLUtil.getStereotypeApplication(context, Requirement.class); - - EList<DirectedRelationship> dependencies = context.getTargetDirectedRelationships(); - EList<Requirement> currentDerived = req.getDerived(); - List<Class> currentDerived_base_Class = new ArrayList<Class>(); - for(Requirement currentReq : currentDerived) { - currentDerived_base_Class.add(currentReq.getBase_Class()); - } - - - ModelQueryParameterValue object = parameter.get(0); - Object values = object.getValue(); - Assert.isTrue(values instanceof List<?>); - List<?> newDerivedFrom = (List<?>)values; - - //we destroy the unnecessary Derive_Reqt - for(DirectedRelationship current : dependencies) { - if(UMLUtil.getStereotypeApplication(current, DeriveReqt.class) != null) { - EList<NamedElement> clients = ((Dependency)current).getClients(); - //we assume that there is only one client - if(clients.size() == 1) { - NamedElement supplier = clients.get(0); - if(!newDerivedFrom.contains(supplier)) {//we destroy this dependencies - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(current); - DestroyElementRequest request = new DestroyElementRequest(current, false); - ICommand desroyCommand = provider.getEditCommand(request); - cmd.add(desroyCommand); - } - } - } - } - - - for(Object current : (List<?>)values) { - //we create the derive_reqt only if it doesn't exist - if(!currentDerived_base_Class.contains(current)) { - if(UMLUtil.getStereotypeApplication(context, Requirement.class) != null) { - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(context); - - CreateElementRequest createRequest = new CreateRelationshipRequest(context.getNearestPackage(), (EObject)current, context, SysMLElementTypes.DERIVE_REQT); - cmd.add(provider.getEditCommand(createRequest)); - } else { - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, NLS.bind(Messages.SetRequirementDerivedQuery_DeriveReqtCanBeCreated, context.getName(), ((NamedElement)current).getName()), Type.ERROR)); - } - } - - } - } else { - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, Messages.SetRequirementTextQuery_NotASysMLRequirement, Type.ERROR)); - } - editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd)); - return null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementIdQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementIdQuery.java deleted file mode 100644 index d83a07373e0..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementIdQuery.java +++ /dev/null @@ -1,96 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.setter; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.gmf.diagram.common.commands.IdentityCommandWithNotification; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; -import org.eclipse.papyrus.sysml.facets.messages.Messages; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.papyrus.sysml.requirements.RequirementsPackage; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to set the attribute "id" of the requirement */ -public class SetRequirementIdQuery implements IJavaModelQueryWithEditingDomain<Class, EObject> { - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) - * - * @param context - * @param parameterValues - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - //nothing to do - return null; - } - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain) - * - * @param arg0 - * @param parameter - * @param arg2 - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(final Class context, final ParameterValueList parameter, final EditingDomain editingDomain) throws ModelQueryExecutionException { - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - - if(requirement != null) { - if(!((parameter.isEmpty()) || (parameter.get(0) == null))) { - - - - // Retrieve new value from parameter and update if the property value has changed. - String newValue = (parameter.get(0).getValue() instanceof String) ? (String)parameter.get(0).getValue() : null; - if(newValue != requirement.getId()) { - - try { - - TransactionalEditingDomain domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(requirement); - SetCommand command = new SetCommand(domain, requirement, RequirementsPackage.eINSTANCE.getRequirement_Id(), newValue); - if(command.canExecute()) { - domain.getCommandStack().execute(command); - } - - } catch (ServiceException e) { - throw new ModelQueryExecutionException(e); - } - - } - } - } else { - editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, Messages.SetRequirementTextQuery_NotASysMLRequirement, Type.ERROR))); - } - - return context; - } - -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementMasterQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementMasterQuery.java deleted file mode 100644 index b118e058fe7..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementMasterQuery.java +++ /dev/null @@ -1,121 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.setter; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.osgi.util.NLS; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.gmf.diagram.common.commands.IdentityCommandWithNotification; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; -import org.eclipse.papyrus.sysml.facets.messages.Messages; -import org.eclipse.papyrus.sysml.requirements.Copy; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Dependency; -import org.eclipse.uml2.uml.DirectedRelationship; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to set the derived attribute "master" of the requirement */ -public class SetRequirementMasterQuery implements IJavaModelQueryWithEditingDomain<Class, EObject> { - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) - * - * @param context - * @param parameterValues - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - // nothing to do - return null; - } - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain) - * - * @param context - * @param parameterValues - * @param editingDomain - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(Class context, ParameterValueList parameterValues, EditingDomain editingDomain) throws ModelQueryExecutionException { - CompositeCommand cmd = new CompositeCommand("Edit the derived attribute /master"); //$NON-NLS-1$ - ModelQueryParameterValue object = parameterValues.get(0); - Object value = object.getValue(); - Class newMaster = null; - if(UMLUtil.getStereotypeApplication(context, Requirement.class) != null) { - if(value != null) { - Assert.isTrue(value instanceof Class); - newMaster = (Class)value; - } - Assert.isTrue(UMLUtil.getStereotypeApplication(context, Requirement.class) != null); - - EList<Dependency> dependencies = context.getClientDependencies(); - - //we destroy the unnecessary Copy - for(DirectedRelationship current : dependencies) { - if(UMLUtil.getStereotypeApplication(current, Copy.class) != null) { - EList<NamedElement> target = ((Dependency)current).getSuppliers(); - //we assume that there is only one client - if(target.size() == 1) { - NamedElement client = target.get(0); - if(newMaster != client) {//we destroy this dependency - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(current); - DestroyElementRequest request = new DestroyElementRequest(current, false); - ICommand destroyCommand = provider.getEditCommand(request); - cmd.add(destroyCommand); - } - } - } - } - - if(newMaster != null) { - if(UMLUtil.getStereotypeApplication(newMaster, Requirement.class) != null) { - //we create the Element Copy - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(context); - CreateElementRequest createRequest = new CreateRelationshipRequest(context.getNearestPackage(), context, newMaster, SysMLElementTypes.COPY); - cmd.add(provider.getEditCommand(createRequest)); - } else { - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, NLS.bind(Messages.SetRequirementMasterQuery_CopyCantBeCreated, context.getName(), ((NamedElement)newMaster).getName()), Type.ERROR)); - } - } - } else { - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, Messages.SetRequirementTextQuery_NotASysMLRequirement, Type.ERROR)); - } - editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd)); - return null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementRefinedByQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementRefinedByQuery.java deleted file mode 100644 index 12e6ed4fe41..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementRefinedByQuery.java +++ /dev/null @@ -1,125 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.setter; - -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.gmf.diagram.common.commands.IdentityCommandWithNotification; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; -import org.eclipse.papyrus.sysml.facets.messages.Messages; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.papyrus.sysml.util.ElementUtil; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.uml2.uml.Dependency; -import org.eclipse.uml2.uml.DirectedRelationship; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.profile.l2.L2Package; -import org.eclipse.uml2.uml.profile.l2.Refine; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to set the derived attribute "refinedBy" of the requirement */ -public class SetRequirementRefinedByQuery implements IJavaModelQueryWithEditingDomain<NamedElement, EObject> { - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) - * - * @param context - * @param parameterValues - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(final NamedElement context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - //nothing to do - return null; - } - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain) - * - * @param context - * @param parameterValues - * @param editingDomain - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(NamedElement context, ParameterValueList parameterValues, EditingDomain editingDomain) throws ModelQueryExecutionException { - CompositeCommand cmd = new CompositeCommand("Edit the feature /refinedBy"); //$NON-NLS-1$ - if(ElementUtil.getStereotypeApplication(context, Requirement.class) != null) { - if(!context.getNearestPackage().isProfileApplied(UMLUtil.getProfile(L2Package.eINSTANCE))) { - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, Messages.SetRequirementRefinedByQuery_StandardIsNotAppliedOnTheModel, Type.ERROR)); - } else { - Requirement req = UMLUtil.getStereotypeApplication(context, Requirement.class); - EList<DirectedRelationship> dependencies = context.getTargetDirectedRelationships(); - EList<NamedElement> currentRefinedBy = req.getRefinedBy(); - - - ModelQueryParameterValue object = parameterValues.get(0); - Object values = object.getValue(); - Assert.isTrue(values instanceof List<?>); - List<?> newRefinedBy = (List<?>)values; - - //we destroy the unnecessary Refine - for(DirectedRelationship current : dependencies) { - if(UMLUtil.getStereotypeApplication(current, Refine.class) != null) { - - EList<NamedElement> clients = ((Dependency)current).getClients(); - //we assume that there is only one client - if(clients.size() == 1) { - NamedElement client = clients.get(0); - if(!newRefinedBy.contains(client)) {//we destroy this dependencies - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(current); - DestroyElementRequest request = new DestroyElementRequest(current, false); - ICommand destroyCommand = provider.getEditCommand(request); - cmd.add(destroyCommand); - } - } - } - } - - for(Object current : (List<?>)values) { - //we create the Trace only if it doesn't exist - Assert.isTrue(current instanceof NamedElement); - if(!currentRefinedBy.contains(current)) { - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(context); - CreateRelationshipRequest createRequest = new CreateRelationshipRequest(context.getNearestPackage(), (NamedElement)current, context, UMLElementTypes.REFINE); - cmd.add(provider.getEditCommand(createRequest)); - } - } - } - } else { - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, Messages.SetRequirementTextQuery_NotASysMLRequirement, Type.ERROR)); - } - editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd)); - return null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementSatisfiedByQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementSatisfiedByQuery.java deleted file mode 100644 index 6aa6cc7a233..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementSatisfiedByQuery.java +++ /dev/null @@ -1,120 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.setter; - -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.gmf.diagram.common.commands.IdentityCommandWithNotification; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; -import org.eclipse.papyrus.sysml.facets.messages.Messages; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.papyrus.sysml.requirements.Satisfy; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.uml2.uml.Dependency; -import org.eclipse.uml2.uml.DirectedRelationship; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to set the derived attribute "satisfiedBy" of the requirement */ -public class SetRequirementSatisfiedByQuery implements IJavaModelQueryWithEditingDomain<NamedElement, EObject> { - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) - * - * @param context - * @param parameterValues - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(final NamedElement context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - // nothing to do - return null; - } - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain) - * - * @param context - * @param parameterValues - * @param editingDomain - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(NamedElement context, ParameterValueList parameterValues, EditingDomain editingDomain) throws ModelQueryExecutionException { - CompositeCommand cmd = new CompositeCommand("Edit the derived attribute /SatisfiedBy"); //$NON-NLS-1$ - if(UMLUtil.getStereotypeApplication(context, Requirement.class) != null) { - - Requirement req = UMLUtil.getStereotypeApplication(context, Requirement.class); - EList<DirectedRelationship> dependencies = context.getTargetDirectedRelationships(); - EList<NamedElement> currentSatisfiedBy = req.getSatisfiedBy(); - - - - ModelQueryParameterValue object = parameterValues.get(0); - Object values = object.getValue(); - Assert.isTrue(values instanceof List<?>); - List<?> newSatisfiedBy = (List<?>)values; - - //we destroy the unnecessary Satisfy - for(DirectedRelationship current : dependencies) { - if(UMLUtil.getStereotypeApplication(current, Satisfy.class) != null) { - EList<NamedElement> clients = ((Dependency)current).getClients(); - //we assume that there is only one client - if(clients.size() == 1) { - NamedElement client = clients.get(0); - if(!newSatisfiedBy.contains(client)) {//we destroy this dependencies - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(current); - DestroyElementRequest request = new DestroyElementRequest(current, false); - ICommand desroyCommand = provider.getEditCommand(request); - cmd.add(desroyCommand); - } - } - } - } - - for(Object current : (List<?>)values) { - //we create the derive_reqt only if it doesn't exist - Assert.isTrue(current instanceof NamedElement); - if(!currentSatisfiedBy.contains(current)) { - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(context); - CreateRelationshipRequest createRequest = new CreateRelationshipRequest(context.getNearestPackage(), (NamedElement)current, context, SysMLElementTypes.SATISFY); - cmd.add(provider.getEditCommand(createRequest)); - } - } - } else { - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, Messages.SetRequirementTextQuery_NotASysMLRequirement, Type.ERROR)); - } - editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd)); - return null; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementTextQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementTextQuery.java deleted file mode 100644 index bc87bed3aaa..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementTextQuery.java +++ /dev/null @@ -1,92 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.setter; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.gmf.diagram.common.commands.IdentityCommandWithNotification; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; -import org.eclipse.papyrus.sysml.facets.messages.Messages; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.papyrus.sysml.requirements.RequirementsPackage; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to set the attribute "text" of the requirement */ -public class SetRequirementTextQuery implements IJavaModelQueryWithEditingDomain<Class, EObject> { - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) - * - * @param context - * @param parameterValues - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - // nothing to do - return null; - } - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain) - * - * @param context - * @param parameter - * @param editingDomain - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(final Class context, final ParameterValueList parameter, final EditingDomain editingDomain) throws ModelQueryExecutionException { - Requirement requirement = UMLUtil.getStereotypeApplication(context, Requirement.class); - - if(requirement != null) { - if(!((parameter.isEmpty()) || (parameter.get(0) == null))) { - - // Retrieve new value from parameter and update if the property value has changed. - String newValue = (parameter.get(0).getValue() instanceof String) ? (String)parameter.get(0).getValue() : null; - if(newValue != requirement.getId()) { - - try { - - TransactionalEditingDomain domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context); - SetCommand command = new SetCommand(domain, requirement, RequirementsPackage.eINSTANCE.getRequirement_Text(), newValue); - if(command.canExecute()) { - domain.getCommandStack().execute(command); - } - - } catch (ServiceException e) { - throw new ModelQueryExecutionException(e); - } - - } - } - } else { - editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, Messages.SetRequirementTextQuery_NotASysMLRequirement, Type.ERROR))); - } - return context; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementTracedToQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementTracedToQuery.java deleted file mode 100644 index 590f09c7c5f..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementTracedToQuery.java +++ /dev/null @@ -1,150 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.setter; - -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.gmf.diagram.common.commands.IdentityCommandWithNotification; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; -import org.eclipse.papyrus.sysml.facets.messages.Messages; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.uml2.uml.Dependency; -import org.eclipse.uml2.uml.DirectedRelationship; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Stereotype; -import org.eclipse.uml2.uml.profile.l2.L2Package; -import org.eclipse.uml2.uml.profile.l2.Trace; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to set the derived attribute "tracedTo" of the requirement */ -public class SetRequirementTracedToQuery implements IJavaModelQueryWithEditingDomain<NamedElement, EObject> { - - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) - * - * @param context - * @param parameterValues - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(final NamedElement context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - // nothing to do - return null; - } - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain) - * - * @param context - * @param parameterValues - * @param editingDomain - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(NamedElement context, ParameterValueList parameterValues, EditingDomain editingDomain) throws ModelQueryExecutionException { - CompositeCommand cmd = new CompositeCommand("Edit the feature /TracedTo"); //$NON-NLS-1$ - int result = MessageDialog.OK; - if(UMLUtil.getStereotypeApplication(context, Requirement.class) != null) { - if(!context.getNearestPackage().isProfileApplied(UMLUtil.getProfile(L2Package.eINSTANCE))) { - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, Messages.SetRequirementRefinedByQuery_StandardIsNotAppliedOnTheModel, Type.ERROR)); - } else { - Requirement req = UMLUtil.getStereotypeApplication(context, Requirement.class); - EList<DirectedRelationship> dependencies = context.getTargetDirectedRelationships(); - - EList<?> currentTracedTo = req.getTracedTo(); - - ModelQueryParameterValue object = parameterValues.get(0); - Object values = object.getValue(); - Assert.isTrue(values instanceof List<?>); - List<?> newTracedTo = (List<?>)values; - - //we destroy the unnecessary tracedTo - for(DirectedRelationship current : dependencies) { - if(UMLUtil.getStereotypeApplication(current, Trace.class) != null && isStricteTrace(current)) { - EList<NamedElement> clients = ((Dependency)current).getClients(); - //we assume that there is only one client - if(clients.size() == 1) { - NamedElement client = clients.get(0); - if(!newTracedTo.contains(client)) {//we destroy this dependencies - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(current); - DestroyElementRequest request = new DestroyElementRequest(current, false); - ICommand desroyCommand = provider.getEditCommand(request); - cmd.add(desroyCommand); - } - - } - } - } - - for(Object current : (List<?>)values) { - //we create the Trace only if it doesn't exist - Assert.isTrue(current instanceof NamedElement); - if(!currentTracedTo.contains(current)) { - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(context); - CreateRelationshipRequest createRequest = new CreateRelationshipRequest(context.getNearestPackage(), (NamedElement)current, context, UMLElementTypes.TRACE); - cmd.add(provider.getEditCommand(createRequest)); - } - } - } - } else { - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, Messages.SetRequirementTextQuery_NotASysMLRequirement, Type.ERROR)); - } - if(result == MessageDialog.OK) { - editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd)); - } - return null; - } - - /** - * - * @param link - * a {@link DirectedRelationship} - * @return - * <code>true</code> if the link is Stereotyped with Trace (and <code>false</code> if the link is stereotyped with a subtype of Trace - */ - private boolean isStricteTrace(DirectedRelationship link) { - EList<Stereotype> appliedStereotypes = link.getAppliedStereotypes(); - for(Stereotype ste : appliedStereotypes) { - if((ste instanceof Trace)) { - EObject stereotypeApplication = link.getStereotypeApplication(ste); - if(Trace.class.isInstance(stereotypeApplication)) { - return true; - } - } - } - return false; - } -} diff --git a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementVerifiedByQuery.java b/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementVerifiedByQuery.java deleted file mode 100644 index a6894ffcd9e..00000000000 --- a/deprecated/org.eclipse.papyrus.sysml.facets/src/org/eclipse/papyrus/sysml/facets/query/value/setter/SetRequirementVerifiedByQuery.java +++ /dev/null @@ -1,120 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 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: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.facets.query.value.setter; - -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; -import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain; -import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; -import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.gmf.diagram.common.commands.IdentityCommandWithNotification; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; -import org.eclipse.papyrus.sysml.facets.messages.Messages; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.papyrus.sysml.requirements.Verify; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.uml2.uml.Dependency; -import org.eclipse.uml2.uml.DirectedRelationship; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** Query to set the derived attribute "verifiedBy" of the requirement */ -public class SetRequirementVerifiedByQuery implements IJavaModelQueryWithEditingDomain<NamedElement, EObject> { - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) - * - * @param context - * @param parameterValues - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(final NamedElement context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { - // TODO Auto-generated method stub - return null; - } - - /** - * - * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain) - * - * @param context - * @param parameterValues - * @param editingDomain - * @return - * @throws ModelQueryExecutionException - */ - public EObject evaluate(NamedElement context, ParameterValueList parameterValues, EditingDomain editingDomain) throws ModelQueryExecutionException { - CompositeCommand cmd = new CompositeCommand("Edit the feature /VerifiedBy"); //$NON-NLS-1$ - if(UMLUtil.getStereotypeApplication(context, Requirement.class) != null) { - - Requirement req = UMLUtil.getStereotypeApplication(context, Requirement.class); - EList<DirectedRelationship> dependencies = context.getTargetDirectedRelationships(); - EList<?> currentVerifiedBy = req.getVerifiedBy(); - - - - ModelQueryParameterValue object = parameterValues.get(0); - Object values = object.getValue(); - Assert.isTrue(values instanceof List<?>); - List<?> newVerifiedBy = (List<?>)values; - - //we destroy the unnecessary Verified - for(DirectedRelationship current : dependencies) { - if(UMLUtil.getStereotypeApplication(current, Verify.class) != null) { - EList<NamedElement> clients = ((Dependency)current).getClients(); - //we assume that there is only one client - if(clients.size() == 1) { - NamedElement client = clients.get(0); - if(!newVerifiedBy.contains(client)) {//we destroy this dependencies - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(current); - DestroyElementRequest request = new DestroyElementRequest(current, false); - ICommand desroyCommand = provider.getEditCommand(request); - cmd.add(desroyCommand); - } - } - } - } - - for(Object current : (List<?>)values) { - //we create the derive_reqt only if it doesn't exist - Assert.isTrue(current instanceof NamedElement); - if(!currentVerifiedBy.contains(current)) { - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(context); - CreateRelationshipRequest createRequest = new CreateRelationshipRequest(context.getNearestPackage(), (NamedElement)current, context, SysMLElementTypes.VERIFY); - cmd.add(provider.getEditCommand(createRequest)); - } - } - } else { - cmd.add(new IdentityCommandWithNotification(Messages.SetRequirementTextQuery_AssignmentCantBeDone, Messages.SetRequirementTextQuery_NotASysMLRequirement, Type.ERROR)); - } - editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd)); - return null; - } -} |