(Transition.class, this, StatemachinePackage.STATEMACHINE__TRANSITIONS);
+ }
+ return transitions;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case StatemachinePackage.STATEMACHINE__STATES:
+ return ((InternalEList>)getStates()).basicRemove(otherEnd, msgs);
+ case StatemachinePackage.STATEMACHINE__TRANSITIONS:
+ return ((InternalEList>)getTransitions()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case StatemachinePackage.STATEMACHINE__STATES:
+ return getStates();
+ case StatemachinePackage.STATEMACHINE__TRANSITIONS:
+ return getTransitions();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case StatemachinePackage.STATEMACHINE__STATES:
+ getStates().clear();
+ getStates().addAll((Collection extends State>)newValue);
+ return;
+ case StatemachinePackage.STATEMACHINE__TRANSITIONS:
+ getTransitions().clear();
+ getTransitions().addAll((Collection extends Transition>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case StatemachinePackage.STATEMACHINE__STATES:
+ getStates().clear();
+ return;
+ case StatemachinePackage.STATEMACHINE__TRANSITIONS:
+ getTransitions().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case StatemachinePackage.STATEMACHINE__STATES:
+ return states != null && !states.isEmpty();
+ case StatemachinePackage.STATEMACHINE__TRANSITIONS:
+ return transitions != null && !transitions.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //StatemachineImpl
diff --git a/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/impl/StatemachinePackageImpl.java b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/impl/StatemachinePackageImpl.java
new file mode 100644
index 000000000..b20a6acf6
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/impl/StatemachinePackageImpl.java
@@ -0,0 +1,376 @@
+/**
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor.statemachine.impl;
+
+import de.cognicrypt.order.editor.statemachine.Event;
+import de.cognicrypt.order.editor.statemachine.State;
+import de.cognicrypt.order.editor.statemachine.Statemachine;
+import de.cognicrypt.order.editor.statemachine.StatemachineFactory;
+import de.cognicrypt.order.editor.statemachine.StatemachinePackage;
+import de.cognicrypt.order.editor.statemachine.Transition;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+/**
+ *
+ * An implementation of the model Package.
+ *
+ * @generated
+ */
+public class StatemachinePackageImpl extends EPackageImpl implements StatemachinePackage
+{
+ /**
+ *
+ *
+ * @generated
+ */
+ private EClass statemachineEClass = null;
+
+ /**
+ *
+ *
+ * @generated
+ */
+ private EClass stateEClass = null;
+
+ /**
+ *
+ *
+ * @generated
+ */
+ private EClass transitionEClass = null;
+
+ /**
+ *
+ *
+ * @generated
+ */
+ private EClass eventEClass = null;
+
+ /**
+ * Creates an instance of the model Package, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * 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.
+ *
+ *
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see de.cognicrypt.order.editor.statemachine.StatemachinePackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private StatemachinePackageImpl()
+ {
+ super(eNS_URI, StatemachineFactory.eINSTANCE);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the Package for this model, and for any others upon which it depends.
+ *
+ *
This method is used to initialize {@link StatemachinePackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ *
+ *
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static StatemachinePackage init()
+ {
+ if (isInited) return (StatemachinePackage)EPackage.Registry.INSTANCE.getEPackage(StatemachinePackage.eNS_URI);
+
+ // Obtain or create and register package
+ Object registeredStatemachinePackage = EPackage.Registry.INSTANCE.get(eNS_URI);
+ StatemachinePackageImpl theStatemachinePackage = registeredStatemachinePackage instanceof StatemachinePackageImpl ? (StatemachinePackageImpl)registeredStatemachinePackage : new StatemachinePackageImpl();
+
+ isInited = true;
+
+ // Create package meta-data objects
+ theStatemachinePackage.createPackageContents();
+
+ // Initialize created meta-data
+ theStatemachinePackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theStatemachinePackage.freeze();
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(StatemachinePackage.eNS_URI, theStatemachinePackage);
+ return theStatemachinePackage;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EClass getStatemachine()
+ {
+ return statemachineEClass;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EReference getStatemachine_States()
+ {
+ return (EReference)statemachineEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EReference getStatemachine_Transitions()
+ {
+ return (EReference)statemachineEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EClass getState()
+ {
+ return stateEClass;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EAttribute getState_Name()
+ {
+ return (EAttribute)stateEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EAttribute getState_IsFinal()
+ {
+ return (EAttribute)stateEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EReference getState_Transitions()
+ {
+ return (EReference)stateEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EClass getTransition()
+ {
+ return transitionEClass;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EAttribute getTransition_Name()
+ {
+ return (EAttribute)transitionEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EReference getTransition_FromState()
+ {
+ return (EReference)transitionEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EReference getTransition_Event()
+ {
+ return (EReference)transitionEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EReference getTransition_EndState()
+ {
+ return (EReference)transitionEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EClass getEvent()
+ {
+ return eventEClass;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public EAttribute getEvent_Name()
+ {
+ return (EAttribute)eventEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public StatemachineFactory getStatemachineFactory()
+ {
+ return (StatemachineFactory)getEFactoryInstance();
+ }
+
+ /**
+ *
+ *
+ * @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.
+ *
+ *
+ * @generated
+ */
+ public void createPackageContents()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ statemachineEClass = createEClass(STATEMACHINE);
+ createEReference(statemachineEClass, STATEMACHINE__STATES);
+ createEReference(statemachineEClass, STATEMACHINE__TRANSITIONS);
+
+ stateEClass = createEClass(STATE);
+ createEAttribute(stateEClass, STATE__NAME);
+ createEAttribute(stateEClass, STATE__IS_FINAL);
+ createEReference(stateEClass, STATE__TRANSITIONS);
+
+ transitionEClass = createEClass(TRANSITION);
+ createEAttribute(transitionEClass, TRANSITION__NAME);
+ createEReference(transitionEClass, TRANSITION__FROM_STATE);
+ createEReference(transitionEClass, TRANSITION__EVENT);
+ createEReference(transitionEClass, TRANSITION__END_STATE);
+
+ eventEClass = createEClass(EVENT);
+ createEAttribute(eventEClass, EVENT__NAME);
+ }
+
+ /**
+ *
+ *
+ * @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.
+ *
+ *
+ * @generated
+ */
+ public void initializePackageContents()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(statemachineEClass, Statemachine.class, "Statemachine", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getStatemachine_States(), this.getState(), null, "states", null, 0, -1, Statemachine.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getStatemachine_Transitions(), this.getTransition(), null, "transitions", null, 0, -1, Statemachine.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(stateEClass, State.class, "State", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getState_Name(), ecorePackage.getEString(), "name", null, 0, 1, State.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getState_IsFinal(), ecorePackage.getEBoolean(), "isFinal", null, 0, 1, State.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getState_Transitions(), this.getTransition(), null, "transitions", null, 0, -1, State.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(transitionEClass, Transition.class, "Transition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getTransition_Name(), ecorePackage.getEString(), "name", null, 0, 1, Transition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getTransition_FromState(), this.getState(), null, "fromState", null, 0, 1, Transition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getTransition_Event(), this.getEvent(), null, "event", null, 0, 1, Transition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getTransition_EndState(), this.getState(), null, "endState", null, 0, 1, Transition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(eventEClass, Event.class, "Event", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getEvent_Name(), ecorePackage.getEString(), "name", null, 0, 1, Event.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //StatemachinePackageImpl
diff --git a/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/impl/TransitionImpl.java b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/impl/TransitionImpl.java
new file mode 100644
index 000000000..011c73841
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/impl/TransitionImpl.java
@@ -0,0 +1,405 @@
+/**
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor.statemachine.impl;
+
+import de.cognicrypt.order.editor.statemachine.Event;
+import de.cognicrypt.order.editor.statemachine.State;
+import de.cognicrypt.order.editor.statemachine.StatemachinePackage;
+import de.cognicrypt.order.editor.statemachine.Transition;
+
+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.eclipse.emf.ecore.impl.MinimalEObjectImpl;
+
+/**
+ *
+ * An implementation of the model object 'Transition'.
+ *
+ *
+ * The following features are implemented:
+ *
+ *
+ * - {@link de.cognicrypt.order.editor.statemachine.impl.TransitionImpl#getName Name}
+ * - {@link de.cognicrypt.order.editor.statemachine.impl.TransitionImpl#getFromState From State}
+ * - {@link de.cognicrypt.order.editor.statemachine.impl.TransitionImpl#getEvent Event}
+ * - {@link de.cognicrypt.order.editor.statemachine.impl.TransitionImpl#getEndState End State}
+ *
+ *
+ * @generated
+ */
+public class TransitionImpl extends MinimalEObjectImpl.Container implements Transition
+{
+ /**
+ * The default value of the '{@link #getName() Name}' attribute.
+ *
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() Name}' attribute.
+ *
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getFromState() From State}' reference.
+ *
+ *
+ * @see #getFromState()
+ * @generated
+ * @ordered
+ */
+ protected State fromState;
+
+ /**
+ * The cached value of the '{@link #getEvent() Event}' containment reference.
+ *
+ *
+ * @see #getEvent()
+ * @generated
+ * @ordered
+ */
+ protected Event event;
+
+ /**
+ * The cached value of the '{@link #getEndState() End State}' reference.
+ *
+ *
+ * @see #getEndState()
+ * @generated
+ * @ordered
+ */
+ protected State endState;
+
+ /**
+ *
+ *
+ * @generated
+ */
+ protected TransitionImpl()
+ {
+ super();
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return StatemachinePackage.Literals.TRANSITION;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.TRANSITION__NAME, oldName, name));
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public State getFromState()
+ {
+ if (fromState != null && fromState.eIsProxy())
+ {
+ InternalEObject oldFromState = (InternalEObject)fromState;
+ fromState = (State)eResolveProxy(oldFromState);
+ if (fromState != oldFromState)
+ {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, StatemachinePackage.TRANSITION__FROM_STATE, oldFromState, fromState));
+ }
+ }
+ return fromState;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public State basicGetFromState()
+ {
+ return fromState;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public void setFromState(State newFromState)
+ {
+ State oldFromState = fromState;
+ fromState = newFromState;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.TRANSITION__FROM_STATE, oldFromState, fromState));
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public Event getEvent()
+ {
+ return event;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public NotificationChain basicSetEvent(Event newEvent, NotificationChain msgs)
+ {
+ Event oldEvent = event;
+ event = newEvent;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatemachinePackage.TRANSITION__EVENT, oldEvent, newEvent);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public void setEvent(Event newEvent)
+ {
+ if (newEvent != event)
+ {
+ NotificationChain msgs = null;
+ if (event != null)
+ msgs = ((InternalEObject)event).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StatemachinePackage.TRANSITION__EVENT, null, msgs);
+ if (newEvent != null)
+ msgs = ((InternalEObject)newEvent).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StatemachinePackage.TRANSITION__EVENT, null, msgs);
+ msgs = basicSetEvent(newEvent, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.TRANSITION__EVENT, newEvent, newEvent));
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public State getEndState()
+ {
+ if (endState != null && endState.eIsProxy())
+ {
+ InternalEObject oldEndState = (InternalEObject)endState;
+ endState = (State)eResolveProxy(oldEndState);
+ if (endState != oldEndState)
+ {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, StatemachinePackage.TRANSITION__END_STATE, oldEndState, endState));
+ }
+ }
+ return endState;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ public State basicGetEndState()
+ {
+ return endState;
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public void setEndState(State newEndState)
+ {
+ State oldEndState = endState;
+ endState = newEndState;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, StatemachinePackage.TRANSITION__END_STATE, oldEndState, endState));
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case StatemachinePackage.TRANSITION__EVENT:
+ return basicSetEvent(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case StatemachinePackage.TRANSITION__NAME:
+ return getName();
+ case StatemachinePackage.TRANSITION__FROM_STATE:
+ if (resolve) return getFromState();
+ return basicGetFromState();
+ case StatemachinePackage.TRANSITION__EVENT:
+ return getEvent();
+ case StatemachinePackage.TRANSITION__END_STATE:
+ if (resolve) return getEndState();
+ return basicGetEndState();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case StatemachinePackage.TRANSITION__NAME:
+ setName((String)newValue);
+ return;
+ case StatemachinePackage.TRANSITION__FROM_STATE:
+ setFromState((State)newValue);
+ return;
+ case StatemachinePackage.TRANSITION__EVENT:
+ setEvent((Event)newValue);
+ return;
+ case StatemachinePackage.TRANSITION__END_STATE:
+ setEndState((State)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case StatemachinePackage.TRANSITION__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case StatemachinePackage.TRANSITION__FROM_STATE:
+ setFromState((State)null);
+ return;
+ case StatemachinePackage.TRANSITION__EVENT:
+ setEvent((Event)null);
+ return;
+ case StatemachinePackage.TRANSITION__END_STATE:
+ setEndState((State)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case StatemachinePackage.TRANSITION__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case StatemachinePackage.TRANSITION__FROM_STATE:
+ return fromState != null;
+ case StatemachinePackage.TRANSITION__EVENT:
+ return event != null;
+ case StatemachinePackage.TRANSITION__END_STATE:
+ return endState != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ *
+ *
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuilder result = new StringBuilder(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} //TransitionImpl
diff --git a/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/util/StatemachineAdapterFactory.java b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/util/StatemachineAdapterFactory.java
new file mode 100644
index 000000000..769f3b1b8
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/util/StatemachineAdapterFactory.java
@@ -0,0 +1,193 @@
+/**
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor.statemachine.util;
+
+import de.cognicrypt.order.editor.statemachine.*;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ *
+ * The Adapter Factory for the model.
+ * It provides an adapter createXXX method for each class of the model.
+ *
+ * @see de.cognicrypt.order.editor.statemachine.StatemachinePackage
+ * @generated
+ */
+public class StatemachineAdapterFactory extends AdapterFactoryImpl
+{
+ /**
+ * The cached model package.
+ *
+ *
+ * @generated
+ */
+ protected static StatemachinePackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ *
+ *
+ * @generated
+ */
+ public StatemachineAdapterFactory()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = StatemachinePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ *
+ * This implementation returns true if the object is either the model's package or is an instance object of the model.
+ *
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object)
+ {
+ if (object == modelPackage)
+ {
+ return true;
+ }
+ if (object instanceof EObject)
+ {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the createXXX methods.
+ *
+ *
+ * @generated
+ */
+ protected StatemachineSwitch modelSwitch =
+ new StatemachineSwitch()
+ {
+ @Override
+ public Adapter caseStatemachine(Statemachine object)
+ {
+ return createStatemachineAdapter();
+ }
+ @Override
+ public Adapter caseState(State object)
+ {
+ return createStateAdapter();
+ }
+ @Override
+ public Adapter caseTransition(Transition object)
+ {
+ return createTransitionAdapter();
+ }
+ @Override
+ public Adapter caseEvent(Event object)
+ {
+ return createEventAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object)
+ {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the target.
+ *
+ *
+ * @param target the object to adapt.
+ * @return the adapter for the target.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target)
+ {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link de.cognicrypt.order.editor.statemachine.Statemachine Statemachine}'.
+ *
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ *
+ * @return the new adapter.
+ * @see de.cognicrypt.order.editor.statemachine.Statemachine
+ * @generated
+ */
+ public Adapter createStatemachineAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link de.cognicrypt.order.editor.statemachine.State State}'.
+ *
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ *
+ * @return the new adapter.
+ * @see de.cognicrypt.order.editor.statemachine.State
+ * @generated
+ */
+ public Adapter createStateAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link de.cognicrypt.order.editor.statemachine.Transition Transition}'.
+ *
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ *
+ * @return the new adapter.
+ * @see de.cognicrypt.order.editor.statemachine.Transition
+ * @generated
+ */
+ public Adapter createTransitionAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link de.cognicrypt.order.editor.statemachine.Event Event}'.
+ *
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ *
+ * @return the new adapter.
+ * @see de.cognicrypt.order.editor.statemachine.Event
+ * @generated
+ */
+ public Adapter createEventAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ *
+ * This default implementation returns null.
+ *
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter()
+ {
+ return null;
+ }
+
+} //StatemachineAdapterFactory
diff --git a/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/util/StatemachineSwitch.java b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/util/StatemachineSwitch.java
new file mode 100644
index 000000000..01f2a158f
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/statemachine/util/StatemachineSwitch.java
@@ -0,0 +1,189 @@
+/**
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor.statemachine.util;
+
+import de.cognicrypt.order.editor.statemachine.*;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.util.Switch;
+
+/**
+ *
+ * The Switch for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the caseXXX method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ *
+ * @see de.cognicrypt.order.editor.statemachine.StatemachinePackage
+ * @generated
+ */
+public class StatemachineSwitch extends Switch
+{
+ /**
+ * The cached model package
+ *
+ *
+ * @generated
+ */
+ protected static StatemachinePackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ *
+ *
+ * @generated
+ */
+ public StatemachineSwitch()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = StatemachinePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Checks whether this is a switch for the given package.
+ *
+ *
+ * @param ePackage the package in question.
+ * @return whether this is a switch for the given package.
+ * @generated
+ */
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage)
+ {
+ return ePackage == modelPackage;
+ }
+
+ /**
+ * Calls caseXXX for each class of the model until one returns a non null result; it yields that result.
+ *
+ *
+ * @return the first non-null result returned by a caseXXX call.
+ * @generated
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject)
+ {
+ switch (classifierID)
+ {
+ case StatemachinePackage.STATEMACHINE:
+ {
+ Statemachine statemachine = (Statemachine)theEObject;
+ T result = caseStatemachine(statemachine);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StatemachinePackage.STATE:
+ {
+ State state = (State)theEObject;
+ T result = caseState(state);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StatemachinePackage.TRANSITION:
+ {
+ Transition transition = (Transition)theEObject;
+ T result = caseTransition(transition);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case StatemachinePackage.EVENT:
+ {
+ Event event = (Event)theEObject;
+ T result = caseEvent(event);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'Statemachine'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'Statemachine'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseStatemachine(Statemachine object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'State'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'State'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseState(State object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'Transition'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'Transition'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTransition(Transition object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'Event'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'Event'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEvent(Event object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of 'EObject'.
+ *
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ *
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of 'EObject'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ @Override
+ public T defaultCase(EObject object)
+ {
+ return null;
+ }
+
+} //StatemachineSwitch
diff --git a/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/validation/AbstractStatemachineValidator.java b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/validation/AbstractStatemachineValidator.java
new file mode 100644
index 000000000..53adaaf07
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/validation/AbstractStatemachineValidator.java
@@ -0,0 +1,21 @@
+/*
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor.validation;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.xtext.xbase.validation.XtypeValidator;
+
+public abstract class AbstractStatemachineValidator extends XtypeValidator {
+
+ @Override
+ protected List getEPackages() {
+ List result = new ArrayList(super.getEPackages());
+ result.add(de.cognicrypt.order.editor.statemachine.StatemachinePackage.eINSTANCE);
+ result.add(EPackage.Registry.INSTANCE.getEPackage("http://www.eclipse.org/xtext/common/JavaVMTypes"));
+ result.add(EPackage.Registry.INSTANCE.getEPackage("http://www.eclipse.org/xtext/xbase/Xtype"));
+ return result;
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/validation/StatemachineConfigurableIssueCodesProvider.java b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/validation/StatemachineConfigurableIssueCodesProvider.java
new file mode 100644
index 000000000..bc9f3a571
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src-gen/de/cognicrypt/order/editor/validation/StatemachineConfigurableIssueCodesProvider.java
@@ -0,0 +1,22 @@
+/*
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor.validation;
+
+import org.eclipse.xtext.preferences.PreferenceKey;
+import org.eclipse.xtext.util.IAcceptor;
+import org.eclipse.xtext.validation.ConfigurableIssueCodesProvider;
+import org.eclipse.xtext.validation.SeverityConverter;
+
+@SuppressWarnings("restriction")
+public class StatemachineConfigurableIssueCodesProvider extends ConfigurableIssueCodesProvider {
+ protected static final String ISSUE_CODE_PREFIX = "de.cognicrypt.order.editor.";
+
+ public static final String DEPRECATED_MODEL_PART = ISSUE_CODE_PREFIX + "deprecatedModelPart";
+
+ @Override
+ protected void initialize(IAcceptor acceptor) {
+ super.initialize(acceptor);
+ acceptor.accept(create(DEPRECATED_MODEL_PART, SeverityConverter.SEVERITY_WARNING));
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/Activator.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/Activator.java
new file mode 100644
index 000000000..dd8e056e9
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/Activator.java
@@ -0,0 +1,75 @@
+/********************************************************************************
+ * Copyright (c) 2015-2019 TU Darmstadt, Paderborn University
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ ********************************************************************************/
+
+package de.cognicrypt.order.editor;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "de.cognicrypt.order.editor"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {}
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ private void log(final int severity, final String message, final Exception ex) {
+ getLog().log(new Status(severity, Activator.PLUGIN_ID, message, ex));
+ }
+
+ public void logError(final Exception ex) {
+ logError(ex, ex.getMessage());
+ }
+
+ public void logError(final Exception ex, final String message) {
+ log(IStatus.ERROR, message, ex);
+ }
+
+ public void logError(final String message) {
+ log(IStatus.ERROR, message, null);
+ }
+
+ public void logInfo(final String message) {
+ log(IStatus.INFO, message, null);
+ }
+
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/Constants.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/Constants.java
new file mode 100644
index 000000000..c83fabe4a
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/Constants.java
@@ -0,0 +1,30 @@
+/********************************************************************************
+ * Copyright (c) 2015-2019 TU Darmstadt, Paderborn University
+ *
+
+ * http://www.eclipse.org/legal/epl-2.0. SPDX-License-Identifier: EPL-2.0
+ ********************************************************************************/
+
+package de.cognicrypt.order.editor;
+
+/**
+ * This class comprises all constants that are used by the plugin.
+ */
+public class Constants {
+
+ public static final String innerFileSeparator = "/";
+ //public static final String rsrcPath = "src" + innerFileSeparator + "main" + innerFileSeparator + "resources" + innerFileSeparator;
+
+ public final static String RELATIVE_STATEMACHINE_CONFIG_DIR = "config" + innerFileSeparator;
+ public final static String RELATIVE_STATEMACHINE_MODELS_DIR = "output" + innerFileSeparator;
+
+ public static final String STATEMACHINE_EXTENSION = ".statemachine";
+ public static final String XML_EXTENSION = ".xml";
+
+ public final static String RELATIVE_JCA_FOLDER = innerFileSeparator + "git" + innerFileSeparator + "Crypto-API-Rules" + innerFileSeparator + "JavaCryptographicArchitecture" + innerFileSeparator + "src";
+ public final static String RELATIVE_BC_FOLDER = innerFileSeparator + "git" + innerFileSeparator + "Crypto-API-Rules" + innerFileSeparator + "BouncyCastle" + innerFileSeparator + "src";
+ public final static String RELATIVE_BC_JCA_FOLDER = innerFileSeparator + "git" + innerFileSeparator + "Crypto-API-Rules" + innerFileSeparator + "BouncyCastle-JCA" + innerFileSeparator + "src";
+ public final static String RELATIVE_TINK_FOLDER = innerFileSeparator + "git" + innerFileSeparator + "Crypto-API-Rules" + innerFileSeparator + "Tink" + innerFileSeparator + "src";
+
+ public static final String ERROR_MESSAGE_NO_FILE = "No file found";
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/GenerateStatemachine.mwe2 b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/GenerateStatemachine.mwe2
new file mode 100644
index 000000000..4e209519c
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/GenerateStatemachine.mwe2
@@ -0,0 +1,60 @@
+module de.cognicrypt.order.editor.GenerateStatemachine
+
+import org.eclipse.xtext.xtext.generator.*
+import org.eclipse.xtext.xtext.generator.model.project.*
+
+var rootPath = ".."
+
+Workflow {
+
+ component = XtextGenerator {
+ configuration = {
+ project = StandardProjectConfig {
+ baseName = "de.cognicrypt.order.editor"
+ rootPath = rootPath
+ runtimeTest = {
+ enabled = false
+ }
+ eclipsePlugin = {
+ enabled = false
+ }
+ eclipsePluginTest = {
+ enabled = false
+ }
+ createEclipseMetaData = true
+ }
+ code = {
+ encoding = "windows-1252"
+ lineDelimiter = "\r\n"
+ fileHeader = "/*\n * generated by Xtext \${version}\n */"
+ preferXtendStubs = false
+ }
+ }
+ language = StandardLanguage {
+ name = "de.cognicrypt.order.editor.Statemachine"
+ fileExtensions = "statemachine"
+ scopeProvider = {
+ generateXtendStub = false
+ }
+
+ serializer = {
+ generateStub = false
+ }
+ validator = {
+ // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
+ // Generates checks for @Deprecated grammar annotations, an IssueProvider and a corresponding PropertyPage
+ generateDeprecationValidation = true
+ }
+ generator = {
+ generateXtendStub = true
+ generateJavaMain = true
+ }
+ fileWizard = {
+ generate = true
+ }
+ junitSupport = {
+ junitVersion = "5"
+ }
+ }
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/Statemachine.xtext b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/Statemachine.xtext
new file mode 100644
index 000000000..daabfb83c
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/Statemachine.xtext
@@ -0,0 +1,28 @@
+grammar de.cognicrypt.order.editor.Statemachine with org.eclipse.xtext.xbase.Xtype // with org.eclipse.xtext.common.Terminals
+
+generate statemachine "http://www.cognicrypt.de/order/editor/Statemachine"
+
+Statemachine :
+ {Statemachine}
+ states+=State*
+ transitions+=Transition*
+;
+
+State:
+ 'state' name=ID (isFinal?='true'|'false')
+ transitions+=Transition*
+ 'end'
+;
+
+Transition:
+ 'transition' name=ID
+ fromState=[State] ',' event=Event ',' endState=[State]
+ 'end'
+;
+
+Event:
+ name=ID
+;
+
+
+
\ No newline at end of file
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/StatemachineRuntimeModule.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/StatemachineRuntimeModule.java
new file mode 100644
index 000000000..353dbb68a
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/StatemachineRuntimeModule.java
@@ -0,0 +1,11 @@
+/*
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor;
+
+
+/**
+ * Use this class to register components to be used at runtime / without the Equinox extension registry.
+ */
+public class StatemachineRuntimeModule extends AbstractStatemachineRuntimeModule {
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/StatemachineStandaloneSetup.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/StatemachineStandaloneSetup.java
new file mode 100644
index 000000000..523319819
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/StatemachineStandaloneSetup.java
@@ -0,0 +1,15 @@
+/*
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor;
+
+
+/**
+ * Initialization support for running Xtext languages without Equinox extension registry.
+ */
+public class StatemachineStandaloneSetup extends StatemachineStandaloneSetupGenerated {
+
+ public static void doSetup() {
+ new StatemachineStandaloneSetup().createInjectorAndDoEMFRegistration();
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/actions/RunOrderEditorHandler.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/actions/RunOrderEditorHandler.java
new file mode 100644
index 000000000..9380dfd97
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/actions/RunOrderEditorHandler.java
@@ -0,0 +1,32 @@
+/********************************************************************************
+ * Copyright (c) 2015-2019 TU Darmstadt, Paderborn University
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ ********************************************************************************/
+
+package de.cognicrypt.order.editor.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.PlatformUI;
+
+import de.cognicrypt.core.Constants;
+import de.cognicrypt.order.editor.wizard.OrderEditorWizard;
+import de.cognicrypt.order.editor.wizard.OrderEditorWizardDialog;
+
+public class RunOrderEditorHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Constants.WizardActionFromContextMenuFlag = true;
+ final OrderEditorWizardDialog dialog = new OrderEditorWizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), new OrderEditorWizard());
+ dialog.setHelpAvailable(false);
+ return dialog.open();
+ }
+
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/config/CryslFile.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/config/CryslFile.java
new file mode 100644
index 000000000..c07dcb4ed
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/config/CryslFile.java
@@ -0,0 +1,27 @@
+package de.cognicrypt.order.editor.config;
+
+public class CryslFile { //represents a CryslFile object from config.xml
+
+ private String rule;
+ private String path;
+
+ public String getRule() {
+ return rule;
+ }
+
+ public String getRuleName() {
+ return rule.substring(0, rule.length()-6);
+ }
+
+ public void setRule(String rule) {
+ this.rule = rule;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/config/StaxParser.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/config/StaxParser.java
new file mode 100644
index 000000000..c647058c7
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/config/StaxParser.java
@@ -0,0 +1,70 @@
+package de.cognicrypt.order.editor.config;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.EndElement;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+
+
+import de.cognicrypt.order.editor.parser.StatemachineParser;
+
+
+public class StaxParser {
+
+ static final String CRYSLFILE = "cryslFile";
+ static final String RULE = "rule";
+ static final String PATH = "path";
+
+ @SuppressWarnings({ "unchecked", "null" })
+ public List readConfig(String configFile) {
+ List cryslFileList = new ArrayList();
+ try {
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ InputStream in = new FileInputStream(configFile);
+ XMLEventReader eventReader = inputFactory.createXMLEventReader(in);
+ CryslFile cryslFile = null;
+
+ while (eventReader.hasNext()) {
+ XMLEvent event = eventReader.nextEvent();
+
+ if (event.isStartElement()) {
+ StartElement startElement = event.asStartElement();
+ String elementName = startElement.getName().getLocalPart();
+ switch (elementName) {
+ case CRYSLFILE:
+ cryslFile = new CryslFile();
+ break;
+ case RULE:
+ event = eventReader.nextEvent();
+ cryslFile.setRule(event.asCharacters().getData());
+ break;
+ case PATH:
+ event = eventReader.nextEvent();
+ cryslFile.setPath(event.asCharacters().getData());
+ break;
+ }
+ }
+ if (event.isEndElement()) {
+ EndElement endElement = event.asEndElement();
+ if (endElement.getName().getLocalPart().equals(CRYSLFILE)) {
+ cryslFileList.add(cryslFile);
+ }
+ }
+
+ }
+ } catch (FileNotFoundException | XMLStreamException e) {
+ e.printStackTrace();
+ }
+ StatemachineParser.generate(cryslFileList);
+ return cryslFileList;
+ }
+}
+
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/config/StaxWriter.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/config/StaxWriter.java
new file mode 100644
index 000000000..4b04aeb43
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/config/StaxWriter.java
@@ -0,0 +1,178 @@
+package de.cognicrypt.order.editor.config;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Arrays;
+import java.util.Enumeration;
+
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Characters;
+import javax.xml.stream.events.EndElement;
+import javax.xml.stream.events.StartDocument;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
+
+import de.cognicrypt.order.editor.Activator;
+import de.cognicrypt.order.editor.Constants;
+import de.cognicrypt.utils.Utils;
+
+public class StaxWriter {
+ private File f;
+
+ public void setFile(String configFile) {
+
+ final Bundle bundle = Platform.getBundle(de.cognicrypt.order.editor.Activator.PLUGIN_ID);
+
+ URL entry = null;
+ URL resolvedURL = null;
+ if (bundle == null) {
+ }
+ else {
+ entry = bundle.getEntry(Constants.RELATIVE_STATEMACHINE_CONFIG_DIR);
+ }
+ if (entry == null) {
+ }
+ try {
+ resolvedURL = FileLocator.toFileURL(entry);
+ } catch (IOException e8) {
+ e8.printStackTrace();
+ }
+ java.net.URI resolvedURI = null;
+ if (!(resolvedURL == null)) {
+ try {
+ resolvedURI = new java.net.URI(resolvedURL.getProtocol(), resolvedURL.getPath(), null);
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }finally {
+
+ }}
+ else {
+ try {
+ resolvedURI = FileLocator.resolve(entry).toURI();
+ } catch (URISyntaxException e1) {
+ e1.printStackTrace();
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ java.net.URI fileUri = null;
+
+ try {
+ fileUri = new java.net.URI(resolvedURI + configFile);
+ } catch (URISyntaxException e8) {
+ e8.printStackTrace();
+ }
+
+ File file = new File(fileUri);
+
+ if(!file.exists()) {
+ try {
+ file.createNewFile();
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
+ f = file;
+ }
+
+ public void saveConfig() throws Exception {
+
+ File folderJCA = new File(System.getProperty("user.home") + Constants.RELATIVE_JCA_FOLDER);
+ File folderBC = new File(System.getProperty("user.home") + Constants.RELATIVE_BC_FOLDER);
+ File folderBCJCA = new File(System.getProperty("user.home") + Constants.RELATIVE_BC_JCA_FOLDER);
+ File folderTink = new File(System.getProperty("user.home") + Constants.RELATIVE_TINK_FOLDER);
+
+ File[] listOfFilesJCA = folderJCA.listFiles();
+ File[] listOfFilesBC = folderBC.listFiles();
+ File[] listOfFilesBCJCA = folderBCJCA.listFiles();
+ File[] listOfFilesTink = folderTink.listFiles();
+ File[] all = concatAll(listOfFilesJCA, listOfFilesBC, listOfFilesBCJCA, listOfFilesTink);
+
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ XMLEventWriter eventWriter = outputFactory
+ .createXMLEventWriter(new FileOutputStream(f));
+ XMLEventFactory eventFactory = XMLEventFactory.newInstance();
+ XMLEvent end = eventFactory.createDTD("\n");
+
+ StartDocument startDocument = eventFactory.createStartDocument();
+ eventWriter.add(startDocument);
+
+ eventWriter.add(eventFactory.createStartElement("",
+ "", "folders"));
+
+ for (int i = 0; i < all.length; i++) {
+ if (all[i].isFile()) {
+ if(all[i].getName().contains("crysl")) {
+
+ StartElement folderStartElement = eventFactory.createStartElement("",
+ "", "cryslFile");
+ eventWriter.add(folderStartElement);
+ createNode(eventWriter, "rule", all[i].getName());
+ createNode(eventWriter, "path", all[i].getAbsolutePath());
+ eventWriter.add(eventFactory.createEndElement("", "", "cryslFile"));
+ eventWriter.add(end);
+ }
+ }
+ }
+
+ eventWriter.add(end);
+
+ eventWriter.add(eventFactory.createEndElement("", "", "folders"));
+ eventWriter.add(end);
+
+ eventWriter.add(eventFactory.createEndDocument());
+ eventWriter.close();
+ }
+
+ private void createNode(XMLEventWriter eventWriter, String name,
+ String value) throws XMLStreamException {
+
+ XMLEventFactory eventFactory = XMLEventFactory.newInstance();
+ XMLEvent end = eventFactory.createDTD("\n");
+ XMLEvent tab = eventFactory.createDTD("\t");
+
+ StartElement sElement = eventFactory.createStartElement("", "", name);
+ eventWriter.add(tab);
+ eventWriter.add(sElement);
+
+ Characters characters = eventFactory.createCharacters(value);
+ eventWriter.add(characters);
+
+ EndElement eElement = eventFactory.createEndElement("", "", name);
+ eventWriter.add(eElement);
+ eventWriter.add(end);
+ }
+
+ public static T[] concatAll(T[] head, T[]... tail) {
+ int totalLength = head.length;
+ for (T[] array : tail) {
+ totalLength += array.length;
+ }
+ T[] result = Arrays.copyOf(head, totalLength);
+ int offset = head.length;
+ for (T[] array : tail) {
+ System.arraycopy(array, 0, result, offset, array.length);
+ offset += array.length;
+ }
+ return result;
+ }
+
+ public File getFile() {
+ return f;
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/generator/Main.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/generator/Main.java
new file mode 100644
index 000000000..16df1ba4d
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/generator/Main.java
@@ -0,0 +1,68 @@
+/*
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor.generator;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.google.inject.Provider;
+import de.cognicrypt.order.editor.StatemachineStandaloneSetup;
+import java.util.List;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.xtext.generator.GeneratorContext;
+import org.eclipse.xtext.generator.GeneratorDelegate;
+import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
+import org.eclipse.xtext.util.CancelIndicator;
+import org.eclipse.xtext.validation.CheckMode;
+import org.eclipse.xtext.validation.IResourceValidator;
+import org.eclipse.xtext.validation.Issue;
+
+public class Main {
+
+ public static void main(String[] args) {
+ if (args.length == 0) {
+ System.err.println("Aborting: no path to EMF resource provided!");
+ return;
+ }
+ Injector injector = new StatemachineStandaloneSetup().createInjectorAndDoEMFRegistration();
+ Main main = injector.getInstance(Main.class);
+ main.runGenerator(args[0]);
+ }
+
+ @Inject
+ private Provider resourceSetProvider;
+
+ @Inject
+ private IResourceValidator validator;
+
+ @Inject
+ private GeneratorDelegate generator;
+
+ @Inject
+ private JavaIoFileSystemAccess fileAccess;
+
+ protected void runGenerator(String string) {
+ // Load the resource
+ ResourceSet set = resourceSetProvider.get();
+ Resource resource = set.getResource(URI.createFileURI(string), true);
+
+ // Validate the resource
+ List list = validator.validate(resource, CheckMode.ALL, CancelIndicator.NullImpl);
+ if (!list.isEmpty()) {
+ for (Issue issue : list) {
+ System.err.println(issue);
+ }
+ return;
+ }
+
+ // Configure and start the generator
+ fileAccess.setOutputPath("src-gen/");
+ GeneratorContext context = new GeneratorContext();
+ context.setCancelIndicator(CancelIndicator.NullImpl);
+ generator.generate(resource, fileAccess, context);
+
+ System.out.println("Code generation finished.");
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/generator/StatemachineGenerator.xtend b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/generator/StatemachineGenerator.xtend
new file mode 100644
index 000000000..e621c60de
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/generator/StatemachineGenerator.xtend
@@ -0,0 +1,25 @@
+/*
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor.generator
+
+import org.eclipse.emf.ecore.resource.Resource
+import org.eclipse.xtext.generator.AbstractGenerator
+import org.eclipse.xtext.generator.IFileSystemAccess2
+import org.eclipse.xtext.generator.IGeneratorContext
+
+/**
+ * Generates code from your model files on save.
+ *
+ * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation
+ */
+class StatemachineGenerator extends AbstractGenerator {
+
+ override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
+// fsa.generateFile('greetings.txt', 'People to greet: ' +
+// resource.allContents
+// .filter(Greeting)
+// .map[name]
+// .join(', '))
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/parser/StatemachineParser.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/parser/StatemachineParser.java
new file mode 100644
index 000000000..ead0a24ce
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/parser/StatemachineParser.java
@@ -0,0 +1,250 @@
+package de.cognicrypt.order.editor.parser;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.xtext.common.types.access.impl.ClasspathTypeProvider;
+import org.eclipse.xtext.resource.SaveOptions;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.resource.XtextResourceSet;
+import org.osgi.framework.Bundle;
+
+import com.google.inject.Injector;
+
+import de.cognicrypt.order.editor.Activator;
+import de.cognicrypt.order.editor.Constants;
+import de.cognicrypt.order.editor.config.CryslFile;
+import de.cognicrypt.order.editor.statemachine.Statemachine;
+import de.cognicrypt.order.editor.statemachine.StatemachineFactory;
+import de.cognicrypt.order.editor.statemachine.StatemachinePackage;
+import de.darmstadt.tu.crossing.CrySLStandaloneSetup;
+import de.cognicrypt.order.editor.StatemachineStandaloneSetup;
+import de.darmstadt.tu.crossing.crySL.Domainmodel;
+import de.darmstadt.tu.crossing.crySL.Expression;
+import de.darmstadt.tu.crossing.crySL.SuperType;
+import de.cognicrypt.order.editor.statemachine.Event;
+import de.cognicrypt.order.editor.statemachine.State;
+import de.cognicrypt.order.editor.statemachine.Transition;
+import de.cognicrypt.order.editor.statemachine.StateMachineGraph;
+import de.cognicrypt.order.editor.statemachine.StateMachineGraphBuilder;
+import de.cognicrypt.order.editor.statemachine.StateNode;
+import de.cognicrypt.order.editor.statemachine.TransitionEdge;
+
+public class StatemachineParser {
+
+ public static void generate(List cryslFileList) {
+ HashMap selfs = new HashMap();
+ for(CryslFile f : cryslFileList) {
+
+ try {
+ EObject self = provideCrySLEObject(f.getPath());
+ generateStatemachineXtextResource(self, f.getRuleName());
+ } catch (MalformedURLException e2) {
+ e2.printStackTrace();
+ }
+ }
+ }
+
+ public static void generateStatemachineXtextResource(EObject self, String ruleName) {
+ final Domainmodel dm = (Domainmodel) self;
+ Expression order = dm.getOrder();
+
+ StateMachineGraph smgb = new StateMachineGraphBuilder(order).buildSMG();
+ Set stateNodes = smgb.getNodes();
+ java.util.List transitionEdges = smgb.getEdges();
+ java.util.List myTransitionEvents = new ArrayList();
+
+ for(TransitionEdge e : transitionEdges) {
+ myTransitionEvents.add((de.darmstadt.tu.crossing.crySL.Event) e.getLabel());
+ }
+
+ StatemachineStandaloneSetup.doSetup();
+
+ StatemachineStandaloneSetup stmStandaloneSetup = new StatemachineStandaloneSetup();
+ final Injector injector = stmStandaloneSetup.createInjectorAndDoEMFRegistration();
+ stmStandaloneSetup.register(injector);
+
+ ResourceSet resourceSet = new ResourceSetImpl();
+ StatemachinePackage.eINSTANCE.eClass();
+
+ String path = Activator.PLUGIN_ID + "/output/" + ruleName + Constants.STATEMACHINE_EXTENSION;
+ Resource resource = createAndAddXtextResourcePlatformPluginURI(path, resourceSet);
+
+ resourceSet.getResources().add(resource);
+
+ Statemachine statemachine = StatemachineFactory.eINSTANCE.createStatemachine();
+
+ State state = null;
+ Event event = null;
+ //de.darmstadt.tu.crossing.statemachine.Transition transition = null;
+ Transition transition = null;
+ HashMap stateNodeMap = new HashMap();
+
+ SuperType ev = null;
+ int counter = 0;
+
+ //process stateNodes separately, still unsorted
+ for(StateNode s: stateNodes) {
+ state = (State) StatemachineFactory.eINSTANCE.createState();
+ state.setName("s" + s.getName());
+ if(s.getAccepting().equals(true)) {
+ state.setIsFinal(true);
+ }
+ else {
+ state.setIsFinal(false);
+ }
+ statemachine.getStates().add((de.cognicrypt.order.editor.statemachine.State) state);
+ counter++;
+ stateNodeMap.put(s, state);
+ }
+
+ //process transition edges for states and transitions
+ for(int i = 0; i < transitionEdges.size(); i++) {
+ if(transitionEdges.get(i).getLabel() instanceof SuperType) {
+ ev = (SuperType) transitionEdges.get(i).getLabel();
+ event = (Event) StatemachineFactory.eINSTANCE.createEvent();
+ // check for duplicate events to avoid same naming for different edges (causes serialization error)
+ if(sameEvent(transitionEdges, transitionEdges.get(i))) {
+ event.setName(((SuperType) ev).getName() + i);
+ }
+ else {
+ event.setName(((SuperType) ev).getName());
+ }
+ }
+
+ transition = StatemachineFactory.eINSTANCE.createTransition();
+
+ transition.setName("t" + i);
+ transition.setEvent(event);
+ transition.setFromState(stateNodeMap.get(transitionEdges.get(i).from()));
+ transition.setEndState(stateNodeMap.get(transitionEdges.get(i).to()));
+ transition.getFromState().getTransitions().add(transition);
+ statemachine.getTransitions().add(transition);
+ }
+
+ resource.getContents().add(statemachine);
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+
+ try {
+ resource.save(outputStream, SaveOptions.newBuilder().format().getOptions().toOptionsMap());
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ // store in file
+ java.net.URI resolvedURI = null;
+
+ try {
+ final Bundle bundle = Platform.getBundle(de.cognicrypt.order.editor.Activator.PLUGIN_ID);
+ final URL entry = bundle.getEntry(Constants.RELATIVE_STATEMACHINE_MODELS_DIR);
+ final URL resolvedURL = FileLocator.toFileURL(entry);
+ if (!(resolvedURL == null)) {
+ resolvedURI = new URI(resolvedURL.getProtocol(), resolvedURL.getPath(), null);
+ } else {
+ resolvedURI = FileLocator.resolve(entry).toURI();
+ }
+ }
+ catch (final IOException ex) {
+ Activator.getDefault().logError(ex, Constants.ERROR_MESSAGE_NO_FILE);
+ } catch (URISyntaxException ex) {
+ Activator.getDefault().logError(ex);
+ }
+ java.net.URI fileURI = null;
+
+ try {
+ fileURI = new java.net.URI(resolvedURI + ruleName + Constants.STATEMACHINE_EXTENSION);
+ } catch (URISyntaxException e3) {
+ e3.printStackTrace();
+ }
+
+ File file = new File(fileURI);
+
+ if(!file.exists()) {
+ try {
+ file.createNewFile();
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ try (OutputStream fileOutputStream = new FileOutputStream(file)) {
+ try {
+ outputStream.writeTo(fileOutputStream);
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ } finally {
+ fileOutputStream.close();
+ }
+ } catch (IOException e2) {
+ e2.printStackTrace();
+ }
+ }
+
+ // method for checking whether events occur more frequently
+ public static boolean sameEvent(List edges, TransitionEdge e) {
+ int counter = 0;
+ for(TransitionEdge ed: edges) {
+ if(ed != e) {
+ if(ed.getLabel().equals(e.getLabel())) {
+ counter++;
+ }
+ }
+ }
+ if(counter > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ public static XtextResource createAndAddXtextResourcePlatformPluginURI(String outputFile, ResourceSet resourceSet) {
+ // parsing a plug-in-based path string, with an option to encode the created URI
+ org.eclipse.emf.common.util.URI uri = org.eclipse.emf.common.util.URI.createPlatformPluginURI(outputFile, false);
+ XtextResource resource = (XtextResource) resourceSet.createResource(uri);
+ return resource;
+ }
+
+ public static EObject provideCrySLEObject(String pathToCryslFile) throws MalformedURLException {
+ // Loading model
+ CrySLStandaloneSetup crySLStandaloneSetup = new CrySLStandaloneSetup();
+ final Injector injector = crySLStandaloneSetup.createInjectorAndDoEMFRegistration();
+ XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);
+ String a = System.getProperty("java.class.path");
+ String[] l = a.split(";");
+ URL[] classpath = new URL[l.length];
+ for (int i = 0; i < classpath.length; i++) {
+ classpath[i] = new File(l[i]).toURI().toURL();
+ }
+ URLClassLoader ucl = new URLClassLoader(classpath);
+ resourceSet.setClasspathURIContext(new URLClassLoader(classpath));
+ new ClasspathTypeProvider(ucl, resourceSet, null, null);
+ resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
+ final Resource resource = resourceSet.getResource(org.eclipse.emf.common.util.URI.createFileURI(pathToCryslFile), true);
+ final EObject eObject = resource.getContents().get(0);
+ return eObject;
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/scoping/StatemachineScopeProvider.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/scoping/StatemachineScopeProvider.java
new file mode 100644
index 000000000..c5af0d9e8
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/scoping/StatemachineScopeProvider.java
@@ -0,0 +1,15 @@
+/*
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor.scoping;
+
+
+/**
+ * This class contains custom scoping description.
+ *
+ * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping
+ * on how and when to use it.
+ */
+public class StatemachineScopeProvider extends AbstractStatemachineScopeProvider {
+
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/CrySLEvent.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/CrySLEvent.java
new file mode 100644
index 000000000..96b1743eb
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/CrySLEvent.java
@@ -0,0 +1,25 @@
+package de.cognicrypt.order.editor.statemachine;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+
+import de.darmstadt.tu.crossing.crySL.Event;
+import de.darmstadt.tu.crossing.crySL.impl.EventImpl;
+
+public class CrySLEvent extends EventImpl {
+
+
+ public CrySLEvent() {
+ super();
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/CrySLMethod.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/CrySLMethod.java
new file mode 100644
index 000000000..4ebb6bac5
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/CrySLMethod.java
@@ -0,0 +1,110 @@
+package de.cognicrypt.order.editor.statemachine;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map.Entry;
+
+public class CrySLMethod implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private final String methodName;
+ private final Entry retObject;
+ private final List> parameters;
+ private final List backward;
+
+ public CrySLMethod(String methName, List> pars, List backw, Entry returnObject) {
+ methodName = methName;
+ parameters = pars;
+ backward = backw;
+ retObject = returnObject;
+ }
+
+ /**
+ * @return the FQ methodName
+ */
+ public String getMethodName() {
+ return methodName;
+ }
+
+ /**
+ * @return the short methodName
+ */
+ public String getShortMethodName() {
+ return methodName.substring(methodName.lastIndexOf(".") + 1);
+ }
+
+
+ /**
+ * @return the parameters
+ */
+ public List> getParameters() {
+ return parameters;
+ }
+
+ /**
+ * @return the backward
+ */
+ public List getBackward() {
+ return backward;
+ }
+
+
+ public Entry getRetObject() {
+ return retObject;
+ }
+ public String toString() {
+ return getName();
+ }
+
+ public String getName() {
+ StringBuilder stmntBuilder = new StringBuilder();
+ String returnValue = retObject.getKey();
+ if (!"_".equals(returnValue)) {
+ stmntBuilder.append(returnValue);
+ stmntBuilder.append(" = ");
+ }
+
+ stmntBuilder.append(this.methodName);
+ stmntBuilder.append("(");
+
+
+ for (Entry par: parameters) {
+ stmntBuilder.append(" ");
+ stmntBuilder.append(par.getKey());
+// if (backward != null && backward.size() == parameters.size()) {
+// stmntBuilder.append(" (");
+// stmntBuilder.append(backward.get(parameters.indexOf(par)));
+// stmntBuilder.append("),");
+// }
+ }
+
+ stmntBuilder.append(");");
+ return stmntBuilder.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((backward == null) ? 0 : backward.hashCode());
+ result = prime * result + ((methodName == null) ? 0 : methodName.hashCode());
+ result = prime * result + ((parameters == null) ? 0 : parameters.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof CrySLMethod)) {
+ return false;
+ }
+ CrySLMethod other = (CrySLMethod) obj;
+ return this.getMethodName().equals(other.getMethodName()) && parameters.equals(other.parameters);
+ }
+
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/CryslReaderUtils.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/CryslReaderUtils.java
new file mode 100644
index 000000000..3c97ad123
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/CryslReaderUtils.java
@@ -0,0 +1,76 @@
+package de.cognicrypt.order.editor.statemachine;
+
+import java.util.AbstractMap.SimpleEntry;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map.Entry;
+
+import de.darmstadt.tu.crossing.crySL.Aggregate;
+import de.darmstadt.tu.crossing.crySL.Event;
+import de.darmstadt.tu.crossing.crySL.Method;
+import de.darmstadt.tu.crossing.crySL.ObjectDecl;
+import de.darmstadt.tu.crossing.crySL.Par;
+import de.darmstadt.tu.crossing.crySL.ParList;
+import de.darmstadt.tu.crossing.crySL.SuperType;
+
+public class CryslReaderUtils {
+ protected static Event resolveAggregateToMethodeNames(final Event leaf) {
+ if (leaf instanceof Aggregate) {
+ final Aggregate ev = (Aggregate) leaf;
+ return ev;
+ } else {
+ final ArrayList statements = new ArrayList<>();
+ CrySLMethod stringifyMethodSignature = stringifyMethodSignature(leaf);
+ if (stringifyMethodSignature != null) {
+ statements.add(stringifyMethodSignature);
+ }
+ return leaf;
+ }
+ }
+
+ protected static CrySLMethod stringifyMethodSignature(final Event lab) {
+ if (!(lab instanceof SuperType)) {
+ return null;
+ }
+ final Method method = ((SuperType) lab).getMeth();
+
+ String methodName = method.getMethName().getSimpleName();
+ if (methodName == null) {
+ methodName = ((de.darmstadt.tu.crossing.crySL.Domainmodel) (method.eContainer().eContainer().eContainer())).getJavaType().getSimpleName();
+ }
+ final String qualifiedName =
+ ((de.darmstadt.tu.crossing.crySL.Domainmodel) (method.eContainer().eContainer().eContainer())).getJavaType().getQualifiedName() + "." + methodName; // method.getMethName().getQualifiedName();
+ // qualifiedName = removeSPI(qualifiedName);
+ final List> pars = new ArrayList<>();
+ final de.darmstadt.tu.crossing.crySL.Object returnValue = method.getLeftSide();
+ Entry returnObject = null;
+ if (returnValue != null && returnValue.getName() != null) {
+ final ObjectDecl v = ((ObjectDecl) returnValue.eContainer());
+ returnObject = new SimpleEntry<>(returnValue.getName(), v.getObjectType().getQualifiedName() + ((v.getArray() != null) ? v.getArray() : ""));
+ } else {
+ returnObject = new SimpleEntry<>("_", "void");
+ }
+ final ParList parList = method.getParList();
+ if (parList != null) {
+ for (final Par par : parList.getParameters()) {
+ String parValue = "_";
+ if (par.getVal() != null && par.getVal().getName() != null) {
+ final ObjectDecl objectDecl = (ObjectDecl) par.getVal().eContainer();
+ parValue = par.getVal().getName();
+ final String parType = objectDecl.getObjectType().getIdentifier() + ((objectDecl.getArray() != null) ? objectDecl.getArray() : "");
+ pars.add(new SimpleEntry<>(parValue, parType));
+ } else {
+ pars.add(new SimpleEntry<>(parValue, "AnyType"));
+ }
+ }
+ }
+ return new CrySLMethod(qualifiedName, pars, new ArrayList(), returnObject);
+ }
+
+ public static File getResourceFromWithin(final String inputPath) {
+ return new File(inputPath);
+ }
+}
+
+
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateMachineGraph.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateMachineGraph.java
new file mode 100644
index 000000000..e96fc3e17
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateMachineGraph.java
@@ -0,0 +1,127 @@
+package de.cognicrypt.order.editor.statemachine;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import de.darmstadt.tu.crossing.crySL.CrySLFactory;
+import de.darmstadt.tu.crossing.crySL.Expression;
+import de.darmstadt.tu.crossing.crySL.Order;
+import de.darmstadt.tu.crossing.crySL.SimpleOrder;
+import de.darmstadt.tu.crossing.crySL.impl.ExpressionImpl;
+
+public final class StateMachineGraph{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private final Set nodes;
+ private final List edges;
+
+ private final HashMap nodemaps;
+ public StateMachineGraph() {
+ nodes = new HashSet();
+ edges = new ArrayList();
+ nodemaps = new HashMap();
+ }
+
+ public Boolean addEdge(TransitionEdge edge) {
+ final StateNode right = edge.getRight();
+ final StateNode left = edge.getLeft();
+ if(edge.getLeft().getName().equals("init")) {
+ //remove initial node (Order) and put an expression instead of it
+ Expression newElement = CrySLFactory.eINSTANCE.createExpression();
+ nodemaps.put("init", newElement);
+
+ }
+ if (!(nodes.parallelStream().anyMatch(e -> e.equals(left)) || nodes.parallelStream().anyMatch(e -> e.equals(right)))) {
+ return false;
+ }
+ if (edges.contains(edge)) {
+ return false;
+ }
+ edges.add(edge);
+ return true;
+ }
+
+ public void wrapUpCreation() {
+ getAcceptingStates().parallelStream().forEach(e -> {
+ e.setHopsToAccepting(0);
+ updateHops(e);
+ });
+ }
+
+ private void updateHops(StateNode node) {
+ int newPath = node.getHopsToAccepting() + 1;
+ getAllTransitions().parallelStream().forEach(e -> {
+ StateNode theNewRight = e.getLeft();
+ if (e.getRight().equals(node) && theNewRight.getHopsToAccepting() > newPath) {
+ theNewRight.setHopsToAccepting(newPath);
+ updateHops(theNewRight);
+ }
+ });
+ }
+
+ public Boolean addNode(StateNode node, Expression expression) {
+ for (StateNode innerNode : nodes) {
+ if (innerNode.getName().equals(node.getName())) {
+ return false;
+ }
+ }
+ nodes.add(node);
+ nodemaps.put(node.getName(), expression);
+ return true;
+ }
+
+ public String toString() {
+ StringBuilder graphSB = new StringBuilder();
+ for (StateNode node : nodes) {
+ graphSB.append(node.toString());
+ graphSB.append(System.lineSeparator());
+ }
+
+ for (TransitionEdge te : edges) {
+ graphSB.append(te.toString());
+ graphSB.append(System.lineSeparator());
+ }
+
+ return graphSB.toString();
+ }
+
+ public Set getNodes() {
+ return nodes;
+ }
+
+ public HashMap getNodeMap() {
+ return nodemaps;
+ }
+
+ public List getEdges() {
+ return edges;
+ }
+
+ public TransitionEdge getInitialTransition() {
+ return edges.get(0);
+ }
+
+ public Collection getAcceptingStates() {
+ Collection accNodes = new ArrayList();
+ for (StateNode node : nodes) {
+ if (node.getAccepting()) {
+ accNodes.add(node);
+ }
+ }
+
+ return accNodes;
+ }
+
+ public Collection getAllTransitions() {
+ return getEdges();
+ }
+
+}
+
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateMachineGraphBuilder.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateMachineGraphBuilder.java
new file mode 100644
index 000000000..f91f0a244
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateMachineGraphBuilder.java
@@ -0,0 +1,473 @@
+package de.cognicrypt.order.editor.statemachine;
+
+import java.util.AbstractMap.SimpleEntry;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
+
+import de.darmstadt.tu.crossing.crySL.Event;
+import de.darmstadt.tu.crossing.crySL.Expression;
+import de.darmstadt.tu.crossing.crySL.Order;
+import de.darmstadt.tu.crossing.crySL.SimpleOrder;
+
+public class StateMachineGraphBuilder {
+
+ private final Expression head;
+ private final StateMachineGraph result = new StateMachineGraph();
+ private int nodeNameCounter = 0;
+
+ public StateMachineGraphBuilder(final Expression order) {
+ this.head = order;
+ this.result.addNode(new StateNode("init", true, true), order);
+
+ }
+
+ private StateNode addRegularEdge(final Expression leaf, final StateNode prevNode, final StateNode nextNode) {
+ return addRegularEdge(leaf, prevNode, nextNode, false);
+ }
+
+ private StateNode addRegularEdge(final Expression leaf, final StateNode prevNode, final StateNode nextNode, final Boolean isStillAccepting) {
+ final Event label = CryslReaderUtils.resolveAggregateToMethodeNames(leaf.getOrderEv().get(0));
+ return addRegularEdge(leaf,label, prevNode, nextNode, isStillAccepting);
+ }
+
+
+ private StateNode addRegularEdge(Expression leaf,final Event label, final StateNode prevNode, StateNode nextNode, final Boolean isStillAccepting) {
+ if (nextNode == null) {
+ nextNode = getNewNode();
+ this.result.addNode(nextNode, leaf);
+ }
+ if (!isStillAccepting) {
+ prevNode.setAccepting(false);
+ }
+ boolean added = this.result.addEdge(new TransitionEdge(label, prevNode, nextNode));
+ return nextNode;
+ }
+
+ public StateMachineGraph buildSMG() {
+ StateNode initialNode = null;
+ for (final StateNode n : this.result.getNodes()) {
+ initialNode = n;
+ }
+ if (this.head != null) {
+ processHead(this.head, 0, HashMultimap.create(), initialNode);
+ } else {
+ //see the implementation in CryptoAnalysis StateMachineGraphBuilder
+ // may be required to keep it as it is.
+ //this.result.addEdge(new TransitionEdge(new ArrayList(), initialNode, initialNode));
+ this.result.addEdge(new TransitionEdge(new CrySLEvent(), initialNode, initialNode));
+ }
+ return this.result;
+ }
+
+ private StateNode getNewNode() {
+ return new StateNode(String.valueOf(this.nodeNameCounter++), false, true);
+ }
+
+ private List getOutgoingEdges(final StateNode curNode, final StateNode notTo) {
+ final List outgoingEdges = new ArrayList<>();
+ for (final TransitionEdge comp : this.result.getAllTransitions()) {
+ if (comp.getLeft().equals(curNode) && !(comp.getRight().equals(curNode) || comp.getRight().equals(notTo))) {
+ outgoingEdges.add(comp);
+ }
+ }
+ return outgoingEdges;
+ }
+
+ private StateNode isGeneric(final String el, final int level, final Multimap> leftOvers) {
+ for (final Entry entry : leftOvers.get(level)) {
+ if (el.equals(entry.getKey())) {
+ return entry.getValue();
+ }
+ }
+ return null;
+ }
+
+ private StateNode isOr(final int level, final Multimap> leftOvers) {
+ return isGeneric("|", level, leftOvers);
+ }
+
+ private StateNode isQM(final int level, final Multimap> leftOvers) {
+ return isGeneric("?", level, leftOvers);
+ }
+
+ private StateNode process(final Expression curLevel, final int level, final Multimap> leftOvers, StateNode prevNode) {
+ final Expression left = curLevel.getLeft();
+ final Expression right = curLevel.getRight();
+ final String leftElOp = (left != null) ? left.getElementop() : "";
+ final String rightElOp = (right != null) ? right.getElementop() : "";
+ final String orderOp = curLevel.getOrderop();
+ // case 1 = left & right = non-leaf
+ // case 2 = left = non-leaf & right = leaf
+ // case 3 = left = leaf & right = non-leaf
+ // case 4 = left = leaf & right = leaf
+
+ if (left == null && right == null) {
+ addRegularEdge(left, prevNode, null);
+ } else if ((left instanceof Order || left instanceof SimpleOrder) && (right instanceof Order || right instanceof SimpleOrder)) {
+ final StateNode leftPrev = prevNode;
+ prevNode = process(left, level + 1, leftOvers, prevNode);
+
+ final StateNode rightPrev = prevNode;
+ StateNode returnToNode = null;
+ if ("|".equals(orderOp)) {
+ leftOvers.put(level + 1, new HashMap.SimpleEntry<>(orderOp, prevNode));
+ prevNode = process(right, level + 1, leftOvers, leftPrev);
+ } else if ((returnToNode = isOr(level, leftOvers)) != null) {
+ prevNode = process(right, level + 1, leftOvers, returnToNode);
+ } else {
+ prevNode = process(right, level + 1, leftOvers, prevNode);
+ }
+
+ if (rightElOp != null && ("+".equals(rightElOp) || "*".equals(rightElOp))) {
+ final List outgoingEdges = new ArrayList();
+ if ("|".equals(orderOp)) {
+ final List tmpOutgoingEdges = getOutgoingEdges(leftPrev, null);
+ for (final TransitionEdge outgoingEdge : tmpOutgoingEdges) {
+ if (isReachable(outgoingEdge.to(), prevNode, new ArrayList())) {
+ outgoingEdges.addAll(getOutgoingEdges(outgoingEdge.to(), prevNode));
+ }
+ }
+ for (final TransitionEdge outgoingEdge : outgoingEdges) {
+ if (isReachable(prevNode, outgoingEdge.from(), new ArrayList())) {
+ addRegularEdge(right,outgoingEdge.getLabel(), prevNode, outgoingEdge.from(), true);
+ }
+ }
+
+ } else {
+ outgoingEdges.addAll(getOutgoingEdges(rightPrev, prevNode));
+ for (final TransitionEdge outgoingEdge : outgoingEdges) {
+ addRegularEdge(right,outgoingEdge.getLabel(), prevNode, outgoingEdge.to(), true);
+ }
+ }
+ }
+
+ if (leftElOp != null && ("?".equals(leftElOp) || "*".equals(leftElOp))) {
+ addRegularEdge(right, leftPrev, prevNode, true);
+ }
+
+ } else if ((left instanceof Order || left instanceof SimpleOrder) && !(right instanceof Order || right instanceof SimpleOrder)) {
+ StateNode leftPrev = prevNode;
+
+ Optional> optionalOrLevel = leftOvers.get(level).stream().filter(e -> "|".equals(e.getKey())).findFirst();
+ if (optionalOrLevel.isPresent()) {
+ Entry orLevel = optionalOrLevel.get();
+ StateNode p = orLevel.getValue();
+ List orEdges = getOutgoingEdges(prevNode, null);
+ if (!orEdges.isEmpty()) {
+ Optional edge = orEdges.stream().filter(e -> e.getRight().equals(p)).findFirst();
+ if (edge.isPresent() && edge.get().getLabel().equals(CryslReaderUtils.resolveAggregateToMethodeNames(getLeftMostChild(left).getOrderEv().get(0)))) {
+ leftOvers.put(level + 1, orLevel);
+ }
+ }
+ }
+ prevNode = process(left, level + 1, leftOvers, prevNode);
+
+ if (rightElOp != null && ("?".equals(rightElOp) || "*".equals(rightElOp))) {
+ leftOvers.put(level - 1, new HashMap.SimpleEntry<>(rightElOp, prevNode));
+ prevNode = addRegularEdge(right, prevNode, null, true);
+ } else {
+ prevNode = addRegularEdge(right, prevNode, null);
+ }
+
+ if (rightElOp != null && ("+".equals(rightElOp) || "*".equals(rightElOp))) {
+ addRegularEdge(right, prevNode, prevNode, true);
+ }
+
+ } else if (!(left instanceof Order || left instanceof SimpleOrder) && (right instanceof Order || right instanceof SimpleOrder)) {
+ StateNode leftPrev = prevNode;
+ prevNode = addRegularEdge(left, prevNode, null);
+
+ if (leftElOp != null && ("+".equals(leftElOp) || "*".equals(leftElOp))) {
+ addRegularEdge(left, prevNode, prevNode, true);
+ }
+
+ if (rightElOp != null && ("?".equals(rightElOp) || "*".equals(rightElOp))) {
+ leftOvers.put(level - 1, new HashMap.SimpleEntry<>(rightElOp, prevNode));
+ }
+ final StateNode rightPrev = prevNode;
+ if ("|".equals(orderOp)) {
+ leftOvers.put(level + 1, new HashMap.SimpleEntry<>(orderOp, prevNode));
+ prevNode = process(right, level + 1, leftOvers, leftPrev);
+ } else {
+ prevNode = process(right, level + 1, leftOvers, prevNode);
+ }
+
+ if (rightElOp != null && ("+".equals(rightElOp) || "*".equals(rightElOp))) {
+ final List outgoingEdges = getOutgoingEdges(rightPrev, prevNode);
+ for (final TransitionEdge outgoingEdge : outgoingEdges) {
+ addRegularEdge(right,outgoingEdge.getLabel(), prevNode, outgoingEdge.to(), true);
+ }
+ }
+
+ if (leftElOp != null && ("?".equals(leftElOp) || "*".equals(leftElOp))) {
+ addRegularEdge(right, leftPrev, prevNode, true);
+ }
+
+ } else if (!(left instanceof Order || left instanceof SimpleOrder) && !(right instanceof Order || right instanceof SimpleOrder)) {
+ StateNode leftPrev = null;
+ leftPrev = prevNode;
+
+ boolean sameName = false;
+ List orEdges = getOutgoingEdges(prevNode, null);
+ Optional> alternative = leftOvers.get(level).stream().filter(e -> "|".equals(e.getKey())).findFirst();
+ if (alternative.isPresent()) {
+ Entry orLevel = alternative.get();
+ StateNode p = orLevel.getValue();
+ if (!orEdges.isEmpty()) {
+ Optional edge = orEdges.stream().filter(e -> e.getRight().equals(p)).findFirst();
+ if (edge.isPresent() && edge.get().getLabel().equals(CryslReaderUtils.resolveAggregateToMethodeNames(getLeftMostChild(left).getOrderEv().get(0)))) {
+ sameName = true;
+ prevNode = p;
+ leftOvers.remove(level, orLevel);
+ }
+ }
+ }
+ if (!sameName) {
+ prevNode = addRegularEdge(left, prevNode, null);
+ }
+
+ StateNode returnToNode = isOr(level, leftOvers);
+ if (leftElOp != null && ("+".equals(leftElOp) || "*".equals(leftElOp))) {
+ addRegularEdge(left, prevNode, prevNode, true);
+ }
+
+ if (rightElOp != null && ("?".equals(rightElOp) || "*".equals(rightElOp))) {
+ leftOvers.put(level - 1, new HashMap.SimpleEntry<>(rightElOp, prevNode));
+ }
+ if (returnToNode != null || "|".equals(orderOp)) {
+ if ("|".equals(orderOp)) {
+ addRegularEdge(right, leftPrev, prevNode);
+ }
+ if ((returnToNode = isOr(level, leftOvers)) != null) {
+ prevNode = addRegularEdge(right, prevNode, returnToNode);
+ }
+ } else {
+ prevNode = addRegularEdge(right, prevNode, null);
+ }
+
+ if (rightElOp != null && ("+".equals(rightElOp) || "*".equals(rightElOp))) {
+ addRegularEdge(right, prevNode, prevNode, true);
+ }
+
+ if (leftElOp != null && ("?".equals(leftElOp) || "*".equals(leftElOp))) {
+ addRegularEdge(right, leftPrev, prevNode, true);
+ }
+
+ if (sameName) {
+ setAcceptingState(alternative.get().getValue());
+ }
+
+ }
+ leftOvers.removeAll(level);
+ return prevNode;
+ }
+
+ private boolean isReachable(final StateNode stateNode, final StateNode prevNode, final List skippable) {
+ for (final TransitionEdge edge : getOutgoingEdges(stateNode, stateNode)) {
+ if (edge.to().equals(prevNode)) {
+ return true;
+ } else if (!skippable.contains(edge.to())) {
+ skippable.add(edge.to());
+ return isReachable(edge.to(), prevNode, skippable);
+ }
+ }
+ return false;
+ }
+
+ private void processHead(final Expression curLevel, final int level, final Multimap> leftOvers, StateNode prevNode) {
+ final Expression left = curLevel.getLeft();
+ final Expression right = curLevel.getRight();
+ final String leftElOp = (left != null) ? left.getElementop() : "";
+ final String rightElOp = (right != null) ? right.getElementop() : "";
+ final String orderOp = curLevel.getOrderop();
+
+ if (left == null && right == null) {
+ final String elOp = curLevel.getElementop();
+ if ("*".equals(elOp) || "?".equals(elOp)) {
+ prevNode = addRegularEdge(curLevel, prevNode, null, true);
+ } else {
+ addRegularEdge(curLevel, prevNode, null);
+ }
+ if ("*".equals(elOp) || "+".equals(elOp)) {
+ addRegularEdge(curLevel, prevNode, prevNode, true);
+ }
+ } else if ((left instanceof Order || left instanceof SimpleOrder) && (right instanceof Order || right instanceof SimpleOrder)) {
+ final StateNode leftPrev = prevNode;
+ prevNode = process(left, level + 1, leftOvers, prevNode);
+ final StateNode rightPrev = prevNode;
+ if ("|".equals(orderOp)) {
+ prevNode = process(right, level + 1, leftOvers, leftPrev);
+ } else {
+ prevNode = process(right, level + 1, leftOvers, prevNode);
+ }
+ for (Entry a : leftOvers.get(level).stream().filter(e -> "?".equals(e.getKey())).collect(Collectors.toList())) {
+ if ("*".equals(rightElOp) || "?".equals(rightElOp)) {
+ setAcceptingState(a.getValue());
+ for (TransitionEdge l : getOutgoingEdges(rightPrev, null)) {
+ addRegularEdge(right, l.getLabel(), a.getValue(), l.getRight(), true);
+ }
+ }
+ }
+
+ if ("*".equals(rightElOp) || "?".equals(rightElOp)) {
+ setAcceptingState(rightPrev);
+ }
+ if (rightElOp != null && ("+".equals(rightElOp) || "*".equals(rightElOp))) {
+ final String orderop = right.getOrderop();
+ List outgoingEdges = null;
+ if (orderop != null && "|".equals(orderop)) {
+ outgoingEdges = getOutgoingEdges(rightPrev, null);
+ } else {
+ outgoingEdges = getOutgoingEdges(rightPrev, prevNode);
+ }
+ for (final TransitionEdge outgoingEdge : outgoingEdges) {
+ addRegularEdge(right, outgoingEdge.getLabel(), prevNode, outgoingEdge.to(), true);
+ }
+ }
+
+ if (leftElOp != null && ("?".equals(leftElOp) || "*".equals(leftElOp))) {
+ addRegularEdge(right, leftPrev, prevNode, true);
+ }
+ } else if ((left instanceof Order || left instanceof SimpleOrder) && !(right instanceof Order || right instanceof SimpleOrder)) {
+ final StateNode leftPrev = prevNode;
+ prevNode = process(left, level + 1, leftOvers, prevNode);
+ final StateNode rightPrev = prevNode;
+ if ("|".equals(orderOp)) {
+ prevNode = addRegularEdge(right, leftPrev, prevNode);
+ } else {
+ prevNode = addRegularEdge(right, prevNode, null);
+ }
+ for (Entry a : leftOvers.get(level).stream().filter(e -> "*".equals(e.getKey())).collect(Collectors.toList())) {
+ addRegularEdge(right, a.getValue(), prevNode, true);
+ }
+ boolean isOptional = "*".equals(rightElOp) || "?".equals(rightElOp);
+ if (isOptional) {
+ setAcceptingState(rightPrev);
+ if ("?".equals(left.getRight().getElementop()) || "*".equals(left.getRight().getElementop())) {
+ final List outgoingEdges = getOutgoingEdges(leftPrev, null);
+ for (final TransitionEdge outgoingEdge : outgoingEdges) {
+ setAcceptingState(outgoingEdge.to());
+ }
+ }
+ }
+
+ if (rightElOp != null && ("+".equals(rightElOp) || "*".equals(rightElOp))) {
+ final List outgoingEdges = getOutgoingEdges(rightPrev, null);
+ for (final TransitionEdge outgoingEdge : outgoingEdges) {
+ addRegularEdge(right, outgoingEdge.getLabel(), prevNode, outgoingEdge.to(), true);
+ }
+ }
+ if (leftOvers.containsKey(level)) {
+ for (Entry entry : leftOvers.get(level).stream().filter(e -> "*".equals(e.getKey()) || "?".equals(e.getKey())).collect(Collectors.toList())) {
+ addRegularEdge(right, entry.getValue(), prevNode, isOptional);
+ }
+ }
+ StateNode returnToNode = null;
+ if ((returnToNode = isQM(level, leftOvers)) != null) {
+ addRegularEdge(right, returnToNode, prevNode, true);
+ }
+ } else if (!(left instanceof Order || left instanceof SimpleOrder) && (right instanceof Order || right instanceof SimpleOrder)) {
+ StateNode leftPrev = null;
+ leftPrev = prevNode;
+ prevNode = addRegularEdge(left, prevNode, null);
+
+ if (leftElOp != null && ("+".equals(leftElOp) || "*".equals(leftElOp))) {
+ addRegularEdge(left, prevNode, prevNode);
+ }
+
+ final StateNode rightPrev = prevNode;
+ StateNode returnToNode = null;
+ if (rightElOp != null && ("?".equals(rightElOp) || "*".equals(rightElOp))) {
+ setAcceptingState(rightPrev);
+ }
+ if ("|".equals(orderOp)) {
+ setAcceptingState(prevNode);
+ SimpleEntry entry = new HashMap.SimpleEntry<>(orderOp, prevNode);
+ leftOvers.put(level + 1, entry);
+ prevNode = process(right, level + 1, leftOvers, leftPrev);
+
+ } else if ((returnToNode = isOr(level, leftOvers)) != null) {
+ prevNode = process(right, level + 1, leftOvers, returnToNode);
+ } else {
+ prevNode = process(right, level + 1, leftOvers, prevNode);
+ }
+
+ if (rightElOp != null && ("+".equals(rightElOp) || "*".equals(rightElOp))) {
+ final List outgoingEdges = getOutgoingEdges(rightPrev, null);
+ for (final TransitionEdge outgoingEdge : outgoingEdges) {
+ addRegularEdge(right, outgoingEdge.getLabel(), prevNode, outgoingEdge.to(), true);
+ }
+ }
+
+ if (leftElOp != null && ("?".equals(leftElOp) || "*".equals(leftElOp))) {
+ setAcceptingState(leftPrev);
+ final List outgoingEdges = getOutgoingEdges(rightPrev, null);
+ for (final TransitionEdge outgoingEdge : outgoingEdges) {
+ setAcceptingState(outgoingEdge.to());
+ addRegularEdge(right, outgoingEdge.getLabel(), leftPrev, outgoingEdge.to(), true);
+ }
+ }
+ if (rightElOp != null && ("?".equals(rightElOp) || "*".equals(rightElOp))) {
+ setAcceptingState(rightPrev);
+ if (leftOvers.containsKey(level)) {
+ leftOvers.get(level).stream().filter(e -> "*".equals(e.getKey()) || "?".equals(e.getKey())).forEach(e -> setAcceptingState(e.getValue()));
+ }
+ }
+
+ } else if (!(left instanceof Order || left instanceof SimpleOrder) && !(right instanceof Order || right instanceof SimpleOrder)) {
+ StateNode leftPrev = null;
+ leftPrev = prevNode;
+ StateNode returnToNode = isOr(level, leftOvers);
+
+ final boolean leftOptional = "?".equals(leftElOp) || "*".equals(leftElOp);
+ prevNode = addRegularEdge(left, prevNode, null, leftOptional);
+
+ if (leftElOp != null && ("+".equals(leftElOp) || "*".equals(leftElOp))) {
+ addRegularEdge(left, prevNode, prevNode, true);
+ }
+
+ final boolean rightoptional = "?".equals(rightElOp) || "*".equals(rightElOp);
+ if (returnToNode != null || "|".equals(orderOp)) {
+ if ("|".equals(orderOp)) {
+ addRegularEdge(right, leftPrev, prevNode, rightoptional);
+ }
+ if ((returnToNode = isOr(level, leftOvers)) != null) {
+ prevNode = addRegularEdge(right, prevNode, returnToNode, rightoptional);
+ }
+ } else {
+ prevNode = addRegularEdge(right, prevNode, null, rightoptional);
+ }
+
+ if (rightElOp != null && ("+".equals(rightElOp) || "*".equals(rightElOp))) {
+ addRegularEdge(right, prevNode, prevNode, true);
+ }
+
+ if (leftElOp != null && ("?".equals(leftElOp) || "*".equals(leftElOp))) {
+ addRegularEdge(right, leftPrev, prevNode, true);
+ }
+ }
+ }
+
+ private void setAcceptingState(final StateNode prevNode) {
+ prevNode.setAccepting(true);
+ }
+
+ private Expression getLeftMostChild(Expression ex) {
+ if (ex.getOrderEv().size() > 0) {
+ return ex;
+ }
+ if (ex.getLeft() != null) {
+ return getLeftMostChild(ex.getLeft());
+ }
+ return null;
+ }
+
+
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateNode.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateNode.java
new file mode 100644
index 000000000..9e0ff311e
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateNode.java
@@ -0,0 +1,112 @@
+package de.cognicrypt.order.editor.statemachine;
+
+
+public class StateNode implements java.io.Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ private final String name;
+
+ private Boolean init = false;
+ private Boolean accepting = false;
+ private int hopsToAccepting = Integer.MAX_VALUE;
+
+ public StateNode(String _name) {
+ name = _name;
+ }
+
+ public StateNode(String _name, Boolean _init) {
+ this(_name);
+ init = _init;
+ }
+
+ public StateNode(String _name, Boolean _init, Boolean _accepting) {
+ this(_name, _init);
+ accepting = _accepting;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Boolean getInit() {
+ return init;
+ }
+
+ public Boolean getAccepting() {
+ return accepting;
+ }
+
+ public void setAccepting(Boolean _accepting) {
+ accepting = _accepting;
+ }
+
+ public String toString() {
+ StringBuilder nodeSB = new StringBuilder();
+ nodeSB.append("Name: ");
+ nodeSB.append(name);
+ nodeSB.append(" (");
+ if (!accepting) {
+ nodeSB.append(hopsToAccepting + "hops to ");
+ }
+ nodeSB.append("accepting)");
+ return nodeSB.toString();
+ }
+
+ public boolean isErrorState() {
+ return !accepting;
+ }
+
+ public boolean isInitialState() {
+ return init;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((accepting == null) ? 0 : accepting.hashCode());
+ result = prime * result + ((init == null) ? 0 : init.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ StateNode other = (StateNode) obj;
+ if (accepting == null) {
+ if (other.accepting != null)
+ return false;
+ } else if (!accepting.equals(other.accepting))
+ return false;
+ if (init == null) {
+ if (other.init != null)
+ return false;
+ } else if (!init.equals(other.init))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+ public void setHopsToAccepting(int hops) {
+ hopsToAccepting = hops;
+ }
+
+ public int getHopsToAccepting() {
+ return hopsToAccepting;
+ }
+
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateTransition.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateTransition.java
new file mode 100644
index 000000000..2630dfa58
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/StateTransition.java
@@ -0,0 +1,11 @@
+package de.cognicrypt.order.editor.statemachine;
+
+import java.util.List;
+
+import de.darmstadt.tu.crossing.crySL.Event;
+
+public interface StateTransition{
+ State from();
+ State to();
+ Event getLabel();
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/TransitionEdge.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/TransitionEdge.java
new file mode 100644
index 000000000..354092759
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/statemachine/TransitionEdge.java
@@ -0,0 +1,90 @@
+package de.cognicrypt.order.editor.statemachine;
+
+import java.util.List;
+
+import de.darmstadt.tu.crossing.crySL.Event;
+
+public class TransitionEdge implements StateTransition, java.io.Serializable {
+
+ private static final long serialVersionUID = 1L;
+ private StateNode left = null;
+ private StateNode right = null;
+ private Event method = null;
+
+ // see the implementation in CryptoAnalysis TransitionEdge
+ // may be it is required to keep it as in CryptoAnalysis.
+ public TransitionEdge(Event _method, StateNode _left, StateNode _right) {
+ left = _left;
+ right = _right;
+ method = _method;
+ }
+
+ public StateNode getLeft() {
+ return left;
+ }
+
+ public StateNode getRight() {
+ return right;
+ }
+
+ public Event getLabel() {
+ return method;
+ }
+
+ public String toString() {
+ StringBuilder edgeSB = new StringBuilder();
+ edgeSB.append("Left: ");
+ edgeSB.append(this.left.getName());
+ edgeSB.append(" ====");
+ edgeSB.append(method);
+ edgeSB.append("====> Right:");
+ edgeSB.append(this.right.getName());
+ return edgeSB.toString();
+ }
+
+ public StateNode from() {
+ return left;
+ }
+
+ public StateNode to() {
+ return right;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((method == null) ? 0 : method.hashCode());
+ result = prime * result + ((left == null) ? 0 : left.hashCode());
+ result = prime * result + ((right == null) ? 0 : right.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ TransitionEdge other = (TransitionEdge) obj;
+ if (method == null) {
+ if (other.method != null)
+ return false;
+ } else if (!method.equals(other.method))
+ return false;
+ if (left == null) {
+ if (other.left != null)
+ return false;
+ } else if (!left.equals(other.left))
+ return false;
+ if (right == null) {
+ if (other.right != null)
+ return false;
+ } else if (!right.equals(other.right))
+ return false;
+ return true;
+ }
+
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/validation/StatemachineValidator.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/validation/StatemachineValidator.java
new file mode 100644
index 000000000..bb828f593
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/validation/StatemachineValidator.java
@@ -0,0 +1,25 @@
+/*
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor.validation;
+
+
+/**
+ * This class contains custom validation rules.
+ *
+ * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#validation
+ */
+public class StatemachineValidator extends AbstractStatemachineValidator {
+
+// public static final String INVALID_NAME = "invalidName";
+//
+// @Check
+// public void checkGreetingStartsWithCapital(Greeting greeting) {
+// if (!Character.isUpperCase(greeting.getName().charAt(0))) {
+// warning("Name should start with a capital",
+// StatemachinePackage.Literals.GREETING__NAME,
+// INVALID_NAME);
+// }
+// }
+
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/wizard/OrderEditorWizard.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/wizard/OrderEditorWizard.java
new file mode 100644
index 000000000..536a98507
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/wizard/OrderEditorWizard.java
@@ -0,0 +1,32 @@
+/********************************************************************************
+ * Copyright (c) 2015-2019 TU Darmstadt, Paderborn University
+ *
+
+ * http://www.eclipse.org/legal/epl-2.0. SPDX-License-Identifier: EPL-2.0
+ ********************************************************************************/
+
+package de.cognicrypt.order.editor.wizard;
+
+import org.eclipse.jface.wizard.Wizard;
+import de.cognicrypt.core.Constants;
+
+public class OrderEditorWizard extends Wizard {
+
+ public OrderEditorWizard() {
+
+ }
+
+ @Override
+ public void addPages() {
+ addPage(new PageForOrderDiagramWizard(Constants.PAGE_NAME_FOR_MODE_OF_WIZARD, Constants.PAGE_TITLE_FOR_MODE_OF_WIZARD, Constants.PAGE_DESCRIPTION_FOR_MODE_OF_WIZARD));
+
+ //addPage(new PageForTaskIntegratorWizard(Constants.PAGE_NAME_FOR_LINK_ANSWERS, Constants.PAGE_TITLE_FOR_LINK_ANSWERS, Constants.PAGE_DESCIPTION_FOR_LINK_ANSWERS));
+
+ }
+
+ @Override
+ public boolean performFinish() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/wizard/OrderEditorWizardDialog.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/wizard/OrderEditorWizardDialog.java
new file mode 100644
index 000000000..9c9837904
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/wizard/OrderEditorWizardDialog.java
@@ -0,0 +1,33 @@
+/********************************************************************************
+ * Copyright (c) 2015-2019 TU Darmstadt, Paderborn University
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ ********************************************************************************/
+
+package de.cognicrypt.order.editor.wizard;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+
+public class OrderEditorWizardDialog extends WizardDialog {
+
+ public OrderEditorWizardDialog(final Shell parentShell, final IWizard newWizard) {
+ super(parentShell, newWizard);
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(final Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ final Button finishButton = getButton(IDialogConstants.FINISH_ID);
+ finishButton.setText("Generate");
+ }
+
+}
diff --git a/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/wizard/PageForOrderDiagramWizard.java b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/wizard/PageForOrderDiagramWizard.java
new file mode 100644
index 000000000..ff96659a7
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/src/de/cognicrypt/order/editor/wizard/PageForOrderDiagramWizard.java
@@ -0,0 +1,83 @@
+/********************************************************************************
+ * Copyright (c) 2015-2019 TU Darmstadt, Paderborn University
+ *
+
+ * http://www.eclipse.org/legal/epl-2.0. SPDX-License-Identifier: EPL-2.0
+ ********************************************************************************/
+
+/**
+ *
+ */
+package de.cognicrypt.order.editor.wizard;
+
+import java.util.List;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+import de.cognicrypt.order.editor.Constants;
+import de.cognicrypt.order.editor.config.CryslFile;
+import de.cognicrypt.order.editor.config.StaxParser;
+import de.cognicrypt.order.editor.config.StaxWriter;
+
+public class PageForOrderDiagramWizard extends WizardPage {
+
+ /**
+ * Create the wizard.
+ */
+ public PageForOrderDiagramWizard(final String name, final String title, final String description) {
+ super(name);
+ setTitle(title);
+ setDescription(description);
+ setPageComplete(false);
+ }
+
+ /**
+ * Create contents of the wizard.
+ *
+ * @param parent
+ */
+ @Override
+ public void createControl(final Composite parent) {
+ final Composite container = new Composite(parent, SWT.NONE);
+ setControl(container);
+
+ container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ container.setLayout(new GridLayout(2, false));
+
+ // needs to be replaced by file selection drop down menu later
+ final Button button = new Button(container, SWT.PUSH);
+ button.setText("Generate Statemachine Models");
+
+ button.addSelectionListener(new SelectionListener() {
+
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ StaxWriter configFile = new StaxWriter();
+
+ configFile.setFile("config" + Constants.XML_EXTENSION);
+ try {
+ configFile.saveConfig();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ StaxParser read = new StaxParser();
+ List readConfig = read.readConfig(configFile.getFile().getPath());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+ }
+}
diff --git a/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/.StatemachineGenerator.java._trace b/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/.StatemachineGenerator.java._trace
new file mode 100644
index 000000000..ee36e84c1
Binary files /dev/null and b/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/.StatemachineGenerator.java._trace differ
diff --git a/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/.StatemachineGenerator.xtendbin b/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/.StatemachineGenerator.xtendbin
new file mode 100644
index 000000000..4e3482dde
Binary files /dev/null and b/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/.StatemachineGenerator.xtendbin differ
diff --git a/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/.gitignore b/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/.gitignore
new file mode 100644
index 000000000..d68d8ef39
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/.gitignore
@@ -0,0 +1,3 @@
+/.StatemachineGenerator.java._trace
+/.StatemachineGenerator.xtendbin
+/StatemachineGenerator.java
diff --git a/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/StatemachineGenerator.java b/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/StatemachineGenerator.java
new file mode 100644
index 000000000..8e31ae68d
--- /dev/null
+++ b/plugins/de.cognicrypt.order.editor/xtend-gen/de/cognicrypt/order/editor/generator/StatemachineGenerator.java
@@ -0,0 +1,21 @@
+/**
+ * generated by Xtext 2.25.0
+ */
+package de.cognicrypt.order.editor.generator;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.xtext.generator.AbstractGenerator;
+import org.eclipse.xtext.generator.IFileSystemAccess2;
+import org.eclipse.xtext.generator.IGeneratorContext;
+
+/**
+ * Generates code from your model files on save.
+ *
+ * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation
+ */
+@SuppressWarnings("all")
+public class StatemachineGenerator extends AbstractGenerator {
+ @Override
+ public void doGenerate(final Resource resource, final IFileSystemAccess2 fsa, final IGeneratorContext context) {
+ }
+}
diff --git a/pom.xml b/pom.xml
index bcf0a5b92..f3a9562b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,6 +95,7 @@
plugins/de.cognicrypt.staticanalyzer/
plugins/de.cognicrypt.integrator.task/
plugins/de.cognicrypt.integrator.primitive/
+ plugins/de.cognicrypt.order.editor/
features/de.cognicrypt.core.feature/
features/de.cognicrypt.codegenerator.feature/
features/de.cognicrypt.cryslhandler.feature/