浏览代码

Merge pull request #989 from Yakindu/issue_988

issue_988Parameters are AnnotatableElements now
Andreas Mülder 9 年之前
父节点
当前提交
1e7e2ddd64

+ 1 - 1
plugins/org.yakindu.base.types.edit/META-INF/MANIFEST.MF

@@ -4,7 +4,7 @@ Bundle-Name: YAKINDU Base Types Edit
 Bundle-SymbolicName: org.yakindu.base.types.edit;singleton:=true
 Bundle-Version: 2.7.1.qualifier
 Bundle-ClassPath: .
-Bundle-Activator: org.yakindu.base.base.provider.BaseEditPlugin$Implementation
+Bundle-Activator: org.yakindu.base.types.provider.TypesEditPlugin$Implementation
 Bundle-Vendor: statecharts.org
 Bundle-Localization: plugin
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7

+ 23 - 0
plugins/org.yakindu.base.types.edit/src/org/yakindu/base/types/provider/ParameterItemProvider.java

@@ -70,6 +70,7 @@ public class ParameterItemProvider
 
 			addTypePropertyDescriptor(object);
 			addNamePropertyDescriptor(object);
+			addAnnotationsPropertyDescriptor(object);
 		}
 		return itemPropertyDescriptors;
 	}
@@ -118,6 +119,28 @@ public class ParameterItemProvider
 				 null));
 	}
 
+	/**
+	 * This adds a property descriptor for the Annotations feature.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	protected void addAnnotationsPropertyDescriptor(Object object) {
+		itemPropertyDescriptors.add
+			(createItemPropertyDescriptor
+				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+				 getResourceLocator(),
+				 getString("_UI_AnnotatableElement_annotations_feature"),
+				 getString("_UI_PropertyDescriptor_description", "_UI_AnnotatableElement_annotations_feature", "_UI_AnnotatableElement_type"),
+				 TypesPackage.Literals.ANNOTATABLE_ELEMENT__ANNOTATIONS,
+				 true,
+				 false,
+				 true,
+				 null,
+				 null,
+				 null));
+	}
+
 	/**
 	 * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
 	 * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or

+ 1 - 1
plugins/org.yakindu.base.types/model/types.ecore

@@ -27,7 +27,7 @@
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="readonly" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="external" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
   </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Parameter" eSuperTypes="#//TypedElement base.ecore#//NamedElement">
+  <eClassifiers xsi:type="ecore:EClass" name="Parameter" eSuperTypes="#//TypedElement base.ecore#//NamedElement #//AnnotatableElement">
     <eStructuralFeatures xsi:type="ecore:EReference" name="owningOperation" eType="#//Operation"
         eOpposite="#//Operation/parameters"/>
   </eClassifiers>

+ 1 - 1
plugins/org.yakindu.base.types/src-gen/org/yakindu/base/types/Parameter.java

@@ -24,7 +24,7 @@ import org.yakindu.base.base.NamedElement;
  * @model
  * @generated
  */
