Kaynağa Gözat

HistoryStateVector for ExecutionRegions added

benjamin.schwertfeger@gmail.com 13 yıl önce
ebeveyn
işleme
9d54328793

BIN
plugins/org.yakindu.sct.model.sexec.edit/icons/full/ctool16/CreateExecutionRegion_historyStateVector_StateVector.gif


+ 1 - 0
plugins/org.yakindu.sct.model.sexec.edit/plugin.properties

@@ -124,3 +124,4 @@ _UI_HistoryEntry_initialStep_feature = Initial Step
 _UI_HistoryEntry_historyStep_feature = History Step
 _UI_StateSwitch_historyRegion_feature = History Region
 _UI_SaveHistory_deep_feature = Deep
+_UI_ExecutionRegion_historyStateVector_feature = History State Vector

+ 46 - 0
plugins/org.yakindu.sct.model.sexec.edit/src/org/yakindu/sct/model/sexec/provider/ExecutionRegionItemProvider.java

@@ -13,6 +13,7 @@ import java.util.List;
 import org.eclipse.emf.common.notify.AdapterFactory;
 import org.eclipse.emf.common.notify.Notification;
 
+import org.eclipse.emf.ecore.EStructuralFeature;
 import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
 import org.eclipse.emf.edit.provider.IItemLabelProvider;
 import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
@@ -20,7 +21,9 @@ import org.eclipse.emf.edit.provider.IItemPropertySource;
 import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
 import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
 
+import org.eclipse.emf.edit.provider.ViewerNotification;
 import org.yakindu.sct.model.sexec.ExecutionRegion;
+import org.yakindu.sct.model.sexec.SexecFactory;
 import org.yakindu.sct.model.sexec.SexecPackage;
 
 /**
@@ -62,6 +65,36 @@ public class ExecutionRegionItemProvider
 		return itemPropertyDescriptors;
 	}
 
+	/**
+	 * 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
+	 * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+		if (childrenFeatures == null) {
+			super.getChildrenFeatures(object);
+			childrenFeatures.add(SexecPackage.Literals.EXECUTION_REGION__HISTORY_STATE_VECTOR);
+		}
+		return childrenFeatures;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	protected EStructuralFeature getChildFeature(Object object, Object child) {
+		// Check the type of the specified child object and return the proper feature to use for
+		// adding (see {@link AddCommand}) it as a child.
+
+		return super.getChildFeature(object, child);
+	}
+
 	/**
 	 * This returns ExecutionRegion.gif.
 	 * <!-- begin-user-doc -->
@@ -97,6 +130,12 @@ public class ExecutionRegionItemProvider
 	@Override
 	public void notifyChanged(Notification notification) {
 		updateChildren(notification);
+
+		switch (notification.getFeatureID(ExecutionRegion.class)) {
+			case SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR:
+				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+				return;
+		}
 		super.notifyChanged(notification);
 	}
 
@@ -110,6 +149,11 @@ public class ExecutionRegionItemProvider
 	@Override
 	protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
 		super.collectNewChildDescriptors(newChildDescriptors, object);
+
+		newChildDescriptors.add
+			(createChildParameter
+				(SexecPackage.Literals.EXECUTION_REGION__HISTORY_STATE_VECTOR,
+				 SexecFactory.eINSTANCE.createStateVector()));
 	}
 
 	/**
@@ -124,6 +168,8 @@ public class ExecutionRegionItemProvider
 		Object childObject = child;
 
 		boolean qualify =
+			childFeature == SexecPackage.Literals.EXECUTION_SCOPE__STATE_VECTOR ||
+			childFeature == SexecPackage.Literals.EXECUTION_REGION__HISTORY_STATE_VECTOR ||
 			childFeature == SexecPackage.Literals.EXECUTION_SCOPE__ENTER_SEQUENCE ||
 			childFeature == SexecPackage.Literals.EXECUTION_SCOPE__EXIT_SEQUENCE;
 

+ 4 - 1
plugins/org.yakindu.sct.model.sexec/model/sexec.ecore

@@ -44,7 +44,10 @@
     <eStructuralFeatures xsi:type="ecore:EReference" name="exitSequence" eType="#//Sequence"
         containment="true"/>
   </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="ExecutionRegion" eSuperTypes="#//ExecutionScope"/>
+  <eClassifiers xsi:type="ecore:EClass" name="ExecutionRegion" eSuperTypes="#//ExecutionScope">
+    <eStructuralFeatures xsi:type="ecore:EReference" name="historyStateVector" eType="#//StateVector"
+        containment="true"/>
+  </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="ExecutionEntry" eSuperTypes="#//ExecutionNode"/>
   <eClassifiers xsi:type="ecore:EClass" name="ExecutionChoice" eSuperTypes="#//ExecutionNode"/>
   <eClassifiers xsi:type="ecore:EClass" name="Reaction" eSuperTypes="#//NamedElement #//MappedElement">

+ 3 - 1
plugins/org.yakindu.sct.model.sexec/model/sexec.genmodel

@@ -35,7 +35,9 @@
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionScope/enterSequence"/>
       <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionScope/exitSequence"/>
     </genClasses>
-    <genClasses ecoreClass="sexec.ecore#//ExecutionRegion"/>
+    <genClasses ecoreClass="sexec.ecore#//ExecutionRegion">
+      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference sexec.ecore#//ExecutionRegion/historyStateVector"/>
+    </genClasses>
     <genClasses ecoreClass="sexec.ecore#//ExecutionEntry"/>
     <genClasses ecoreClass="sexec.ecore#//ExecutionChoice"/>
     <genClasses ecoreClass="sexec.ecore#//Reaction">

+ 32 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/ExecutionRegion.java

@@ -12,10 +12,42 @@ package org.yakindu.sct.model.sexec;
  * A representation of the model object '<em><b>Execution Region</b></em>'.
  * <!-- end-user-doc -->
  *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ *   <li>{@link org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryStateVector <em>History State Vector</em>}</li>
+ * </ul>
+ * </p>
  *
  * @see org.yakindu.sct.model.sexec.SexecPackage#getExecutionRegion()
  * @model
  * @generated
  */
 public interface ExecutionRegion extends ExecutionScope {
+
+	/**
+	 * Returns the value of the '<em><b>History State Vector</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <p>
+	 * If the meaning of the '<em>History State Vector</em>' containment reference isn't clear,
+	 * there really should be more of a description here...
+	 * </p>
+	 * <!-- end-user-doc -->
+	 * @return the value of the '<em>History State Vector</em>' containment reference.
+	 * @see #setHistoryStateVector(StateVector)
+	 * @see org.yakindu.sct.model.sexec.SexecPackage#getExecutionRegion_HistoryStateVector()
+	 * @model containment="true"
+	 * @generated
+	 */
+	StateVector getHistoryStateVector();
+
+	/**
+	 * Sets the value of the '{@link org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryStateVector <em>History State Vector</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @param value the new value of the '<em>History State Vector</em>' containment reference.
+	 * @see #getHistoryStateVector()
+	 * @generated
+	 */
+	void setHistoryStateVector(StateVector value);
 } // ExecutionRegion

