Просмотр исходного кода

Merge branch 'master' of https://github.com/Yakindu/statecharts.git

Andreas Muelder 8 лет назад
Родитель
Сommit
55f62c3a4e
14 измененных файлов с 383 добавлено и 54 удалено
  1. 2 1
      .travis.yml
  2. 2 1
      plugins/org.yakindu.base.types.test/META-INF/MANIFEST.MF
  3. 155 6
      plugins/org.yakindu.base.types.test/src/org/yakindu/base/types/test/AbstractTypeSystemTest.java
  4. 52 18
      plugins/org.yakindu.base.types/src/org/yakindu/base/types/typesystem/AbstractTypeSystem.java
  5. 1 1
      plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/library/AbstractDefaultFeatureValueProvider.java
  6. 15 13
      plugins/org.yakindu.sct.generator.genmodel/src/org/yakindu/sct/generator/genmodel/scoping/SGenScopeProvider.java
  7. 15 5
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextJavaValidator.java
  8. 33 6
      plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.xtend
  9. 3 0
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/AbstractDebugTargetView.java
  10. 3 1
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/ExecutionContextContentProvider.java
  11. 1 1
      plugins/org.yakindu.sct.ui/src/org/yakindu/sct/ui/wizards/ModelCreationWizardPage.java
  12. 1 1
      releng/org.yakindu.sct.releng/pom.xml
  13. 10 0
      test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/validation/STextJavaValidatorTest.java
  14. 90 0
      test-plugins/org.yakindu.sct.test.models/testmodels/validation/TopLevelRegionNoEntryPoint.sct

+ 2 - 1
.travis.yml

@@ -26,9 +26,10 @@ env:
   # via the "travis encrypt" command using the project repo's public key
   - secure: "e6AtFe0HJAHRdmzp4uXx4b+xZaEUUd2jeYiLdIkYuRa84op9iSzCmPj5uT3Vkvqps5snBrDx47Wl1EO9rl+Z91WYp1JgTT5Ek37SKj/ikhJ0HfAYBycU/MRTMO5wXEfwL29G0gjygzFxlUe7t/Y92M/VsvlEQ9nHrtqJ4hQA968="
   matrix:
+  - TARGET=Luna.target
   - TARGET=Mars.target
-  - TARGET=Oxygen.target
   - TARGET=Neon.target
+  - TARGET=Oxygen.target
 before_script:
  - wget https://github.com/google/googletest/archive/release-1.8.0.zip
  - unzip release-1.8.0.zip

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

@@ -6,4 +6,5 @@ Bundle-Version: 3.0.1.qualifier
 Bundle-Vendor: statecharts.org
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Require-Bundle: org.yakindu.base.types,
- org.junit
+ org.junit,
+ com.google.guava

+ 155 - 6
plugins/org.yakindu.base.types.test/src/org/yakindu/base/types/test/AbstractTypeSystemTest.java

@@ -10,13 +10,18 @@
  */
 package org.yakindu.base.types.test;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
+import org.yakindu.base.types.ComplexType;
+import org.yakindu.base.types.Operation;
 import org.yakindu.base.types.PrimitiveType;
+import org.yakindu.base.types.Property;
 import org.yakindu.base.types.Type;
+import org.yakindu.base.types.TypeParameter;
 import org.yakindu.base.types.TypesFactory;
 import org.yakindu.base.types.typesystem.AbstractTypeSystem;
 