-public interface Parameter extends TypedElement, NamedElement {
+public interface Parameter extends TypedElement, NamedElement, AnnotatableElement {
 	/**
 	 * Returns the value of the '<em><b>Owning Operation</b></em>' container reference.
 	 * It is bidirectional and its opposite is '{@link org.yakindu.base.types.Operation#getParameters <em>Parameters</em>}'.

+ 11 - 2
plugins/org.yakindu.base.types/src-gen/org/yakindu/base/types/TypesPackage.java

@@ -537,6 +537,15 @@ public interface TypesPackage extends EPackage {
 	 */
 	int PARAMETER__NAME = TYPED_ELEMENT_FEATURE_COUNT + 0;
 
+	/**
+	 * The feature id for the '<em><b>Annotations</b></em>' reference list.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int PARAMETER__ANNOTATIONS = TYPED_ELEMENT_FEATURE_COUNT + 1;
+
 	/**
 	 * The feature id for the '<em><b>Owning Operation</b></em>' container reference.
 	 * <!-- begin-user-doc -->
@@ -544,7 +553,7 @@ public interface TypesPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int PARAMETER__OWNING_OPERATION = TYPED_ELEMENT_FEATURE_COUNT + 1;
+	int PARAMETER__OWNING_OPERATION = TYPED_ELEMENT_FEATURE_COUNT + 2;
 
 	/**
 	 * The number of structural features of the '<em>Parameter</em>' class.
@@ -553,7 +562,7 @@ public interface TypesPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int PARAMETER_FEATURE_COUNT = TYPED_ELEMENT_FEATURE_COUNT + 2;
+	int PARAMETER_FEATURE_COUNT = TYPED_ELEMENT_FEATURE_COUNT + 3;
 
 
 	/**

+ 52 - 0
plugins/org.yakindu.base.types/src-gen/org/yakindu/base/types/impl/ParameterImpl.java

@@ -6,15 +6,20 @@
  */
 package org.yakindu.base.types.impl;
 
+import java.util.Collection;
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.ecore.EClass;
 import org.eclipse.emf.ecore.InternalEObject;
 import org.eclipse.emf.ecore.impl.ENotificationImpl;
 import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.emf.ecore.util.EObjectResolvingEList;
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.yakindu.base.base.BasePackage;
 import org.yakindu.base.base.NamedElement;
+import org.yakindu.base.types.AnnotatableElement;
+import org.yakindu.base.types.Annotation;
 import org.yakindu.base.types.Operation;
 import org.yakindu.base.types.Parameter;
 import org.yakindu.base.types.Type;
@@ -32,6 +37,7 @@ import org.yakindu.base.types.TypesPackage;
  *   <li>{@link org.yakindu.base.types.impl.ParameterImpl#getType <em>Type</em>}</li>
  *   <li>{@link org.yakindu.base.types.impl.ParameterImpl#getTypeSpecifier <em>Type Specifier</em>}</li>
  *   <li>{@link org.yakindu.base.types.impl.ParameterImpl#getName <em>Name</em>}</li>
+ *   <li>{@link org.yakindu.base.types.impl.ParameterImpl#getAnnotations <em>Annotations</em>}</li>
  *   <li>{@link org.yakindu.base.types.impl.ParameterImpl#getOwningOperation <em>Owning Operation</em>}</li>
  * </ul>
  *
@@ -68,6 +74,16 @@ public class ParameterImpl extends EObjectImpl implements Parameter {
 	 */
 	protected String name = NAME_EDEFAULT;
 
+	/**
+	 * The cached value of the '{@link #getAnnotations() <em>Annotations</em>}' reference list.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getAnnotations()
+	 * @generated
+	 * @ordered
+	 */
+	protected EList<Annotation> annotations;
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -173,6 +189,18 @@ public class ParameterImpl extends EObjectImpl implements Parameter {
 			eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.PARAMETER__NAME, oldName, name));
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EList<Annotation> getAnnotations() {
+		if (annotations == null) {
+			annotations = new EObjectResolvingEList<Annotation>(Annotation.class, this, TypesPackage.PARAMETER__ANNOTATIONS);
+		}
+		return annotations;
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -275,6 +303,8 @@ public class ParameterImpl extends EObjectImpl implements Parameter {
 				return getTypeSpecifier();
 			case TypesPackage.PARAMETER__NAME:
 				return getName();
+			case TypesPackage.PARAMETER__ANNOTATIONS:
+				return getAnnotations();
 			case TypesPackage.PARAMETER__OWNING_OPERATION:
 				return getOwningOperation();
 		}
@@ -286,6 +316,7 @@ public class ParameterImpl extends EObjectImpl implements Parameter {
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
+	@SuppressWarnings("unchecked")
 	@Override
 	public void eSet(int featureID, Object newValue) {
 		switch (featureID) {
@@ -295,6 +326,10 @@ public class ParameterImpl extends EObjectImpl implements Parameter {
 			case TypesPackage.PARAMETER__NAME:
 				setName((String)newValue);
 				return;
+			case TypesPackage.PARAMETER__ANNOTATIONS:
+				getAnnotations().clear();
+				getAnnotations().addAll((Collection<? extends Annotation>)newValue);
+				return;
 			case TypesPackage.PARAMETER__OWNING_OPERATION:
 				setOwningOperation((Operation)newValue);
 				return;
@@ -316,6 +351,9 @@ public class ParameterImpl extends EObjectImpl implements Parameter {
 			case TypesPackage.PARAMETER__NAME:
 				setName(NAME_EDEFAULT);
 				return;
+			case TypesPackage.PARAMETER__ANNOTATIONS:
+				getAnnotations().clear();
+				return;
 			case TypesPackage.PARAMETER__OWNING_OPERATION:
 				setOwningOperation((Operation)null);
 				return;
@@ -337,6 +375,8 @@ public class ParameterImpl extends EObjectImpl implements Parameter {
 				return typeSpecifier != null;
 			case TypesPackage.PARAMETER__NAME:
 				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+			case TypesPackage.PARAMETER__ANNOTATIONS:
+				return annotations != null && !annotations.isEmpty();
 			case TypesPackage.PARAMETER__OWNING_OPERATION:
 				return getOwningOperation() != null;
 		}
@@ -356,6 +396,12 @@ public class ParameterImpl extends EObjectImpl implements Parameter {
 				default: return -1;
 			}
 		}
+		if (baseClass == AnnotatableElement.class) {
+			switch (derivedFeatureID) {
+				case TypesPackage.PARAMETER__ANNOTATIONS: return TypesPackage.ANNOTATABLE_ELEMENT__ANNOTATIONS;
+				default: return -1;
+			}
+		}
 		return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
 	}
 
@@ -372,6 +418,12 @@ public class ParameterImpl extends EObjectImpl implements Parameter {
 				default: return -1;
 			}
 		}
+		if (baseClass == AnnotatableElement.class) {
+			switch (baseFeatureID) {
+				case TypesPackage.ANNOTATABLE_ELEMENT__ANNOTATIONS: return TypesPackage.PARAMETER__ANNOTATIONS;
+				default: return -1;
+			}
+		}
 		return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
 	}
 

+ 1 - 0
plugins/org.yakindu.base.types/src-gen/org/yakindu/base/types/impl/TypesPackageImpl.java

@@ -909,6 +909,7 @@ public class TypesPackageImpl extends EPackageImpl implements TypesPackage {
 		propertyEClass.getESuperTypes().add(this.getDeclaration());
 		parameterEClass.getESuperTypes().add(this.getTypedElement());
 		parameterEClass.getESuperTypes().add(theBasePackage.getNamedElement());
+		parameterEClass.getESuperTypes().add(this.getAnnotatableElement());
 		eventEClass.getESuperTypes().add(this.getDeclaration());
 		enumerationTypeEClass.getESuperTypes().add(this.getPrimitiveType());
 		primitiveTypeEClass.getESuperTypes().add(this.getType());

+ 1 - 0
plugins/org.yakindu.base.types/src-gen/org/yakindu/base/types/util/TypesSwitch.java

@@ -140,6 +140,7 @@ public class TypesSwitch<T> extends Switch<T> {
 				T result = caseParameter(parameter);
 				if (result == null) result = caseTypedElement(parameter);
 				if (result == null) result = caseNamedElement(parameter);
+				if (result == null) result = caseAnnotatableElement(parameter);
 				if (result == null) result = defaultCase(theEObject);
 				return result;
 			}