Pārlūkot izejas kodu

Changed Sgraph Model Validation to Xtext infrastructure

Andreas Mülder 13 gadi atpakaļ
vecāks
revīzija
97434974e3

+ 2 - 1
plugins/org.yakindu.sct.model.sgraph/META-INF/MANIFEST.MF

@@ -11,7 +11,8 @@ Export-Package: org.yakindu.sct.model.sgraph,
  org.yakindu.sct.model.sgraph.naming,
  org.yakindu.sct.model.sgraph.resource,
  org.yakindu.sct.model.sgraph.resource.provider,
- org.yakindu.sct.model.sgraph.util
+ org.yakindu.sct.model.sgraph.util,
+ org.yakindu.sct.model.sgraph.validation
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.emf.ecore;visibility:=reexport,
  org.eclipse.emf.ecore.xmi,

+ 4 - 29
plugins/org.yakindu.sct.model.sgraph/model/emf/sgraph.ecore

@@ -1,14 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0"
-    xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="sgraph"
-    nsURI="http://www.yakindu.org/sct/sgraph/2.0.0" nsPrefix="sgraph">
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="sgraph" nsURI="http://www.yakindu.org/sct/sgraph/2.0.0" nsPrefix="sgraph">
   <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"/>
   <eClassifiers xsi:type="ecore:EClass" name="Pseudostate" abstract="true" eSuperTypes="#//Vertex"/>
   <eClassifiers xsi:type="ecore:EClass" name="Vertex" abstract="true" eSuperTypes="../../../org.yakindu.base.types/model/base.ecore#//NamedElement">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="IncomingTransitionCount"/>
-    </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="parentRegion" ordered="false"
         lowerBound="1" eType="#//Region" eOpposite="#//Region/vertices"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="incomingTransitions" ordered="false"
@@ -17,9 +12,6 @@
         upperBound="-1" eType="#//Transition" containment="true" eOpposite="#//Transition/source"/>
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="Region" eSuperTypes="../../../org.yakindu.base.types/model/base.ecore#//NamedElement">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="ExactlyOneInitialState"/>
-    </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EReference" name="vertices" ordered="false"
         upperBound="-1" eType="#//Vertex" containment="true" eOpposite="#//Vertex/parentRegion"/>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
@@ -27,33 +19,20 @@
         eType="#//CompositeElement" eOpposite="#//CompositeElement/regions"/>
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="Transition" eSuperTypes="#//SpecificationElement #//Reaction">
-    <eAnnotations source="InjectMembers"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="target" ordered="false"
         lowerBound="1" eType="#//Vertex" eOpposite="#//Vertex/incomingTransitions"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="source" ordered="false"
         lowerBound="1" eType="#//Vertex" eOpposite="#//Vertex/outgoingTransitions"/>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
   </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="FinalState" eSuperTypes="#//RegularState">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="OutgoingTransitionCount"/>
-    </eAnnotations>
-  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="FinalState" eSuperTypes="#//RegularState"/>
   <eClassifiers xsi:type="ecore:EClass" name="Variable" abstract="true" eSuperTypes="#//Declaration"/>
   <eClassifiers xsi:type="ecore:EClass" name="Event" abstract="true" eSuperTypes="#//Declaration"/>
   <eClassifiers xsi:type="ecore:EClass" name="Choice" eSuperTypes="#//Pseudostate">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="OutgoingTransitionCount"/>
-    </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//ChoiceKind"/>
   </eClassifiers>
-  <eClassifiers xsi:type="ecore:EClass" name="Statechart" eSuperTypes="#//SpecificationElement #//ReactiveElement #//ScopedElement #//CompositeElement ../../../org.yakindu.base.types/model/base.ecore#//NamedElement">
-    <eAnnotations source="InjectMembers"/>
-  </eClassifiers>
+  <eClassifiers xsi:type="ecore:EClass" name="Statechart" eSuperTypes="#//SpecificationElement #//ReactiveElement #//ScopedElement #//CompositeElement ../../../org.yakindu.base.types/model/base.ecore#//NamedElement"/>
   <eClassifiers xsi:type="ecore:EClass" name="Entry" eSuperTypes="#//Pseudostate">
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="DisallowTrigger OutgoingTransitionCount"/>
-    </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" eType="#//EntryKind"/>
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="Trigger" abstract="true"/>
@@ -96,10 +75,6 @@
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EClass" name="Synchronization" eSuperTypes="#//Pseudostate"/>
   <eClassifiers xsi:type="ecore:EClass" name="State" eSuperTypes="#//SpecificationElement #//ReactiveElement #//ScopedElement #//RegularState #//CompositeElement">
-    <eAnnotations source="InjectMembers"/>
-    <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
-      <details key="constraints" value="NameIsNotEmpty"/>
-    </eAnnotations>
     <eStructuralFeatures xsi:type="ecore:EAttribute" name="orthogonal" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
         changeable="false" volatile="true" transient="true" derived="true"/>
     <eStructuralFeatures xsi:type="ecore:EReference" name="substatechart" eType="#//Statechart"

+ 1 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/Choice.java

@@ -24,7 +24,7 @@ package org.yakindu.sct.model.sgraph;
  * </p>
  *
  * @see org.yakindu.sct.model.sgraph.SGraphPackage#getChoice()