@@ -29,16 +34,51 @@ public class AbstractTypeSystemTest extends AbstractTypeSystem {
 	private static final String SUB_TYPE = "SubType";
 	private static final String SUB_TYPE2 = "SubType2";
 	private static final String SUPER_TYPE = "SuperType";
+	private static final String SUPER_SUPER_TYPE = "SuperSuperType";
 	private static final String SIMPLE_TYPE = "SimpleType";
 	private static final String CONVERSION_SUB_TYPE = "ConversionSubType";
 	private static final String CONVERSION_TYPE = "ConversionType";
+	private static final String TYPE_PARAMETER = "T";
+	private static final String COMPLEX_TYPE = "ComplexType";
+	private static final String SUPER_COMPLEX_TYPE = "SuperComplexType";
+	private static final String SUPER_SUPER_COMPLEX_TYPE = "SuperSuperComplexType";
+	
+	private static final String PRIMITIVE_TYPE = "PrimitiveType";
+	private static final String PRIMITIVE_BASE_TYPE = "PrimitiveBaseType";
+	
+	private static final String EXTENSION_OPERATION = "extensionOperation";
+	private static final String EXTENSION_OPERATION2 = "extensionOperation2";
+	private static final String EXTENSION_OPERATION3 = "extensionOperation3";
+	
+	private static final String EXTENSION_PROPERTY = "extensionProperty";
+	private static final String EXTENSION_PROPERTY2 = "extensionProperty2";
+	private static final String EXTENSION_PROPERTY3 = "extensionProperty3";
 
 	private Type superType;
+	private Type superSuperType;
 	private Type subType;
 	private Type subType2;
 	private Type simpleType;
 	private Type conversionType;
 	private Type conversionSubType;
+	
+	private TypeParameter typeParameter;
+	
+	private ComplexType complexType;
+	private ComplexType superComplexType;
+	private ComplexType superSuperComplexType;
+	
+	private PrimitiveType primitiveType;
+	private PrimitiveType primitiveBaseType;
+	
+	private Operation extensionOperation;
+	private Operation extensionOperation2;
+	private Operation extensionOperation3;
+	
+	private Property extensionProperty;
+	private Property extensionProperty2;
+	private Property extensionProperty3;
+	
 
 	@Override
 	protected void initRegistries() {
@@ -48,39 +88,133 @@ public class AbstractTypeSystemTest extends AbstractTypeSystem {
 		subType = createPrimitive(SUB_TYPE);
 		declareType(subType, SUB_TYPE);
 		declareSuperType(subType, superType);
+		
 		// SubType2 extends Supertype
 		subType2 = createPrimitive(SUB_TYPE2);
 		declareType(subType2, SUB_TYPE2);
 		declareSuperType(subType2,superType);
+		
+		// SuperSuperType extends SuperType
+		superSuperType = createPrimitive(SUPER_SUPER_TYPE);
+		declareType(superSuperType, SUPER_SUPER_TYPE);
+		declareSuperType(superType, superSuperType);
+		
 		// SimpleType
 		simpleType = createPrimitive(SIMPLE_TYPE);
 		declareType(simpleType, SIMPLE_TYPE);
+		
 		// simpleType can be converted into Conversiontype
 		conversionType = createPrimitive(CONVERSION_TYPE);
 		declareConversion(simpleType, conversionType);
 		conversionSubType = createPrimitive(CONVERSION_SUB_TYPE);
 		declareSuperType(conversionSubType, conversionType);
+		
+		// T with SuperType as bound (<T extends SuperType>)
+		typeParameter = createTypeParameter(TYPE_PARAMETER);
+		declareType(typeParameter, TYPE_PARAMETER);
+		typeParameter.setBound(superType);
+		
+		// Primitive type with baseType
+		primitiveBaseType = createPrimitive(PRIMITIVE_BASE_TYPE);
+		primitiveType = createPrimitive(PRIMITIVE_TYPE);
+		declareType(primitiveType, PRIMITIVE_TYPE);
+		primitiveType.setBaseType(primitiveBaseType);
+		
+		// ComplexType extends SuperComplexType extends SuperSuperComplexType
+		superSuperComplexType = createComplexType(SUPER_SUPER_COMPLEX_TYPE);
+		superComplexType = createComplexType(SUPER_COMPLEX_TYPE);
+		superComplexType.getSuperTypes().add(superSuperComplexType);
+		complexType = createComplexType(COMPLEX_TYPE);
+		complexType.getSuperTypes().add(superComplexType);
+		
+		// extension operation
+		extensionOperation = createOperation(EXTENSION_OPERATION);
+		extensionOperation2 = createOperation(EXTENSION_OPERATION2);
+		extensionOperation3 = createOperation(EXTENSION_OPERATION3);
+		extensionOperationRegistry.put(subType,extensionOperation);
+		extensionOperationRegistry.put(superType,extensionOperation2);
+		extensionOperationRegistry.put(superSuperType,extensionOperation3);
+		
+		// extension properties
+		extensionProperty = createProperty(EXTENSION_PROPERTY);
+		extensionProperty2 = createProperty(EXTENSION_PROPERTY2);
+		extensionProperty3 = createProperty(EXTENSION_PROPERTY3);
+		extensionPropertyRegistry.put(subType, extensionProperty);
+		extensionPropertyRegistry.put(superType, extensionProperty2);
+		extensionPropertyRegistry.put(superSuperType, extensionProperty3);
+	}
+
+	protected Property createProperty(String name) {
+		Property property = TypesFactory.eINSTANCE.createProperty();
+		property.setName(name);
+		return property;
+	}
+
+	protected Operation createOperation(String name) {
+		Operation op = TypesFactory.eINSTANCE.createOperation();
+		op.setName(name);
+		return op;
+	}
+
+	protected ComplexType createComplexType(String name) {
+		ComplexType complexType = TypesFactory.eINSTANCE.createComplexType();
+		complexType.setName(name);
+		return complexType;
+	}
 
+	protected TypeParameter createTypeParameter(String name) {
+		TypeParameter typeParameter = TypesFactory.eINSTANCE.createTypeParameter();
+		typeParameter.setName(TYPE_PARAMETER);
+		return typeParameter;
 	}
 
-	protected Type createPrimitive(String name) {
+	protected PrimitiveType createPrimitive(String name) {
 		PrimitiveType result = TypesFactory.eINSTANCE.createPrimitiveType();
 		result.setName(name);
 		return result;
 	}
 
 	@Test
-	public void testGetSuperType() throws Exception {
+	public void testGetSuperTypes() throws Exception {
+		// super type from registry
+		assertEquals("Type system's extends registry not reflected in getSuperTypes() method", 2, getSuperTypes(subType).size());
 		assertTrue(isSame(superType, getSuperTypes(subType).get(0)));
-
+		
+		// super type as base type of primitive type
+		assertEquals("Primitive type's base type not reflected in getSuperTypes() method", 1, getSuperTypes(primitiveType).size());
+		assertTrue(isSame(primitiveBaseType, getSuperTypes(primitiveType).get(0)));
+		
+		// super type as complex type super type
+		assertEquals("Complex type's super types not reflected in getSuperTypes() method", 2, getSuperTypes(complexType).size());
+		assertTrue(isSame(superComplexType, getSuperTypes(complexType).get(0)));
+		
+		// super type as type parameter bound
+		assertEquals("Type parameter's bound type not reflected in getSuperTypes() method", 2, getSuperTypes(typeParameter).size());
+		assertTrue(isSame(superType, getSuperTypes(typeParameter).get(0)));
 	}
 
 	@Test
 	public void testIsSuperType() throws Exception {
-		assertTrue(isSuperType(subType, superType));
+		// super type from registry
+		assertTrue("Direct super types from type system's extends registry not reflected in isSuperType() method", isSuperType(subType, superType));
+		assertTrue("Indirect super types from type system's extends registry not reflected in isSuperType() method", isSuperType(superType, superSuperType));
 		assertFalse(isSuperType(superType, subType));
+		
+		// super type as base type of primitive type
+		assertTrue("Primitive type's base type not reflected in isSuperType() method", isSuperType(primitiveType, primitiveBaseType));
+		assertFalse(isSuperType(primitiveBaseType, primitiveType));
+		
+		// super type as complex type super type
+		assertTrue("Complex type's direct super types not reflected in isSuperType() method", isSuperType(complexType, superComplexType));
+		assertTrue("Complex type's indirect super types not reflected in isSuperType() method", isSuperType(complexType, superSuperComplexType));
+		assertFalse(isSuperType(superComplexType, complexType));
+		
+		// super type as type parameter bound
+		assertTrue("Type parameter's bound type not reflected in isSuperType() method", isSuperType(typeParameter, superType));
+		assertTrue("Indirect super types from type system's extends registry not reflected in isSuperType() method", isSuperType(typeParameter, superSuperType));
+		assertFalse(isSuperType(typeParameter, simpleType));
 	}
-
+	
 	@Test
 	public void testHaveCommonType() throws Exception {
 		assertTrue(haveCommonType(subType, subType2));
@@ -103,5 +237,20 @@ public class AbstractTypeSystemTest extends AbstractTypeSystem {
 		assertTrue(isSame(conversionType, getCommonTypeWithConversion(conversionType, simpleType)));
 		assertTrue(isSame(conversionType, getCommonTypeWithConversion(conversionType, conversionSubType)));
 	}
-
+	
+	@Test
+	public void testGetOperationExtensions() {
+		assertEquals(3, getOperationExtensions(subType).size());
+		assertTrue(getOperationExtensions(subType).contains(extensionOperation));
+		assertTrue(getOperationExtensions(subType).contains(extensionOperation2));
+		assertTrue(getOperationExtensions(subType).contains(extensionOperation3));
+	}
+	
+	@Test
+	public void testIsOperationExtension() {
+		assertTrue(isExtensionOperation(extensionOperation));
+		assertTrue(isExtensionOperation(extensionOperation2));
+		assertTrue(isExtensionOperation(extensionOperation3));
+	}
+	
 }

+ 52 - 18
plugins/org.yakindu.base.types/src/org/yakindu/base/types/typesystem/AbstractTypeSystem.java

@@ -27,6 +27,7 @@ import org.yakindu.base.types.Operation;
 import org.yakindu.base.types.PrimitiveType;
 import org.yakindu.base.types.Property;
 import org.yakindu.base.types.Type;
+import org.yakindu.base.types.TypeParameter;
 import org.yakindu.base.types.TypesFactory;
 import org.yakindu.base.types.annotations.TypeAnnotations;
 
@@ -67,26 +68,59 @@ public abstract class AbstractTypeSystem implements ITypeSystem {
 		conversionRegistry.clear();
 	}
 
+	@Override
 	public Type getType(String type) {
 		Type result = typeRegistry.get(type);
 		return result;
 	}
-
+	
+	/**
+	 * Returns all direct and indirect super types. Also reflects primitive
+	 * type's base types, type parameter bounds and complex type's super types.
+	 */
+	@Override
 	public List<Type> getSuperTypes(Type type) {
+		List<Type> allSuperTypes = new ArrayList<Type>();
+		collectSupertypes(type, allSuperTypes);
+		return allSuperTypes;
+	}
+
+	/**
+	 * Returns the list of direct super types for given type. Also reflects primitive
+	 * type's base types, type parameter bounds and complex type's super types.
+	 */
+	protected List<Type> getDirectSuperTypes(Type type) {
 		List<Type> superTypes = new ArrayList<Type>();
 		for (Entry<Type, Type> entry : extendsRegistry.entries()) {
 			if (isSame(type, entry.getKey())) {
 				superTypes.add(entry.getValue());
 			}
 		}
+		if (type instanceof PrimitiveType) {
+			PrimitiveType primitiveType = (PrimitiveType) type;
+			PrimitiveType baseType = primitiveType.getBaseType();
+			if (baseType != null) {
+				superTypes.add(baseType);
+			}
+		}
 		if (type instanceof ComplexType) {
 			ComplexType complexType = (ComplexType) type;
 			superTypes.addAll(complexType.getSuperTypes());
 		}
-
+		if (type instanceof TypeParameter) {
+			TypeParameter typeParameter = (TypeParameter) type;
+			Type bound = typeParameter.getBound();
+			if (bound != null) {
+				superTypes.add(bound);
+			}
+		}
 		return superTypes;
 	}
 
+	/**
+	 * @returns <code>true</code> if superType is a direct or indirect super type of subType.
+	 */
+	@Override
 	public boolean isSuperType(Type subtype, Type supertype) {
 		List<Type> typehierachy = new ArrayList<Type>();
 		typehierachy.add(subtype);
@@ -98,30 +132,26 @@ public abstract class AbstractTypeSystem implements ITypeSystem {
 		return false;
 	}
 
-	protected void collectSupertypes(Type subtypeClass, List<Type> typeHierachy) {
-		if (subtypeClass == null)
+	/**
+	 * Recursively calls itself to create list of all direct and indirect super types of given sub type
+	 */
+	protected void collectSupertypes(Type subType, List<Type> typeHierachy) {
+		if (subType == null)
 			return;
 
-		if (subtypeClass instanceof PrimitiveType) {
-			PrimitiveType primitiveType = (PrimitiveType) subtypeClass;
-			Type baseType = primitiveType.getBaseType();
-			if (baseType != null) {
-				typeHierachy.add(baseType);
-				collectSupertypes(baseType, typeHierachy);
-			}
-		}
-
-		List<Type> superTypes = getSuperTypes(subtypeClass);
+		List<Type> superTypes = getDirectSuperTypes(subType);
 		for (Type superType : superTypes) {
 			typeHierachy.add(superType);
 			collectSupertypes(superType, typeHierachy);
 		}
 	}
 
+	@Override
 	public Collection<Type> getTypes() {
 		return Collections.unmodifiableCollection(typeRegistry.values());
 	}
 
+	@Override
 	public Collection<Type> getConcreteTypes() {
 		List<Type> result = new ArrayList<Type>();
 		for (Type type : getTypes()) {
@@ -139,11 +169,11 @@ public abstract class AbstractTypeSystem implements ITypeSystem {
 		return primitive;
 	}
 
-	public void declareType(Type type, String name) {
+	protected void declareType(Type type, String name) {
 		typeRegistry.put(name, type);
 	}
 
-	public void removeType(String name) {
+	protected void removeType(String name) {
 		Type type = typeRegistry.get(name);
 		if (type != null) {
 			extendsRegistry.removeAll(type);
@@ -152,22 +182,25 @@ public abstract class AbstractTypeSystem implements ITypeSystem {
 		}
 	}
 
-	public void declareSuperType(Type subType, Type superType) {
+	protected void declareSuperType(Type subType, Type superType) {
 		extendsRegistry.put(subType, superType);
 	}
 
-	public void declareConversion(Type baseType, Type targetType) {
+	protected void declareConversion(Type baseType, Type targetType) {
 		conversionRegistry.put(baseType, targetType);
 	}
 
+	@Override
 	public boolean haveCommonType(Type type1, Type type2) {
 		return getCommonType(type1, type2) != null;
 	}
 
+	@Override
 	public boolean isSame(Type type1, Type type2) {
 		return EcoreUtil.equals(type1, type2);
 	}
 
+	@Override
 	public Type getCommonType(Type type1, Type type2) {
 		Type result = getCommonTypeInternal(type1, type2);
 		if (result != null)
@@ -180,6 +213,7 @@ public abstract class AbstractTypeSystem implements ITypeSystem {
 		return getCommonTypeWithConversion(type1, type2) != null;
 	}
 
+	@Override
 	public Type getCommonTypeWithConversion(Type type1, Type type2) {
 		Type result = getCommonType(type1, type2);
 		if (result != null)

+ 1 - 1
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/library/AbstractDefaultFeatureValueProvider.java

@@ -70,7 +70,7 @@ public abstract class AbstractDefaultFeatureValueProvider implements IDefaultFea
 	protected String getProjectName(EObject contextElement) {
 		URI uri = EcoreUtil.getURI(contextElement);
 		if (uri.isPlatformResource() && uri.segmentCount() > 1) {
-			return uri.segment(1); // 0 is resource
+			return URI.decode(uri.segment(1)); // 0 is resource
 		}
 		return "ProjectName";
 	}

+ 15 - 13
plugins/org.yakindu.sct.generator.genmodel/src/org/yakindu/sct/generator/genmodel/scoping/SGenScopeProvider.java

@@ -76,20 +76,22 @@ public class SGenScopeProvider extends AbstractDeclarativeScopeProvider {
 		if (desc == null)
 			return IScope.NULLSCOPE;
 		final String elementRefType = desc.getElementRefType();
-		return new FilteringScope(getDelegate().getScope(context, reference),
-				new Predicate<IEObjectDescription>() {
-					public boolean apply(IEObjectDescription input) {
-
-						EList<EClass> allSuperTypes = input.getEClass()
-								.getESuperTypes();
-						for (EClass eClass : allSuperTypes) {
-							if (elementRefType.equals(eClass.getInstanceClassName()))
-								return true;
-						}
-						return elementRefType.equals(input.getEClass()
-								.getInstanceClassName());
+		IScope scope = new FilteringScope(getDelegate().getScope(context, reference),
+			new Predicate<IEObjectDescription>() {
+				public boolean apply(IEObjectDescription input) {
+
+					EList<EClass> allSuperTypes = input.getEClass()
+							.getESuperTypes();
+					for (EClass eClass : allSuperTypes) {
+						if (elementRefType.equals(eClass.getInstanceClassName()))
+							return true;
 					}
-				});
+					return elementRefType.equals(input.getEClass()
+							.getInstanceClassName());
+				}
+			});
+		return new SimpleScope(scope.getAllElements());
+		
 	}
 
 	protected IScope scope_Parameter(final EObject context, EReference reference) {

+ 15 - 5
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextJavaValidator.java

@@ -16,6 +16,7 @@ import static org.yakindu.sct.model.stext.lib.StatechartAnnotations.CYCLE_BASED_
 import static org.yakindu.sct.model.stext.lib.StatechartAnnotations.CHILD_FIRST_ANNOTATION;
 import static org.yakindu.sct.model.stext.lib.StatechartAnnotations.PARENT_FIRST_ANNOTATION;
 
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -515,12 +516,8 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 	@Check(CheckType.NORMAL)
 	public void checkTopLeveEntryIsDefaultEntry(final Entry entry) {
 		Region parentRegion = entry.getParentRegion();
-		EObject eContainer = parentRegion.eContainer();
-
-		boolean isTopLevelRegionEntry = eContainer instanceof Statechart;
-
 		// 1. check if is toplevel
-		if (isTopLevelRegionEntry) {
+		if (isTopLevelRegion(parentRegion)) {
 			boolean isDefaultEntry = STextValidationModelUtils.isDefault(entry);
 			// 2. check if is default entry
 			if (!isDefaultEntry) {
@@ -536,6 +533,19 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 			}
 		}
 	}
+	
+	protected boolean isTopLevelRegion(final Region region) {
+		return region.eContainer() instanceof Statechart;
+	}
+	
+	@Check(CheckType.NORMAL)
+	public void checkTopLevelRegionHasEntry(final Region region) {
+		if (isTopLevelRegion(region)) {
+			if (!STextValidationModelUtils.getRegionsWithoutDefaultEntry(Collections.singletonList(region)).isEmpty()) {
+				error(REGION_UNBOUND_DEFAULT_ENTRY_POINT, region, null, -1);
+			}
+		}
+	}
 
 	@Check(CheckType.FAST)
 	public void checkAnnotationArguments(ArgumentedAnnotation annotation) {

+ 33 - 6
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.xtend

@@ -55,6 +55,7 @@ import org.yakindu.sct.simulation.core.sruntime.ExecutionContext
 import org.yakindu.sct.simulation.core.sruntime.ExecutionEvent
 import org.yakindu.sct.simulation.core.sruntime.ExecutionVariable
 import org.yakindu.sct.simulation.core.sruntime.ReferenceSlot
+import org.yakindu.base.types.Event
 
 /**
  * 
@@ -145,10 +146,10 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 
 		if (assignment.operator == AssignmentOperator::ASSIGN) {
 			// Strong typing, use the type of the scopeVariable instead of using new runtime type
-			scopeVariable.value = if(result != null) cast(result, scopeVariable.type) else null
+			scopeVariable.value = if(result !== null) cast(result, scopeVariable.type) else null
 		} else {
 			var operator = AbstractStatementInterpreter::assignFunctionMap.get(assignment.operator.getName())
-			scopeVariable.value = if (result != null)
+			scopeVariable.value = if (result !== null)
 				cast(evaluate(operator, scopeVariable.getValue, result), scopeVariable.type)
 			else
 				null
@@ -163,7 +164,7 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 			
 			val value = eventRaising.value?.execute	
 		
-			if (eventRaiser != null) event.raise(value) 
+			if (eventRaiser !== null) event.raise(value) 
 		}
 		
 		null
@@ -188,7 +189,25 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 				return event.getValue;
 			};
 		}
-		null;
+		throw new UndefinedValueException("Undefined value of event '" + expression.value.eventName + "'\n" + "Event values only exist in the same cycle in which the event was raised.")
+	}
+	
+	def dispatch protected getEventName(Expression it){
+		return "null"
+	}
+	
+	def dispatch protected getEventName(ElementReferenceExpression it){
+		if(reference instanceof Event){
+			return (reference as Event).name
+		}
+		return "null"
+	}
+	
+	def dispatch protected getEventName(FeatureCall it){
+		if(feature instanceof Event){
+			return (feature as Event).name
+		}
+		return "null"
 	}
 
 	def dispatch qname(FeatureCall e) {
@@ -281,7 +300,7 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 	def executeElementReferenceExpression(ElementReferenceExpression expression){
 		var parameter = expression.expressions.map(it|execute)
 		if (expression.operationCall || expression.reference instanceof OperationDefinition) {
-			if (operationDelegate != null &&
+			if (operationDelegate !== null &&
 				operationDelegate.canExecute(expression.reference as Operation, parameter.toArray)) {
 				return (expression.reference as Operation).execute(parameter.toArray)
 			}
@@ -310,7 +329,7 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 			var parameter = call.expressions.map(it|execute)
 			if (call.feature instanceof Operation) {
 				var Operation operation = call.feature as Operation
-				if (operationDelegate != null && operationDelegate.canExecute(operation, parameter)) {
+				if (operationDelegate !== null && operationDelegate.canExecute(operation, parameter)) {
 					return operation.execute(parameter)
 				}
 			}
@@ -377,5 +396,13 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 	def dispatch valueLiteral(NullLiteral literal) {
 		return null
 	}
+	
+	protected static class UndefinedValueException extends IllegalStateException {
+	
+		new(String message) {
+			super(message)
+		}
+	
+	}
 
 }

+ 3 - 0
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/AbstractDebugTargetView.java

@@ -88,6 +88,9 @@ public abstract class AbstractDebugTargetView extends ViewPart
 			} else {
 				newTarget = (IDebugTarget) object.getAdapter(IDebugTarget.class);
 			}
+			if(newTarget == debugTarget) {
+				return;
+			}
 			if (newTarget != debugTarget && newTarget != null && !newTarget.isTerminated()) {
 				debugTarget = newTarget;
 				activeTargetChanged(newTarget);

+ 3 - 1
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/ExecutionContextContentProvider.java

@@ -49,7 +49,6 @@ public class ExecutionContextContentProvider implements ITreeContentProvider, IP
 					e.printStackTrace();
 				}
 			}
-
 		}
 
 		public boolean isCancel() {
@@ -78,6 +77,9 @@ public class ExecutionContextContentProvider implements ITreeContentProvider, IP
 
 	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
 		this.viewer = viewer;
+		if (refresher != null) {
+			refresher.cancel = true;
+		}
 		refresher = new ViewerRefresher();
 		if (newInput != null) {
 			new Thread(refresher).start();

+ 1 - 1
plugins/org.yakindu.sct.ui/src/org/yakindu/sct/ui/wizards/ModelCreationWizardPage.java

@@ -38,7 +38,7 @@ public class ModelCreationWizardPage extends WizardNewFileCreationPage {
 	}
 
 	public URI getURI() {
-		return URI.createPlatformResourceURI(getFilePath().toString(), false);
+		return URI.createPlatformResourceURI(URI.encodeFragment(getFilePath().toString(),true), false);
 	}
 
 	public IPath getFilePath() {

+ 1 - 1
releng/org.yakindu.sct.releng/pom.xml

@@ -207,7 +207,7 @@
 				<activeByDefault>false</activeByDefault>
 			</activation>
 			<properties>
-				<xtext-version>2.7.3</xtext-version>
+				<xtext-version>2.8.4</xtext-version>
 			</properties>
 			<build>
 				<plugins>

+ 10 - 0
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/validation/STextJavaValidatorTest.java

@@ -39,6 +39,7 @@ import org.yakindu.base.types.Operation;
 import org.yakindu.base.types.typesystem.ITypeSystem;
 import org.yakindu.sct.model.sgraph.Entry;
 import org.yakindu.sct.model.sgraph.Exit;
+import org.yakindu.sct.model.sgraph.Region;
 import org.yakindu.sct.model.sgraph.Scope;
 import org.yakindu.sct.model.sgraph.State;
 import org.yakindu.sct.model.sgraph.Statechart;
@@ -625,6 +626,15 @@ public class STextJavaValidatorTest extends AbstractSTextValidationTest implemen
 		assertIssueCount(diagnostics, 1);
 		assertWarning(diagnostics, TOP_LEVEL_REGION_ENTRY_HAVE_TO_BE_A_DEFAULT_ENTRY);
 	}
+	
+	@Test
+	public void checkTopLevelRegionHasEntry() {
+		statechart = AbstractTestModelsUtil
+				.loadStatechart(VALIDATION_TESTMODEL_DIR + "TopLevelRegionNoEntryPoint.sct");
+		doValidateAllContents(Region.class);
+		assertIssueCount(diagnostics, 1);
+		assertError(diagnostics, REGION_UNBOUND_DEFAULT_ENTRY_POINT);
+	}
 
 	@Test
 	public void checkUnusedExit() {

+ 90 - 0
test-plugins/org.yakindu.sct.test.models/testmodels/validation/TopLevelRegionNoEntryPoint.sct

@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:sgraph="http://www.yakindu.org/sct/sgraph/2.0.0">
+  <sgraph:Statechart xmi:id="_Zq3bwIZdEeevH5YHkHluHw" specification="interface:&#xA;// Define events and&#xA;// and variables here. &#xA;//Use CTRL + Space for content assist." name="TopLevelRegionNoEntryPoint">
+    <regions xmi:id="_Zq5Q8oZdEeevH5YHkHluHw" name="main region">
+      <vertices xsi:type="sgraph:State" xmi:id="_flanQIZgEeeHQ-C2g6HOaA" name="A" incomingTransitions="_i3PkYIZgEeeHQ-C2g6HOaA">
+        <outgoingTransitions xmi:id="_gBzBQIZgEeeHQ-C2g6HOaA" specification="" target="_h7V80IZgEeeHQ-C2g6HOaA"/>
+      </vertices>
+      <vertices xsi:type="sgraph:State" xmi:id="_h7V80IZgEeeHQ-C2g6HOaA" name="B" incomingTransitions="_gBzBQIZgEeeHQ-C2g6HOaA">
+        <outgoingTransitions xmi:id="_i3PkYIZgEeeHQ-C2g6HOaA" specification="" target="_flanQIZgEeeHQ-C2g6HOaA"/>
+      </vertices>
+    </regions>
+  </sgraph:Statechart>
+  <notation:Diagram xmi:id="_Zq5Q8IZdEeevH5YHkHluHw" type="org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor" element="_Zq3bwIZdEeevH5YHkHluHw" measurementUnit="Pixel">
+    <children xmi:id="_Zq8UQIZdEeevH5YHkHluHw" type="Region" element="_Zq5Q8oZdEeevH5YHkHluHw">
+      <children xsi:type="notation:DecorationNode" xmi:id="_Zq_XkIZdEeevH5YHkHluHw" type="RegionName">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_Zq_XkYZdEeevH5YHkHluHw"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_Zq_XkoZdEeevH5YHkHluHw"/>
+      </children>
+      <children xsi:type="notation:Shape" xmi:id="_Zq_Xk4ZdEeevH5YHkHluHw" type="RegionCompartment" fontName="Verdana" lineColor="4210752">
+        <children xmi:id="_fldDgIZgEeeHQ-C2g6HOaA" type="State" element="_flanQIZgEeeHQ-C2g6HOaA">
+          <children xsi:type="notation:DecorationNode" xmi:id="_fldDhIZgEeeHQ-C2g6HOaA" type="StateName">
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_fldDhYZgEeeHQ-C2g6HOaA"/>
+            <layoutConstraint xsi:type="notation:Location" xmi:id="_fldqkIZgEeeHQ-C2g6HOaA"/>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_fldqkYZgEeeHQ-C2g6HOaA" type="StateTextCompartment">
+            <children xsi:type="notation:Shape" xmi:id="_fldqkoZgEeeHQ-C2g6HOaA" type="StateTextCompartmentExpression" fontName="Verdana" lineColor="4210752">
+              <layoutConstraint xsi:type="notation:Bounds" xmi:id="_fldqk4ZgEeeHQ-C2g6HOaA"/>
+            </children>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_fldqlIZgEeeHQ-C2g6HOaA" type="StateFigureCompartment"/>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_fldDgYZgEeeHQ-C2g6HOaA" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
+          <styles xsi:type="notation:FontStyle" xmi:id="_fldDgoZgEeeHQ-C2g6HOaA"/>
+          <styles xsi:type="notation:BooleanValueStyle" xmi:id="_fldqlYZgEeeHQ-C2g6HOaA" name="isHorizontal" booleanValue="true"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_fldDg4ZgEeeHQ-C2g6HOaA" x="75" y="111"/>
+        </children>
+        <children xmi:id="_h7XK8IZgEeeHQ-C2g6HOaA" type="State" element="_h7V80IZgEeeHQ-C2g6HOaA">
+          <children xsi:type="notation:DecorationNode" xmi:id="_h7XyAIZgEeeHQ-C2g6HOaA" type="StateName">
+            <styles xsi:type="notation:ShapeStyle" xmi:id="_h7XyAYZgEeeHQ-C2g6HOaA"/>
+            <layoutConstraint xsi:type="notation:Location" xmi:id="_h7XyAoZgEeeHQ-C2g6HOaA"/>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_h7YZEIZgEeeHQ-C2g6HOaA" type="StateTextCompartment">
+            <children xsi:type="notation:Shape" xmi:id="_h7YZEYZgEeeHQ-C2g6HOaA" type="StateTextCompartmentExpression" fontName="Verdana" lineColor="4210752">
+              <layoutConstraint xsi:type="notation:Bounds" xmi:id="_h7YZEoZgEeeHQ-C2g6HOaA"/>
+            </children>
+          </children>
+          <children xsi:type="notation:Compartment" xmi:id="_h7YZE4ZgEeeHQ-C2g6HOaA" type="StateFigureCompartment"/>
+          <styles xsi:type="notation:ShapeStyle" xmi:id="_h7XK8YZgEeeHQ-C2g6HOaA" fontName="Verdana" fillColor="15981773" lineColor="12632256"/>
+          <styles xsi:type="notation:FontStyle" xmi:id="_h7XK8oZgEeeHQ-C2g6HOaA"/>
+          <styles xsi:type="notation:BooleanValueStyle" xmi:id="_h7YZFIZgEeeHQ-C2g6HOaA" name="isHorizontal" booleanValue="true"/>
+          <layoutConstraint xsi:type="notation:Bounds" xmi:id="_h7XK84ZgEeeHQ-C2g6HOaA" x="169" y="111"/>
+        </children>
+        <layoutConstraint xsi:type="notation:Bounds" xmi:id="_Zq_XlIZdEeevH5YHkHluHw"/>
+      </children>
+      <styles xsi:type="notation:ShapeStyle" xmi:id="_Zq8UQYZdEeevH5YHkHluHw" fontName="Verdana" fillColor="15790320" lineColor="12632256"/>
+      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_Zq_-oIZdEeevH5YHkHluHw" x="220" y="-56" width="377" height="400"/>
+    </children>
+    <children xsi:type="notation:Shape" xmi:id="_ZrEQFIZdEeevH5YHkHluHw" type="StatechartText" fontName="Verdana" lineColor="4210752">
+      <children xsi:type="notation:DecorationNode" xmi:id="_ZrE3IIZdEeevH5YHkHluHw" type="StatechartName">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_ZrE3IYZdEeevH5YHkHluHw"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_ZrE3IoZdEeevH5YHkHluHw"/>
+      </children>
+      <children xsi:type="notation:Shape" xmi:id="_ZrE3I4ZdEeevH5YHkHluHw" type="StatechartTextExpression" fontName="Verdana" lineColor="4210752">
+        <layoutConstraint xsi:type="notation:Bounds" xmi:id="_ZrE3JIZdEeevH5YHkHluHw"/>
+      </children>
+      <layoutConstraint xsi:type="notation:Bounds" xmi:id="_ZrE3JYZdEeevH5YHkHluHw" x="8" y="-56" width="200" height="400"/>
+    </children>
+    <styles xsi:type="notation:DiagramStyle" xmi:id="_Zq5Q8YZdEeevH5YHkHluHw"/>
+    <edges xmi:id="_gB0PYIZgEeeHQ-C2g6HOaA" type="Transition" element="_gBzBQIZgEeeHQ-C2g6HOaA" source="_fldDgIZgEeeHQ-C2g6HOaA" target="_h7XK8IZgEeeHQ-C2g6HOaA">
+      <children xsi:type="notation:DecorationNode" xmi:id="_gB0PZIZgEeeHQ-C2g6HOaA" type="TransitionExpression">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_gB0PZYZgEeeHQ-C2g6HOaA"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_gB02cIZgEeeHQ-C2g6HOaA" y="10"/>
+      </children>
+      <styles xsi:type="notation:ConnectorStyle" xmi:id="_gB0PYYZgEeeHQ-C2g6HOaA" routing="Rectilinear" lineColor="4210752"/>
+      <styles xsi:type="notation:FontStyle" xmi:id="_gB0PY4ZgEeeHQ-C2g6HOaA" fontName="Verdana"/>
+      <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_gB0PYoZgEeeHQ-C2g6HOaA" points="[8, 24, 8, 24]$[8, 24, 8, 24]"/>
+      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_ii0MgIZgEeeHQ-C2g6HOaA" id="(0.225,0.5283018867924528)"/>
+    </edges>
+    <edges xmi:id="_i3QygIZgEeeHQ-C2g6HOaA" type="Transition" element="_i3PkYIZgEeeHQ-C2g6HOaA" source="_h7XK8IZgEeeHQ-C2g6HOaA" target="_fldDgIZgEeeHQ-C2g6HOaA">
+      <children xsi:type="notation:DecorationNode" xmi:id="_i3RZkIZgEeeHQ-C2g6HOaA" type="TransitionExpression">
+        <styles xsi:type="notation:ShapeStyle" xmi:id="_i3RZkYZgEeeHQ-C2g6HOaA"/>
+        <layoutConstraint xsi:type="notation:Location" xmi:id="_i3RZkoZgEeeHQ-C2g6HOaA" y="10"/>
+      </children>
+      <styles xsi:type="notation:ConnectorStyle" xmi:id="_i3QygYZgEeeHQ-C2g6HOaA" routing="Rectilinear" lineColor="4210752"/>
+      <styles xsi:type="notation:FontStyle" xmi:id="_i3Qyg4ZgEeeHQ-C2g6HOaA" fontName="Verdana"/>
+      <bendpoints xsi:type="notation:RelativeBendpoints" xmi:id="_i3QygoZgEeeHQ-C2g6HOaA" points="[-7, -7, 115, 2]$[-119, -19, 3, -10]"/>
+      <sourceAnchor xsi:type="notation:IdentityAnchor" xmi:id="_i3TOwIZgEeeHQ-C2g6HOaA" id="(0.225,0.2830188679245283)"/>
+      <targetAnchor xsi:type="notation:IdentityAnchor" xmi:id="_i3TOwYZgEeeHQ-C2g6HOaA" id="(0.6,0.22641509433962265)"/>
+    </edges>
+  </notation:Diagram>
+</xmi:XMI>