+ 29 - 1
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/SexecPackage.java

@@ -699,6 +699,15 @@ public interface SexecPackage extends EPackage {
 	 */
 	int EXECUTION_REGION__EXIT_SEQUENCE = EXECUTION_SCOPE__EXIT_SEQUENCE;
 
+	/**
+	 * The feature id for the '<em><b>History State Vector</b></em>' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 * @ordered
+	 */
+	int EXECUTION_REGION__HISTORY_STATE_VECTOR = EXECUTION_SCOPE_FEATURE_COUNT + 0;
+
 	/**
 	 * The number of structural features of the '<em>Execution Region</em>' class.
 	 * <!-- begin-user-doc -->
@@ -706,7 +715,7 @@ public interface SexecPackage extends EPackage {
 	 * @generated
 	 * @ordered
 	 */
-	int EXECUTION_REGION_FEATURE_COUNT = EXECUTION_SCOPE_FEATURE_COUNT + 0;
+	int EXECUTION_REGION_FEATURE_COUNT = EXECUTION_SCOPE_FEATURE_COUNT + 1;
 
 	/**
 	 * The meta object id for the '{@link org.yakindu.sct.model.sexec.impl.ExecutionEntryImpl <em>Execution Entry</em>}' class.
@@ -2245,6 +2254,17 @@ public interface SexecPackage extends EPackage {
 	 */
 	EClass getExecutionRegion();
 
+	/**
+	 * Returns the meta object for the containment reference '{@link org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryStateVector <em>History State Vector</em>}'.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @return the meta object for the containment reference '<em>History State Vector</em>'.
+	 * @see org.yakindu.sct.model.sexec.ExecutionRegion#getHistoryStateVector()
+	 * @see #getExecutionRegion()
+	 * @generated
+	 */
+	EReference getExecutionRegion_HistoryStateVector();
+
 	/**
 	 * Returns the meta object for class '{@link org.yakindu.sct.model.sexec.ExecutionEntry <em>Execution Entry</em>}'.
 	 * <!-- begin-user-doc -->
@@ -3131,6 +3151,14 @@ public interface SexecPackage extends EPackage {
 		 */
 		EClass EXECUTION_REGION = eINSTANCE.getExecutionRegion();
 
+		/**
+		 * The meta object literal for the '<em><b>History State Vector</b></em>' containment reference feature.
+		 * <!-- begin-user-doc -->
+		 * <!-- end-user-doc -->
+		 * @generated
+		 */
+		EReference EXECUTION_REGION__HISTORY_STATE_VECTOR = eINSTANCE.getExecutionRegion_HistoryStateVector();
+
 		/**
 		 * The meta object literal for the '{@link org.yakindu.sct.model.sexec.impl.ExecutionEntryImpl <em>Execution Entry</em>}' class.
 		 * <!-- begin-user-doc -->

+ 134 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/ExecutionRegionImpl.java

@@ -6,21 +6,40 @@
  */
 package org.yakindu.sct.model.sexec.impl;
 
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
 import org.eclipse.emf.ecore.EClass;
 
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
 import org.yakindu.sct.model.sexec.ExecutionRegion;
 import org.yakindu.sct.model.sexec.SexecPackage;
+import org.yakindu.sct.model.sexec.StateVector;
 
 /**
  * <!-- begin-user-doc -->
  * An implementation of the model object '<em><b>Execution Region</b></em>'.
  * <!-- end-user-doc -->
  * <p>
+ * The following features are implemented:
+ * <ul>
+ *   <li>{@link org.yakindu.sct.model.sexec.impl.ExecutionRegionImpl#getHistoryStateVector <em>History State Vector</em>}</li>
+ * </ul>
  * </p>
  *
  * @generated
  */
 public class ExecutionRegionImpl extends ExecutionScopeImpl implements ExecutionRegion {
+	/**
+	 * The cached value of the '{@link #getHistoryStateVector() <em>History State Vector</em>}' containment reference.
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @see #getHistoryStateVector()
+	 * @generated
+	 * @ordered
+	 */
+	protected StateVector historyStateVector;
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -40,4 +59,119 @@ public class ExecutionRegionImpl extends ExecutionScopeImpl implements Execution
 		return SexecPackage.Literals.EXECUTION_REGION;
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public StateVector getHistoryStateVector() {
+		return historyStateVector;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public NotificationChain basicSetHistoryStateVector(StateVector newHistoryStateVector, NotificationChain msgs) {
+		StateVector oldHistoryStateVector = historyStateVector;
+		historyStateVector = newHistoryStateVector;
+		if (eNotificationRequired()) {
+			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR, oldHistoryStateVector, newHistoryStateVector);
+			if (msgs == null) msgs = notification; else msgs.add(notification);
+		}
+		return msgs;
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public void setHistoryStateVector(StateVector newHistoryStateVector) {
+		if (newHistoryStateVector != historyStateVector) {
+			NotificationChain msgs = null;
+			if (historyStateVector != null)
+				msgs = ((InternalEObject)historyStateVector).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR, null, msgs);
+			if (newHistoryStateVector != null)
+				msgs = ((InternalEObject)newHistoryStateVector).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR, null, msgs);
+			msgs = basicSetHistoryStateVector(newHistoryStateVector, msgs);
+			if (msgs != null) msgs.dispatch();
+		}
+		else if (eNotificationRequired())
+			eNotify(new ENotificationImpl(this, Notification.SET, SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR, newHistoryStateVector, newHistoryStateVector));
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+		switch (featureID) {
+			case SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR:
+				return basicSetHistoryStateVector(null, msgs);
+		}
+		return super.eInverseRemove(otherEnd, featureID, msgs);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public Object eGet(int featureID, boolean resolve, boolean coreType) {
+		switch (featureID) {
+			case SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR:
+				return getHistoryStateVector();
+		}
+		return super.eGet(featureID, resolve, coreType);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public void eSet(int featureID, Object newValue) {
+		switch (featureID) {
+			case SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR:
+				setHistoryStateVector((StateVector)newValue);
+				return;
+		}
+		super.eSet(featureID, newValue);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public void eUnset(int featureID) {
+		switch (featureID) {
+			case SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR:
+				setHistoryStateVector((StateVector)null);
+				return;
+		}
+		super.eUnset(featureID);
+	}
+
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	@Override
+	public boolean eIsSet(int featureID) {
+		switch (featureID) {
+			case SexecPackage.EXECUTION_REGION__HISTORY_STATE_VECTOR:
+				return historyStateVector != null;
+		}
+		return super.eIsSet(featureID);
+	}
+
 } //ExecutionRegionImpl

+ 11 - 0
plugins/org.yakindu.sct.model.sexec/src/org/yakindu/sct/model/sexec/impl/SexecPackageImpl.java

@@ -508,6 +508,15 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		return executionRegionEClass;
 	}
 
+	/**
+	 * <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
+	 * @generated
+	 */
+	public EReference getExecutionRegion_HistoryStateVector() {
+		return (EReference)executionRegionEClass.getEStructuralFeatures().get(0);
+	}
+
 	/**
 	 * <!-- begin-user-doc -->
 	 * <!-- end-user-doc -->
@@ -1168,6 +1177,7 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		createEReference(executionScopeEClass, EXECUTION_SCOPE__EXIT_SEQUENCE);
 
 		executionRegionEClass = createEClass(EXECUTION_REGION);
+		createEReference(executionRegionEClass, EXECUTION_REGION__HISTORY_STATE_VECTOR);
 
 		executionEntryEClass = createEClass(EXECUTION_ENTRY);
 
@@ -1352,6 +1362,7 @@ public class SexecPackageImpl extends EPackageImpl implements SexecPackage {
 		initEReference(getExecutionScope_ExitSequence(), this.getSequence(), null, "exitSequence", null, 0, 1, ExecutionScope.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
 		initEClass(executionRegionEClass, ExecutionRegion.class, "ExecutionRegion", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+		initEReference(getExecutionRegion_HistoryStateVector(), this.getStateVector(), null, "historyStateVector", null, 0, 1, ExecutionRegion.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
 		initEClass(executionEntryEClass, ExecutionEntry.class, "ExecutionEntry", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);