- * @model annotation="http://www.eclipse.org/emf/2002/Ecore constraints='OutgoingTransitionCount'"
+ * @model
  * @generated
  */
 public interface Choice extends Pseudostate {

+ 1 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/Entry.java

@@ -24,7 +24,7 @@ package org.yakindu.sct.model.sgraph;
  * </p>
  *
  * @see org.yakindu.sct.model.sgraph.SGraphPackage#getEntry()
- * @model annotation="http://www.eclipse.org/emf/2002/Ecore constraints='DisallowTrigger OutgoingTransitionCount'"
+ * @model
  * @generated
  */
 public interface Entry extends Pseudostate {

+ 1 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/FinalState.java

@@ -19,7 +19,7 @@ package org.yakindu.sct.model.sgraph;
  *
  *
  * @see org.yakindu.sct.model.sgraph.SGraphPackage#getFinalState()
- * @model annotation="http://www.eclipse.org/emf/2002/Ecore constraints='OutgoingTransitionCount'"
+ * @model
  * @generated
  */
 public interface FinalState extends RegularState {

+ 1 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/Region.java

@@ -28,7 +28,7 @@ import org.yakindu.base.base.NamedElement;
  * </p>
  *
  * @see org.yakindu.sct.model.sgraph.SGraphPackage#getRegion()
- * @model annotation="http://www.eclipse.org/emf/2002/Ecore constraints='ExactlyOneInitialState'"
+ * @model
  * @generated
  */
 public interface Region extends NamedElement {

+ 1 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/State.java

@@ -30,7 +30,7 @@ package org.yakindu.sct.model.sgraph;
  * </p>
  *
  * @see org.yakindu.sct.model.sgraph.SGraphPackage#getState()
- * @model annotation="http://www.eclipse.org/emf/2002/Ecore constraints='NameIsNotEmpty'"
+ * @model
  * @generated
  */
 public interface State extends SpecificationElement, ReactiveElement, ScopedElement, RegularState, CompositeElement {

+ 0 - 1
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/Vertex.java

@@ -29,7 +29,6 @@ import org.yakindu.base.base.NamedElement;
  *
  * @see org.yakindu.sct.model.sgraph.SGraphPackage#getVertex()
  * @model abstract="true"
- *        annotation="http://www.eclipse.org/emf/2002/Ecore constraints='IncomingTransitionCount'"
  * @generated
  */
 public interface Vertex extends NamedElement {

+ 0 - 88
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/impl/SGraphPackageImpl.java

@@ -15,7 +15,6 @@ import org.eclipse.emf.ecore.EClass;
 import org.eclipse.emf.ecore.EEnum;
 import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EValidator;
 import org.eclipse.emf.ecore.impl.EPackageImpl;
 import org.yakindu.base.base.BasePackage;
 import org.yakindu.sct.model.sgraph.Choice;
@@ -46,7 +45,6 @@ import org.yakindu.sct.model.sgraph.Transition;
 import org.yakindu.sct.model.sgraph.Trigger;
 import org.yakindu.sct.model.sgraph.Variable;
 import org.yakindu.sct.model.sgraph.Vertex;
-import org.yakindu.sct.model.sgraph.util.SGraphValidator;
 
 /**
  * <!-- begin-user-doc -->
@@ -299,15 +297,6 @@ public class SGraphPackageImpl extends EPackageImpl implements SGraphPackage {
 		// Initialize created meta-data
 		theSGraphPackage.initializePackageContents();
 
-		// Register package validator
-		EValidator.Registry.INSTANCE.put
-			(theSGraphPackage, 
-			 new EValidator.Descriptor() {
-				 public EValidator getEValidator() {
-					 return SGraphValidator.INSTANCE;
-				 }
-			 });
-
 		// Mark meta-data to indicate it can't be changed
 		theSGraphPackage.freeze();
 
@@ -1068,83 +1057,6 @@ public class SGraphPackageImpl extends EPackageImpl implements SGraphPackage {
 
 		// Create resource
 		createResource(eNS_URI);
-
-		// Create annotations
-		// http://www.eclipse.org/emf/2002/Ecore
-		createEcoreAnnotations();
-		// InjectMembers
-		createInjectMembersAnnotations();
-	}
-
-	/**
-	 * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/Ecore</b>.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	protected void createEcoreAnnotations() {
-		String source = "http://www.eclipse.org/emf/2002/Ecore";			
-		addAnnotation
-		  (vertexEClass, 
-		   source, 
-		   new String[] {
-			 "constraints", "IncomingTransitionCount"
-		   });		
-		addAnnotation
-		  (regionEClass, 
-		   source, 
-		   new String[] {
-			 "constraints", "ExactlyOneInitialState"
-		   });			
-		addAnnotation
-		  (finalStateEClass, 
-		   source, 
-		   new String[] {
-			 "constraints", "OutgoingTransitionCount"
-		   });		
-		addAnnotation
-		  (choiceEClass, 
-		   source, 
-		   new String[] {
-			 "constraints", "OutgoingTransitionCount"
-		   });			
-		addAnnotation
-		  (entryEClass, 
-		   source, 
-		   new String[] {
-			 "constraints", "DisallowTrigger OutgoingTransitionCount"
-		   });			
-		addAnnotation
-		  (stateEClass, 
-		   source, 
-		   new String[] {
-			 "constraints", "NameIsNotEmpty"
-		   });
-	}
-
-	/**
-	 * Initializes the annotations for <b>InjectMembers</b>.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * @generated
-	 */
-	protected void createInjectMembersAnnotations() {
-		String source = "InjectMembers";					
-		addAnnotation
-		  (transitionEClass, 
-		   source, 
-		   new String[] {
-		   });				
-		addAnnotation
-		  (statechartEClass, 
-		   source, 
-		   new String[] {
-		   });			
-		addAnnotation
-		  (stateEClass, 
-		   source, 
-		   new String[] {
-		   });	
 	}
 
 } //SGraphPackageImpl

+ 0 - 935
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/util/SGraphValidator.java

@@ -1,935 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.model.sgraph.util;
-
-import java.util.Map;
-
-import org.eclipse.emf.common.util.BasicDiagnostic;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.common.util.DiagnosticChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.ResourceLocator;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.util.EObjectValidator;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.yakindu.sct.model.sgraph.Choice;
-import org.yakindu.sct.model.sgraph.ChoiceKind;
-import org.yakindu.sct.model.sgraph.CompositeElement;
-import org.yakindu.sct.model.sgraph.Declaration;
-import org.yakindu.sct.model.sgraph.Effect;
-import org.yakindu.sct.model.sgraph.Entry;
-import org.yakindu.sct.model.sgraph.EntryKind;
-import org.yakindu.sct.model.sgraph.Event;
-import org.yakindu.sct.model.sgraph.Exit;
-import org.yakindu.sct.model.sgraph.FinalState;
-import org.yakindu.sct.model.sgraph.Pseudostate;
-import org.yakindu.sct.model.sgraph.Reaction;
-import org.yakindu.sct.model.sgraph.ReactiveElement;
-import org.yakindu.sct.model.sgraph.Region;
-import org.yakindu.sct.model.sgraph.RegularState;
-import org.yakindu.sct.model.sgraph.SGraphPackage;
-import org.yakindu.sct.model.sgraph.Scope;
-import org.yakindu.sct.model.sgraph.ScopedElement;
-import org.yakindu.sct.model.sgraph.SpecificationElement;
-import org.yakindu.sct.model.sgraph.State;
-import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.model.sgraph.Statement;
-import org.yakindu.sct.model.sgraph.Synchronization;
-import org.yakindu.sct.model.sgraph.Transition;
-import org.yakindu.sct.model.sgraph.Trigger;
-import org.yakindu.sct.model.sgraph.Variable;
-import org.yakindu.sct.model.sgraph.Vertex;
-
-/**
- * <!-- begin-user-doc --> The <b>Validator</b> for the model. <!-- end-user-doc
- * -->
- * 
- * @see org.yakindu.sct.model.sgraph.SGraphPackage
- * @generated
- */
-public class SGraphValidator extends EObjectValidator {
-
-	public static final String ISSUE_STATE_WITHOUT_NAME = "A state must have a name.";
-	public static final String ISSUE_NODE_NOT_REACHABLE = "Node is not reachable due to missing incoming transition.";
-	public static final String ISSUE_FINAL_STATE_OUTGOING_TRANSITION = "A final state should have no outgoing transition.";
-	public static final String ISSUE_STATE_WITHOUT_OUTGOING_TRANSITION = "A state should have at least one outgoing transition.";
-	public static final String ISSUE_INITIAL_ENTRY_WITH_IN_TRANS = "Initial entry should have no incoming transition.";
-	public static final String ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS = "Initial entry should have a single outgoing transition";
-	public final static String ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS = "Entries must not have more than one outgoing transition";
-	public static final String ISSUE_SUBMACHINESTATE_WITHOUT_SUBMACHINE = "Selected Submachine can not be resolved.";
-	public static final String ISSUE_SUBMACHINESTATE__CYCLE = "A submachine state can not contain itself as as Submachine.";
-	public static final String ISSUE_ENTRY_WITH_TRIGGER = "Outgoing Transitions from Entries can not have a Trigger or Guard.";
-	public static final String ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION = "A choice must have at least one outgoing transition.";
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public static final String copyright = "Copyright (c) 2011 committers of YAKINDU and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\nContributors:\r\ncommitters of YAKINDU - initial API and implementation\r\n";
-
-	/**
-	 * The cached model package <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public static final SGraphValidator INSTANCE = new SGraphValidator();
-
-	/**
-	 * A constant for the
-	 * {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of
-	 * diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes}
-	 * from this package. <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @see org.eclipse.emf.common.util.Diagnostic#getSource()
-	 * @see org.eclipse.emf.common.util.Diagnostic#getCode()
-	 * @generated
-	 */
-	public static final String DIAGNOSTIC_SOURCE = "org.yakindu.sct.model.sgraph";
-
-	/**
-	 * A constant with a fixed name that can be used as the base value for
-	 * additional hand written constants. <!-- begin-user-doc --> <!--
-	 * end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0;
-
-	/**
-	 * A constant with a fixed name that can be used as the base value for
-	 * additional hand written constants in a derived class. <!-- begin-user-doc
-	 * --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;
-
-	/**
-	 * Creates an instance of the switch. <!-- begin-user-doc --> <!--
-	 * end-user-doc -->
-	 * 
-	 * @generated NOT
-	 */
-	public SGraphValidator() {
-		super();
-	}
-
-	/**
-	 * Returns the package of this validator switch. <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	@Override
-	protected EPackage getEPackage() {
-		return SGraphPackage.eINSTANCE;
-	}
-
-	/**
-	 * Calls <code>validateXXX</code> for the corresponding classifier of the
-	 * model. <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	@Override
-	protected boolean validate(int classifierID, Object value,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		switch (classifierID) {
-		case SGraphPackage.PSEUDOSTATE:
-			return validatePseudostate((Pseudostate) value, diagnostics,
-					context);
-		case SGraphPackage.VERTEX:
-			return validateVertex((Vertex) value, diagnostics, context);
-		case SGraphPackage.REGION:
-			return validateRegion((Region) value, diagnostics, context);
-		case SGraphPackage.TRANSITION:
-			return validateTransition((Transition) value, diagnostics, context);
-		case SGraphPackage.FINAL_STATE:
-			return validateFinalState((FinalState) value, diagnostics, context);
-		case SGraphPackage.VARIABLE:
-			return validateVariable((Variable) value, diagnostics, context);
-		case SGraphPackage.EVENT:
-			return validateEvent((Event) value, diagnostics, context);
-		case SGraphPackage.CHOICE:
-			return validateChoice((Choice) value, diagnostics, context);
-		case SGraphPackage.STATECHART:
-			return validateStatechart((Statechart) value, diagnostics, context);
-		case SGraphPackage.ENTRY:
-			return validateEntry((Entry) value, diagnostics, context);
-		case SGraphPackage.TRIGGER:
-			return validateTrigger((Trigger) value, diagnostics, context);
-		case SGraphPackage.EFFECT:
-			return validateEffect((Effect) value, diagnostics, context);
-		case SGraphPackage.SPECIFICATION_ELEMENT:
-			return validateSpecificationElement((SpecificationElement) value,
-					diagnostics, context);
-		case SGraphPackage.DECLARATION:
-			return validateDeclaration((Declaration) value, diagnostics,
-					context);
-		case SGraphPackage.REACTION:
-			return validateReaction((Reaction) value, diagnostics, context);
-		case SGraphPackage.REACTIVE_ELEMENT:
-			return validateReactiveElement((ReactiveElement) value,
-					diagnostics, context);
-		case SGraphPackage.EXIT:
-			return validateExit((Exit) value, diagnostics, context);
-		case SGraphPackage.SCOPE:
-			return validateScope((Scope) value, diagnostics, context);
-		case SGraphPackage.SCOPED_ELEMENT:
-			return validateScopedElement((ScopedElement) value, diagnostics,
-					context);
-		case SGraphPackage.SYNCHRONIZATION:
-			return validateSynchronization((Synchronization) value,
-					diagnostics, context);
-		case SGraphPackage.STATE:
-			return validateState((State) value, diagnostics, context);
-		case SGraphPackage.STATEMENT:
-			return validateStatement((Statement) value, diagnostics, context);
-		case SGraphPackage.REGULAR_STATE:
-			return validateRegularState((RegularState) value, diagnostics,
-					context);
-		case SGraphPackage.COMPOSITE_ELEMENT:
-			return validateCompositeElement((CompositeElement) value,
-					diagnostics, context);
-		case SGraphPackage.ENTRY_KIND:
-			return validateEntryKind((EntryKind) value, diagnostics, context);
-		case SGraphPackage.CHOICE_KIND:
-			return validateChoiceKind((ChoiceKind) value, diagnostics, context);
-		default:
-			return true;
-		}
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validatePseudostate(Pseudostate pseudostate,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		if (!validate_NoCircularContainment(pseudostate, diagnostics, context))
-			return false;
-		boolean result = validate_EveryMultiplicityConforms(pseudostate,
-				diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryDataValueConforms(pseudostate, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryReferenceIsContained(pseudostate,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryBidirectionalReferenceIsPaired(pseudostate,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryProxyResolves(pseudostate, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_UniqueID(pseudostate, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryKeyUnique(pseudostate, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryMapEntryUnique(pseudostate, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validateVertex_IncomingTransitionCount(pseudostate,
-					diagnostics, context);
-		return result;
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateVertex(Vertex vertex, DiagnosticChain diagnostics,
-			Map<Object, Object> context) {
-		if (!validate_NoCircularContainment(vertex, diagnostics, context))
-			return false;
-		boolean result = validate_EveryMultiplicityConforms(vertex,
-				diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryDataValueConforms(vertex, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryReferenceIsContained(vertex, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryBidirectionalReferenceIsPaired(vertex,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryProxyResolves(vertex, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_UniqueID(vertex, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryKeyUnique(vertex, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryMapEntryUnique(vertex, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_IncomingTransitionCount(vertex,
-					diagnostics, context);
-		return result;
-	}
-
-	/**
-	 * Validates the IncomingTransitionCount constraint of '<em>Vertex</em>'.
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated NOT
-	 */
-	public boolean validateVertex_IncomingTransitionCount(Vertex vertex,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		if (vertex instanceof State) {
-			if (vertex.getIncomingTransitions().size() > 0) {
-				return true;
-			}
-			TreeIterator<EObject> eAllContents = vertex.eAllContents();
-			while (eAllContents.hasNext()) {
-				EObject next = eAllContents.next();
-				if (next instanceof State) {
-					EList<Transition> incomingTransitions = ((State) next)
-							.getIncomingTransitions();
-					for (Transition transition : incomingTransitions) {
-						if (!EcoreUtil.isAncestor(vertex,
-								transition.getSource())) {
-							return true;
-						}
-					}
-				}
-			}
-			return error(vertex, diagnostics, ISSUE_NODE_NOT_REACHABLE);
-		} else if (vertex.getIncomingTransitions().size() == 0
-				&& !(vertex instanceof Entry)) {
-			return error(vertex, diagnostics, ISSUE_NODE_NOT_REACHABLE);
-		}
-		if (vertex.getIncomingTransitions().size() > 0
-				&& vertex instanceof Entry
-				&& ((Entry) vertex).getKind().equals(EntryKind.INITIAL)) {
-			return warning(vertex, diagnostics,
-					ISSUE_INITIAL_ENTRY_WITH_IN_TRANS);
-		}
-
-		return true;
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateRegion(Region region, DiagnosticChain diagnostics,
-			Map<Object, Object> context) {
-		if (!validate_NoCircularContainment(region, diagnostics, context))
-			return false;
-		boolean result = validate_EveryMultiplicityConforms(region,
-				diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryDataValueConforms(region, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryReferenceIsContained(region, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryBidirectionalReferenceIsPaired(region,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryProxyResolves(region, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_UniqueID(region, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryKeyUnique(region, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryMapEntryUnique(region, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateRegion_ExactlyOneInitialState(region,
-					diagnostics, context);
-		return result;
-	}
-
-	/**
-	 * Validates the ExactlyOneInitialState constraint of '<em>Region</em>'.
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated NOT
-	 */
-	public boolean validateRegion_ExactlyOneInitialState(Region region,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return true;
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateTransition(Transition transition,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(transition, diagnostics, context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateFinalState(FinalState finalState,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		if (!validate_NoCircularContainment(finalState, diagnostics, context))
-			return false;
-		boolean result = validate_EveryMultiplicityConforms(finalState,
-				diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryDataValueConforms(finalState, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryReferenceIsContained(finalState,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryBidirectionalReferenceIsPaired(finalState,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryProxyResolves(finalState, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_UniqueID(finalState, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryKeyUnique(finalState, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryMapEntryUnique(finalState, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validateVertex_IncomingTransitionCount(finalState,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateFinalState_OutgoingTransitionCount(finalState,
-					diagnostics, context);
-		return result;
-	}
-
-	/**
-	 * Validates the OutgoingTransitionCount constraint of '<em>Final State</em>
-	 * '. <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated NOT
-	 */
-	public boolean validateFinalState_OutgoingTransitionCount(
-			FinalState finalState, DiagnosticChain diagnostics,
-			Map<Object, Object> context) {
-		if ((finalState.getOutgoingTransitions().size() > 0)) {
-			return warning(finalState, diagnostics,
-					ISSUE_FINAL_STATE_OUTGOING_TRANSITION);
-		}
-		return true;
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateState(State state, DiagnosticChain diagnostics,
-			Map<Object, Object> context) {
-		if (!validate_NoCircularContainment(state, diagnostics, context))
-			return false;
-		boolean result = validate_EveryMultiplicityConforms(state, diagnostics,
-				context);
-		if (result || diagnostics != null)
-			result &= validate_EveryDataValueConforms(state, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryReferenceIsContained(state, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryBidirectionalReferenceIsPaired(state,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryProxyResolves(state, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_UniqueID(state, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryKeyUnique(state, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryMapEntryUnique(state, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_IncomingTransitionCount(state,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateState_NameIsNotEmpty(state, diagnostics, context);
-		return result;
-	}
-
-	/**
-	 * Validates the NameIsNotEmpty constraint of '<em>State</em>'. <!--
-	 * begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated NOT
-	 */
-	public boolean validateState_NameIsNotEmpty(State state,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		if ((state.getName() == null || state.getName().trim().length() == 0)
-				&& !(state instanceof FinalState)) {
-			return error(state, diagnostics, ISSUE_STATE_WITHOUT_NAME);
-		}
-		return true;
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateStatement(Statement statement,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(statement, diagnostics, context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateRegularState(RegularState regularState,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		if (!validate_NoCircularContainment(regularState, diagnostics, context))
-			return false;
-		boolean result = validate_EveryMultiplicityConforms(regularState,
-				diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryDataValueConforms(regularState,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryReferenceIsContained(regularState,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryBidirectionalReferenceIsPaired(
-					regularState, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryProxyResolves(regularState, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_UniqueID(regularState, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryKeyUnique(regularState, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryMapEntryUnique(regularState, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validateVertex_IncomingTransitionCount(regularState,
-					diagnostics, context);
-		return result;
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateCompositeElement(CompositeElement compositeElement,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(compositeElement, diagnostics,
-				context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateVariable(Variable variable,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(variable, diagnostics, context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateEvent(Event event, DiagnosticChain diagnostics,
-			Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(event, diagnostics, context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateChoice(Choice choice, DiagnosticChain diagnostics,
-			Map<Object, Object> context) {
-		if (!validate_NoCircularContainment(choice, diagnostics, context))
-			return false;
-		boolean result = validate_EveryMultiplicityConforms(choice,
-				diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryDataValueConforms(choice, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryReferenceIsContained(choice, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryBidirectionalReferenceIsPaired(choice,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryProxyResolves(choice, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_UniqueID(choice, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryKeyUnique(choice, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryMapEntryUnique(choice, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_IncomingTransitionCount(choice,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateChoice_OutgoingTransitionCount(choice,
-					diagnostics, context);
-		return result;
-	}
-
-	/**
-	 * Validates the OutgoingTransitionCount constraint of '<em>Choice</em>'.
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated NOT
-	 */
-	public boolean validateChoice_OutgoingTransitionCount(Choice choice,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		// Choice without outgoing transition
-		if (choice.getOutgoingTransitions().size() == 0) {
-			return error(choice, diagnostics,
-					ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION);
-		}
-		return true;
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateStatechart(Statechart statechart,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(statechart, diagnostics, context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateEntry(Entry entry, DiagnosticChain diagnostics,
-			Map<Object, Object> context) {
-		if (!validate_NoCircularContainment(entry, diagnostics, context))
-			return false;
-		boolean result = validate_EveryMultiplicityConforms(entry, diagnostics,
-				context);
-		if (result || diagnostics != null)
-			result &= validate_EveryDataValueConforms(entry, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryReferenceIsContained(entry, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryBidirectionalReferenceIsPaired(entry,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryProxyResolves(entry, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_UniqueID(entry, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryKeyUnique(entry, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryMapEntryUnique(entry, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_IncomingTransitionCount(entry,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateEntry_DisallowTrigger(entry, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateEntry_OutgoingTransitionCount(entry, diagnostics,
-					context);
-		return result;
-	}
-
-	/**
-	 * Validates the DisallowTrigger constraint of '<em>Entry</em>'. <!--
-	 * begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated NOT
-	 */
-	public boolean validateEntry_DisallowTrigger(Entry entry,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-
-		for (Transition transition : entry.getOutgoingTransitions()) {
-			if (transition.getTrigger() != null) {
-				if (diagnostics != null) {
-					diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR,
-							DIAGNOSTIC_SOURCE, 0, ISSUE_ENTRY_WITH_TRIGGER,
-							new Object[] { transition }));
-				}
-				return false;
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Validates the OutgoingTransitionCount constraint of '<em>Entry</em>'.
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated NOT
-	 */
-	public boolean validateEntry_OutgoingTransitionCount(Entry entry,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		if (entry.getOutgoingTransitions().size() == 0
-				&& ((Entry) entry).getKind().equals(EntryKind.INITIAL)) {
-			return warning(entry, diagnostics,
-					ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS);
-		}
-		if (entry.getOutgoingTransitions().size() > 1) {
-			return error(entry, diagnostics,
-					ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS);
-		}
-		return true;
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateTrigger(Trigger trigger,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(trigger, diagnostics, context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateEffect(Effect effect, DiagnosticChain diagnostics,
-			Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(effect, diagnostics, context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateSpecificationElement(
-			SpecificationElement specificationElement,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(specificationElement,
-				diagnostics, context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateDeclaration(Declaration declaration,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(declaration, diagnostics,
-				context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateReaction(Reaction reaction,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(reaction, diagnostics, context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateReactiveElement(ReactiveElement reactiveElement,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(reactiveElement, diagnostics,
-				context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateExit(Exit exit, DiagnosticChain diagnostics,
-			Map<Object, Object> context) {
-		if (!validate_NoCircularContainment(exit, diagnostics, context))
-			return false;
-		boolean result = validate_EveryMultiplicityConforms(exit, diagnostics,
-				context);
-		if (result || diagnostics != null)
-			result &= validate_EveryDataValueConforms(exit, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryReferenceIsContained(exit, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryBidirectionalReferenceIsPaired(exit,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryProxyResolves(exit, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_UniqueID(exit, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryKeyUnique(exit, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryMapEntryUnique(exit, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_IncomingTransitionCount(exit, diagnostics,
-					context);
-		return result;
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateScope(Scope scope, DiagnosticChain diagnostics,
-			Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(scope, diagnostics, context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateScopedElement(ScopedElement scopedElement,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return validate_EveryDefaultConstraint(scopedElement, diagnostics,
-				context);
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateSynchronization(Synchronization synchronization,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		if (!validate_NoCircularContainment(synchronization, diagnostics,
-				context))
-			return false;
-		boolean result = validate_EveryMultiplicityConforms(synchronization,
-				diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryDataValueConforms(synchronization,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryReferenceIsContained(synchronization,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryBidirectionalReferenceIsPaired(
-					synchronization, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryProxyResolves(synchronization, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_UniqueID(synchronization, diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validate_EveryKeyUnique(synchronization, diagnostics,
-					context);
-		if (result || diagnostics != null)
-			result &= validate_EveryMapEntryUnique(synchronization,
-					diagnostics, context);
-		if (result || diagnostics != null)
-			result &= validateVertex_IncomingTransitionCount(synchronization,
-					diagnostics, context);
-		return result;
-	}
-
-	/**
-	 * Validates the SubStatechartExists constraint of '
-	 * <em>Submachine State</em>'. <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated NOT
-	 */
-	// public boolean validateSubmachineState_SubStatechartExists(
-	// State submachineState, DiagnosticChain diagnostics,
-	// Map<Object, Object> context) {
-	// if ((submachineState.getSubstatechart() == null || submachineState
-	// .getSubstatechart().eIsProxy())) {
-	// return error(submachineState, diagnostics,
-	// ISSUE_SUBMACHINESTATE_WITHOUT_SUBMACHINE);
-	// }
-	// return true;
-	//
-	// }
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateEntryKind(EntryKind entryKind,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return true;
-	}
-
-	/**
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	public boolean validateChoiceKind(ChoiceKind choiceKind,
-			DiagnosticChain diagnostics, Map<Object, Object> context) {
-		return true;
-	}
-
-	/**
-	 * Returns the resource locator that will be used to fetch messages for this
-	 * validator's diagnostics. <!-- begin-user-doc --> <!-- end-user-doc -->
-	 * 
-	 * @generated
-	 */
-	@Override
-	public ResourceLocator getResourceLocator() {
-		// TODO
-		// Specialize this to return a resource locator for messages specific to
-		// this validator.
-		// Ensure that you remove @generated or mark it @generated NOT
-		return super.getResourceLocator();
-	}
-
-	protected boolean warning(Vertex vertex, DiagnosticChain diagnostics,
-			String message) {
-		if (diagnostics != null) {
-			diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING,
-					DIAGNOSTIC_SOURCE, 0, message, new Object[] { vertex }));
-		}
-		return false;
-	}
-
-	protected boolean error(Vertex vertex, DiagnosticChain diagnostics,
-			String message) {
-		if (diagnostics != null) {
-			diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR,
-					DIAGNOSTIC_SOURCE, 0, message, new Object[] { vertex }));
-		}
-		return false;
-	}
-
-} // StatechartValidator

+ 75 - 0
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/validation/SCTResourceValidator.java

@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2012 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.model.sgraph.validation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
+import org.eclipse.xtext.validation.AbstractDeclarativeValidator;
+import org.eclipse.xtext.validation.Check;
+import org.eclipse.xtext.validation.CheckType;
+import org.yakindu.sct.model.sgraph.SpecificationElement;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.model.sgraph.resource.AbstractSCTResource;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class SCTResourceValidator extends AbstractDeclarativeValidator {
+
+	@Check(CheckType.FAST)
+	public void checkUnresolvableProxies(Statechart sc) {
+		AbstractSCTResource resource = (AbstractSCTResource) sc.eResource();
+		for (Map.Entry<SpecificationElement, Collection<Diagnostic>> entry : resource
+				.getLinkingDiagnostics().asMap().entrySet()) {
+			for (Diagnostic diag : entry.getValue()) {
+				error(diag.getMessage(), entry.getKey(), null, -1);
+			}
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void checkSyntaxErrors(Statechart sc) {
+		AbstractSCTResource resource = (AbstractSCTResource) sc.eResource();
+		for (Map.Entry<SpecificationElement, Collection<Diagnostic>> entry : resource
+				.getSyntaxDiagnostics().asMap().entrySet()) {
+			for (Diagnostic diag : entry.getValue()) {
+				error(diag.getMessage(), entry.getKey(), null, -1);
+			}
+		}
+	}
+
+	@Override
+	protected List<EPackage> getEPackages() {
+		List<EPackage> result = new ArrayList<EPackage>();
+		result.add(EPackage.Registry.INSTANCE
+				.getEPackage("http://www.yakindu.org/sct/sgraph/2.0.0"));
+		return result;
+	}
+
+	@Override
+	public boolean isLanguageSpecific() {
+		return false;
+	}
+
+	@Override
+	protected boolean isResponsible(Map<Object, Object> context, EObject eObject) {
+		return true;
+	}
+
+}

+ 149 - 0
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/validation/SGraphJavaValidator.java

@@ -0,0 +1,149 @@
+/**
+ * Copyright (c) 2012 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.model.sgraph.validation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.xtext.validation.AbstractDeclarativeValidator;
+import org.eclipse.xtext.validation.Check;
+import org.eclipse.xtext.validation.CheckType;
+import org.yakindu.sct.model.sgraph.Choice;
+import org.yakindu.sct.model.sgraph.Entry;
+import org.yakindu.sct.model.sgraph.EntryKind;
+import org.yakindu.sct.model.sgraph.FinalState;
+import org.yakindu.sct.model.sgraph.Transition;
+import org.yakindu.sct.model.sgraph.Vertex;
+
+/**
+ * 
+ * @author terfloth
+ * @author muelder
+ * @author bohl - migrated to xtext infrastruture
+ */
+
+public class SGraphJavaValidator extends AbstractDeclarativeValidator {
+
+	public static final String ISSUE_STATE_WITHOUT_NAME = "A state must have a name.";
+	public static final String ISSUE_NODE_NOT_REACHABLE = "Node is not reachable due to missing incoming transition.";
+	public static final String ISSUE_FINAL_STATE_OUTGOING_TRANSITION = "A final state should have no outgoing transition.";
+	public static final String ISSUE_STATE_WITHOUT_OUTGOING_TRANSITION = "A state should have at least one outgoing transition.";
+	public static final String ISSUE_INITIAL_ENTRY_WITH_IN_TRANS = "Initial entry should have no incoming transition.";
+	public static final String ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS = "Initial entry should have a single outgoing transition";
+	public static final String ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS = "Entries must not have more than one outgoing transition";
+	public static final String ISSUE_ENTRY_WITH_TRIGGER = "Outgoing Transitions from Entries can not have a Trigger or Guard.";
+	public static final String ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION = "A choice must have at least one outgoing transition.";
+
+	@Check(CheckType.FAST)
+	public void vertextNotReachable(Vertex vertex) {
+		if (vertex instanceof State) {
+			TreeIterator<EObject> eAllContents = vertex.eAllContents();
+			while (eAllContents.hasNext()) {
+				EObject next = eAllContents.next();
+				if (next instanceof State) {
+					EList<Transition> incomingTransitions = ((org.yakindu.sct.model.sgraph.State) next) // State
+							.getIncomingTransitions();
+					for (Transition transition : incomingTransitions) {
+						if (EcoreUtil
+								.isAncestor(vertex, transition.getSource())) {
+							error(ISSUE_NODE_NOT_REACHABLE, vertex, null, -1);
+						}
+					}
+				}
+			}
+
+		} else if (vertex.getIncomingTransitions().size() == 0
+				&& !(vertex instanceof Entry)) {
+			error(ISSUE_NODE_NOT_REACHABLE, vertex, null, -1);
+		}
+
+	}
+
+	@Check(CheckType.FAST)
+	public void incomingTransitionCount(Vertex vertex) {
+		if (vertex.getIncomingTransitions().size() > 0
+				&& vertex instanceof Entry
+				&& ((Entry) vertex).getKind().equals(EntryKind.INITIAL)) {
+			warning(ISSUE_INITIAL_ENTRY_WITH_IN_TRANS, vertex, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void outgoingTransitionCount(FinalState finalState) {
+		if ((finalState.getOutgoingTransitions().size() > 0)) {
+			warning(ISSUE_FINAL_STATE_OUTGOING_TRANSITION, finalState, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void nameIsNotEmpty(org.yakindu.sct.model.sgraph.State state) {
+		if ((state.getName() == null || state.getName().trim().length() == 0)
+				&& !(state instanceof FinalState)) {
+			error(ISSUE_STATE_WITHOUT_NAME, state, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void outgoingTransitionCount(Choice choice) {
+		// Choice without outgoing transition
+		if (choice.getOutgoingTransitions().size() == 0) {
+			error(ISSUE_CHOICE_WITHOUT_OUTGOING_TRANSITION, choice, null, -1);
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void disallowTrigger(Entry entry) {
+		for (Transition transition : entry.getOutgoingTransitions()) {
+			if (transition.getTrigger() != null) {
+				error(ISSUE_ENTRY_WITH_TRIGGER, entry, null, -1);
+			}
+		}
+	}
+
+	@Check(CheckType.FAST)
+	public void outgoingTransitionCount(Entry entry) {
+		if (entry.getOutgoingTransitions().size() == 0
+				&& ((Entry) entry).getKind().equals(EntryKind.INITIAL)) {
+			warning(ISSUE_INITIAL_ENTRY_WITHOUT_OUT_TRANS, entry, null, -1);
+		}
+		if (entry.getOutgoingTransitions().size() > 1) {
+			error(ISSUE_ENTRY_WITH_MULTIPLE_OUT_TRANS, entry, null, -1);
+		}
+	}
+
+	@Override
+	protected List<EPackage> getEPackages() {
+		List<EPackage> result = new ArrayList<EPackage>();
+		result.add(EPackage.Registry.INSTANCE
+				.getEPackage("http://www.yakindu.org/sct/sgraph/2.0.0"));
+		result.add(EPackage.Registry.INSTANCE
+				.getEPackage("http://www.yakindu.org/base/base/2.0.0"));
+		result.add(EPackage.Registry.INSTANCE
+				.getEPackage("http://www.yakindu.org/base/types/2.0.0"));
+		return result;
+	}
+
+	@Override
+	public boolean isLanguageSpecific() {
+		return false;
+	}
+
+	@Override
+	protected boolean isResponsible(Map<Object, Object> context, EObject eObject) {
+		return true;
+	}
+}

+ 4 - 35
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextJavaValidator.java

@@ -11,7 +11,6 @@
  */
 package org.yakindu.sct.model.stext.validation;
 
-import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -19,7 +18,6 @@ import java.util.Map;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
 import org.eclipse.xtext.Constants;
 import org.eclipse.xtext.Keyword;
 import org.eclipse.xtext.naming.IQualifiedNameProvider;
@@ -28,7 +26,7 @@ import org.eclipse.xtext.nodemodel.INode;
 import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
 import org.eclipse.xtext.validation.Check;
 import org.eclipse.xtext.validation.CheckType;
-import org.eclipse.xtext.validation.EValidatorRegistrar;
+import org.eclipse.xtext.validation.ComposedChecks;
 import org.eclipse.xtext.validation.ValidationMessageAcceptor;
 import org.yakindu.base.types.Event;
 import org.yakindu.base.types.ITypeSystemAccess;
@@ -40,12 +38,10 @@ import org.yakindu.sct.model.sgraph.Choice;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.model.sgraph.Scope;
 import org.yakindu.sct.model.sgraph.ScopedElement;
-import org.yakindu.sct.model.sgraph.SpecificationElement;
-import org.yakindu.sct.model.sgraph.Statechart;
 import org.yakindu.sct.model.sgraph.Statement;
 import org.yakindu.sct.model.sgraph.Transition;
-import org.yakindu.sct.model.sgraph.resource.AbstractSCTResource;
-import org.yakindu.sct.model.sgraph.util.SGraphValidator;
+import org.yakindu.sct.model.sgraph.validation.SCTResourceValidator;
+import org.yakindu.sct.model.sgraph.validation.SGraphJavaValidator;
 import org.yakindu.sct.model.stext.services.STextGrammarAccess;
 import org.yakindu.sct.model.stext.stext.AssignmentExpression;
 import org.yakindu.sct.model.stext.stext.DefaultEvent;
@@ -76,6 +72,7 @@ import com.google.inject.name.Named;
  * @auhor muelder
  * 
  */
+@ComposedChecks(validators = { SGraphJavaValidator.class, SCTResourceValidator.class })
 public class STextJavaValidator extends AbstractSTextJavaValidator {
 
 	public static final String CHOICE_ONE_OUTGOING_DEFAULT_TRANSITION = "A choice should have one outgoing default transition";
@@ -98,34 +95,6 @@ public class STextJavaValidator extends AbstractSTextJavaValidator {
 	@Named(Constants.LANGUAGE_NAME)
 	private String languageName;
 
-	@Inject
-	public void register(EValidatorRegistrar registrar) {
-		super.register(registrar);
-		registrar.register(SGraphPackage.eINSTANCE, new SGraphValidator());
-	}
-
-	@Check(CheckType.FAST)
-	public void checkUnresolvableProxies(Statechart sc) {
-		AbstractSCTResource resource = (AbstractSCTResource) sc.eResource();
-		for (Map.Entry<SpecificationElement, Collection<Diagnostic>> entry : resource
-				.getLinkingDiagnostics().asMap().entrySet()) {
-			for (Diagnostic diag : entry.getValue()) {
-				error(diag.getMessage(), entry.getKey(), null, -1);
-			}
-		}
-	}
-
-	@Check(CheckType.FAST)
-	public void checkSyntaxErrors(Statechart sc) {
-		AbstractSCTResource resource = (AbstractSCTResource) sc.eResource();
-		for (Map.Entry<SpecificationElement, Collection<Diagnostic>> entry : resource
-				.getSyntaxDiagnostics().asMap().entrySet()) {
-			for (Diagnostic diag : entry.getValue()) {
-				error(diag.getMessage(), entry.getKey(), null, -1);
-			}
-		}
-	}
-
 	@Check(CheckType.FAST)
 	public void checkOperationArguments_FeatureCall(final FeatureCall call) {
 		if (call.getFeature() instanceof Operation) {