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

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

Andreas Muelder 9 лет назад
Родитель
Сommit
69c8960e1c
22 измененных файлов с 541 добавлено и 461 удалено
  1. 2 2
      plugins/org.yakindu.base.expressions/src/org/yakindu/base/expressions/validation/ExpressionsJavaValidator.java
  2. 4 0
      plugins/org.yakindu.sct.domain.generic.editor/src/org/yakindu/sct/domain/generic/editor/GenericEditorModule.java
  3. 17 3
      plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/TimerService.xtend
  4. 30 12
      plugins/org.yakindu.sct.model.stext.ui/src/org/yakindu/sct/model/stext/ui/contentassist/STextProposalProvider.java
  5. 3 0
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/STextRuntimeModule.java
  6. 19 68
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextScopeProvider.java
  7. 36 27
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/ContextPredicateProvider.java
  8. 89 71
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextJavaValidator.java
  9. 2 0
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextValidationMessages.java
  10. 1 1
      plugins/org.yakindu.sct.simulation.core/model/sruntime.ecore
  11. 4 4
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/ReferenceSlot.java
  12. 22 11
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/ReferenceSlotImpl.java
  13. 3 3
      plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/SRuntimePackageImpl.java
  14. 11 1
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/ExecutionContextLabelProvider.java
  15. 5 1
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/EnumerationEditingSupport.java
  16. 13 1
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/MultiEditingSupport.java
  17. 6 3
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/editor/ResourceSetValidationListener.java
  18. 20 9
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/validation/SCTValidationJob.java
  19. 3 7
      test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/AllTests.java
  20. 246 0
      test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/ContextPredicateProviderTest.java
  21. 0 237
      test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/STextScopeProviderTest.java
  22. 5 0
      test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/validation/STextJavaValidatorTest.java

+ 2 - 2
plugins/org.yakindu.base.expressions/src/org/yakindu/base/expressions/validation/ExpressionsJavaValidator.java

@@ -72,10 +72,10 @@ public class ExpressionsJavaValidator extends org.yakindu.base.expressions.valid
 	public void accept(ValidationIssue issue) {
 		switch (issue.getSeverity()) {
 		case ERROR:
-			error(issue.getMessage(), null);
+			error(issue.getMessage(), null, issue.getIssueCode());
 			break;
 		case WARNING:
-			warning(issue.getMessage(), null);
+			warning(issue.getMessage(), null, issue.getIssueCode());
 			break;
 		case INFO:
 			break;

+ 4 - 0
plugins/org.yakindu.sct.domain.generic.editor/src/org/yakindu/sct/domain/generic/editor/GenericEditorModule.java

@@ -14,9 +14,11 @@ import org.eclipse.xtext.service.AbstractGenericModule;
 import org.eclipse.xtext.ui.editor.validation.MarkerCreator;
 import org.eclipse.xtext.ui.validation.MarkerTypeProvider;
 import org.eclipse.xtext.validation.IDiagnosticConverter;
+import org.eclipse.xtext.validation.IResourceValidator;
 import org.yakindu.sct.model.sgraph.ui.validation.SCTDiagnosticConverterImpl;
 import org.yakindu.sct.model.sgraph.ui.validation.SCTMarkerCreator;
 import org.yakindu.sct.model.sgraph.ui.validation.SCTMarkerTypeProvider;
+import org.yakindu.sct.model.stext.resource.SCTResourceValidatorImpl;
 import org.yakindu.sct.refactoring.proposals.RefactoringProposalProvider;
 import org.yakindu.sct.ui.editor.editor.proposals.SmartEditProposalProvider;
 import org.yakindu.sct.ui.editor.proposals.IEditProposalProvider;
@@ -39,6 +41,7 @@ public class GenericEditorModule extends AbstractGenericModule {
 				IEditProposalProvider.class);
 		proposalProviderBinder.addBinding().to(SmartEditProposalProvider.class);
 		proposalProviderBinder.addBinding().to(RefactoringProposalProvider.class);
+		binder.bind(IResourceValidator.class).to(SCTResourceValidatorImpl.class);
 	}
 
 	public Class<? extends ISCTPaletteFactory> bindISCTPaletteFactory() {
@@ -56,4 +59,5 @@ public class GenericEditorModule extends AbstractGenericModule {
 	public Class<? extends MarkerTypeProvider> bindMarkerTypeProvider() {
 		return SCTMarkerTypeProvider.class;
 	}
+
 }

+ 17 - 3
plugins/org.yakindu.sct.generator.java/src/org/yakindu/sct/generator/java/TimerService.xtend

@@ -64,8 +64,8 @@ class TimerService {
 				 * Constructor for a time event.
 				 *
 				 * @param callback
-				 *            : Set to {@code true} if event should be repeated
-				 *            periodically.
+				 *            : Object that implements ITimerCallback, is called
+				 *            when the timer expires.
 				 *
 				 * @param eventID
 				 *            : Index position within the state machine's timeEvent
@@ -79,7 +79,8 @@ class TimerService {
 				public void run() {
 					callback.timeElapsed(eventID);
 				}
-			
+				
+				@Override
 				public boolean equals(Object obj) {
 					if (obj instanceof TimeEventTask) {
 						return ((TimeEventTask) obj).callback.equals(callback)
@@ -87,6 +88,19 @@ class TimerService {
 					}
 					return super.equals(obj);
 				}
+				
+				@Override
+				public int hashCode() {
+					int prime = 37;
+					int result = 1;
+					
+					int c = (int) this.eventID;
+					result = prime * result + c;
+					c = this.callback.hashCode();
+					result = prime * result + c;
+					return result;
+				}
+				
 			}
 			
 			public void setTimer(final ITimerCallback callback, final int eventID,

+ 30 - 12
plugins/org.yakindu.sct.model.stext.ui/src/org/yakindu/sct/model/stext/ui/contentassist/STextProposalProvider.java

@@ -13,7 +13,6 @@ package org.yakindu.sct.model.stext.ui.contentassist;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.regex.Pattern;
 
 import org.eclipse.emf.common.util.BasicEList;
 import org.eclipse.emf.common.util.EList;
@@ -22,6 +21,8 @@ import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
 import org.eclipse.emf.edit.provider.IItemLabelProvider;
 import org.eclipse.jface.text.contentassist.ICompletionProposal;
 import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.xtext.Assignment;
+import org.eclipse.xtext.CrossReference;
 import org.eclipse.xtext.EnumLiteralDeclaration;
 import org.eclipse.xtext.Keyword;
 import org.eclipse.xtext.RuleCall;
@@ -32,6 +33,7 @@ import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
 import org.eclipse.xtext.ui.editor.contentassist.ContentProposalLabelProvider;
 import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
 import org.yakindu.base.expressions.expressions.ElementReferenceExpression;
+import org.yakindu.base.expressions.expressions.ExpressionsPackage;
 import org.yakindu.base.expressions.expressions.FeatureCall;
 import org.yakindu.base.types.Operation;
 import org.yakindu.base.types.Type;
@@ -42,8 +44,10 @@ import org.yakindu.sct.model.stext.stext.SimpleScope;
 import org.yakindu.sct.model.stext.stext.StatechartSpecification;
 import org.yakindu.sct.model.stext.stext.TransitionSpecification;
 import org.yakindu.sct.model.stext.stext.VariableDefinition;
+import org.yakindu.sct.model.stext.validation.ContextPredicateProvider;
 
 import com.google.common.base.Function;
+import com.google.common.base.Predicate;
 import com.google.inject.Inject;
 
 /**
@@ -53,10 +57,6 @@ import com.google.inject.Inject;
  */
 public class STextProposalProvider extends AbstractSTextProposalProvider {
 
-	private static final int OPERATION_PATTERN_OP_PARAMS = 1;
-
-	private static final Pattern OPERATION_PATTERN = Pattern.compile(".*\\((.*)\\).*");
-
 	@Inject
 	protected STextGrammarAccess grammarAccess;
 	private ComposedAdapterFactory composedAdapterFactory = new ComposedAdapterFactory(
@@ -138,7 +138,8 @@ public class STextProposalProvider extends AbstractSTextProposalProvider {
 
 	protected void suppressKeywords(List<Keyword> suppressKeywords, FeatureCall featureCall) {
 		if (!(featureCall.getFeature() instanceof Operation)) {
-			suppressKeywords.add(grammarAccess.getFeatureCallAccess().getOperationCallLeftParenthesisKeyword_1_3_0_0_0());
+			suppressKeywords
+					.add(grammarAccess.getFeatureCallAccess().getOperationCallLeftParenthesisKeyword_1_3_0_0_0());
 		}
 	}
 
@@ -190,6 +191,16 @@ public class STextProposalProvider extends AbstractSTextProposalProvider {
 		};
 	}
 
+	@Inject
+	private ContextPredicateProvider contextProvider;
+
+	public void completeElementReferenceExpression_Reference(EObject model, Assignment assignment,
+			ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+		Predicate<IEObjectDescription> predicate = contextProvider.calculateFilterPredicate(context.getCurrentModel(),
+				ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE);
+		lookupCrossReference(((CrossReference) assignment.getTerminal()), context, acceptor, predicate);
+	}
+
 	@Override
 	public void complete_BOOL(EObject model, RuleCall ruleCall, ContentAssistContext context,
 			ICompletionProposalAcceptor acceptor) {
@@ -226,8 +237,8 @@ public class STextProposalProvider extends AbstractSTextProposalProvider {
 		if (element instanceof Type) {
 			return super.getDisplayString(element, qualifiedNameAsString, shortName);
 		}
-		
-		if(element == null || element.eIsProxy()){
+
+		if (element == null || element.eIsProxy()) {
 			return qualifiedNameAsString;
 		}
 		IItemLabelProvider adapter = (IItemLabelProvider) composedAdapterFactory.adapt(element,
@@ -238,6 +249,13 @@ public class STextProposalProvider extends AbstractSTextProposalProvider {
 		return super.getDisplayString(element, qualifiedNameAsString, shortName);
 	}
 
+	@Override
+	public void complete_ElementReferenceExpression(EObject model, RuleCall ruleCall, ContentAssistContext context,
+			ICompletionProposalAcceptor acceptor) {
+		// TODO Auto-generated method stub
+		super.complete_ElementReferenceExpression(model, ruleCall, context, acceptor);
+	}
+
 	@Override
 	public void complete_STRING(EObject model, RuleCall ruleCall, ContentAssistContext context,
 			ICompletionProposalAcceptor acceptor) {
@@ -262,8 +280,8 @@ public class STextProposalProvider extends AbstractSTextProposalProvider {
 		ICompletionProposalAcceptor priorityOptimizer = getCustomAcceptor(model, "integer", acceptor);
 
 		String proposalText = "0x1";
-		ICompletionProposal proposal = createCompletionProposal(proposalText, proposalText + " - "
-				+ ruleCall.getRule().getName(), null, context);
+		ICompletionProposal proposal = createCompletionProposal(proposalText,
+				proposalText + " - " + ruleCall.getRule().getName(), null, context);
 
 		if (proposal instanceof ConfigurableCompletionProposal) {
 			ConfigurableCompletionProposal configurable = (ConfigurableCompletionProposal) proposal;
@@ -282,8 +300,8 @@ public class STextProposalProvider extends AbstractSTextProposalProvider {
 		ICompletionProposalAcceptor priorityOptimizer = getCustomAcceptor(model, "real", acceptor);
 
 		String proposalText = "0.1";
-		ICompletionProposal proposal = createCompletionProposal(proposalText, proposalText + " - "
-				+ ruleCall.getRule().getName(), null, context);
+		ICompletionProposal proposal = createCompletionProposal(proposalText,
+				proposalText + " - " + ruleCall.getRule().getName(), null, context);
 		priorityOptimizer.accept(proposal);
 	}
 

+ 3 - 0
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/STextRuntimeModule.java

@@ -16,6 +16,7 @@ import org.eclipse.xtext.linking.ILinker;
 import org.eclipse.xtext.naming.IQualifiedNameProvider;
 import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy;
 import org.eclipse.xtext.validation.CompositeEValidator;
+import org.eclipse.xtext.validation.IResourceValidator;
 import org.yakindu.base.types.inferrer.ITypeSystemInferrer;
 import org.yakindu.base.types.typesystem.GenericTypeSystem;
 import org.yakindu.base.types.typesystem.ITypeSystem;
@@ -24,6 +25,7 @@ import org.yakindu.sct.model.stext.conversion.StextValueConverterService;
 import org.yakindu.sct.model.stext.inferrer.STextTypeInferrer;
 import org.yakindu.sct.model.stext.naming.StextNameProvider;
 import org.yakindu.sct.model.stext.resource.SCTResourceDescriptionStrategy;
+import org.yakindu.sct.model.stext.resource.SCTResourceValidatorImpl;
 import org.yakindu.sct.model.stext.resource.StextResource;
 import org.yakindu.sct.model.stext.scoping.STextGlobalScopeProvider;
 
@@ -44,6 +46,7 @@ public class STextRuntimeModule extends org.yakindu.sct.model.stext.AbstractSTex
 	public void configure(Binder binder) {
 		super.configure(binder);
 		binder.bind(IDefaultResourceDescriptionStrategy.class).to(SCTResourceDescriptionStrategy.class);
+		binder.bind(IResourceValidator.class).to(SCTResourceValidatorImpl.class);
 	}
 	public Class<? extends org.eclipse.xtext.scoping.IGlobalScopeProvider> bindIGlobalScopeProvider() {
 		return STextGlobalScopeProvider.class;

+ 19 - 68
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/STextScopeProvider.java

@@ -20,12 +20,9 @@ import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EReference;
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.xtext.EcoreUtil2;
-import org.eclipse.xtext.resource.IEObjectDescription;
 import org.eclipse.xtext.scoping.IScope;
 import org.eclipse.xtext.scoping.Scopes;
 import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
-import org.eclipse.xtext.scoping.impl.FilteringScope;
-import org.eclipse.xtext.scoping.impl.SimpleScope;
 import org.eclipse.xtext.util.PolymorphicDispatcher.ErrorHandler;
 import org.yakindu.base.expressions.expressions.ElementReferenceExpression;
 import org.yakindu.base.expressions.expressions.Expression;
@@ -40,12 +37,9 @@ import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.model.sgraph.Scope;
 import org.yakindu.sct.model.sgraph.Statechart;
 import org.yakindu.sct.model.sgraph.util.ContextElementAdapter;
-import org.yakindu.sct.model.stext.scoping.ContextPredicateProvider.EmptyPredicate;
 import org.yakindu.sct.model.stext.stext.InterfaceScope;
 import org.yakindu.sct.model.stext.stext.InternalScope;
 
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import com.google.inject.Inject;
 
@@ -60,9 +54,9 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 
 	@Inject
 	private ITypeSystemInferrer typeInferrer;
-	@Inject 
+	@Inject
 	private ITypeSystem typeSystem;
-	
+
 	private static class ErrorHandlerDelegate<T> implements ErrorHandler<T> {
 
 		private ErrorHandler<T> delegate;
@@ -83,7 +77,7 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		}
 
 	}
-	
+
 	@Override
 	public IScope getScope(EObject context, EReference reference) {
 		try {
@@ -98,31 +92,17 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		}
 	}
 
-	@Inject
-	private ContextPredicateProvider predicateProvider;
-
-	/**
-	 * Scoping for types and taking imported namespaces into account e.g. in
-	 * variable declarations.
-	 */
 	public IScope scope_TypeSpecifier_type(final EObject context, EReference reference) {
-		IScope scope = getDelegate().getScope(context, reference);
-		Predicate<IEObjectDescription> predicate = calculateFilterPredicate(context, reference);
-		return new FilteringScope(scope, predicate);
+		return getDelegate().getScope(context, reference);
 	}
 
 	public IScope scope_ElementReferenceExpression_reference(final EObject context, EReference reference) {
-		IScope namdScope = getNamedTopLevelScope(context, reference);
-		IScope unnamedScope = getUnnamedTopLevelScope(context, reference);
-		Predicate<IEObjectDescription> predicate = calculateFilterPredicate(context, reference);
-		unnamedScope = new FilteringScope(unnamedScope, predicate);
-		return new SimpleScope(Iterables.concat(namdScope.getAllElements(), unnamedScope.getAllElements()));
+		IScope scope = getUnnamedTopLevelScope(context, reference);
+		scope = getNamedTopLevelScope(context, reference, scope);
+		return scope;
 	}
 
 	public IScope scope_FeatureCall_feature(final FeatureCall context, EReference reference) {
-
-		Predicate<IEObjectDescription> predicate = calculateFilterPredicate(context, reference);
-
 		Expression owner = context.getOwner();
 		EObject element = null;
 		if (owner instanceof ElementReferenceExpression) {
@@ -138,53 +118,30 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		Type ownerType = result != null ? result.getType() : null;
 
 		if (element instanceof Scope) {
-			scope = Scopes.scopeFor(((Scope) element).getDeclarations());
-			return new FilteringScope(scope, predicate);
-		}else if(ownerType != null){
+			return Scopes.scopeFor(((Scope) element).getDeclarations());
+		} else if (ownerType != null) {
 			scope = Scopes.scopeFor(typeSystem.getPropertyExtensions(ownerType));
-			scope = Scopes.scopeFor(typeSystem.getOperationExtensions(ownerType),scope);
+			scope = Scopes.scopeFor(typeSystem.getOperationExtensions(ownerType), scope);
 		}
-		
+
 		if (ownerType instanceof ComplexType) {
-			return addScopeForComplexType((ComplexType) ownerType, scope, predicate);
+			return addScopeForComplexType((ComplexType) ownerType, scope);
 		}
 		if (ownerType instanceof EnumerationType) {
-			return addScopeForEnumType((EnumerationType) ownerType, scope, predicate);
+			return addScopeForEnumType((EnumerationType) ownerType, scope);
 		}
 		return scope;
 	}
 
-	protected IScope addScopeForEnumType(EnumerationType element, IScope scope, final Predicate<IEObjectDescription> predicate) {
-		scope = Scopes.scopeFor((element).getEnumerator(), scope);
-		scope = new FilteringScope(scope, predicate);
-		return scope;
-	}
-
-	protected IScope addScopeForComplexType(final ComplexType type, IScope scope, final Predicate<IEObjectDescription> predicate) {
-		scope = Scopes.scopeFor(type.getAllFeatures(), scope);
-		scope = new FilteringScope(scope, predicate);
-		return scope;
+	protected IScope addScopeForEnumType(EnumerationType element, IScope scope) {
+		return Scopes.scopeFor((element).getEnumerator(), scope);
 	}
 
-	private Predicate<IEObjectDescription> calculateFilterPredicate(final EObject context, final EReference reference) {
-		Predicate<IEObjectDescription> predicate = null;
-		EObject container = context;
-		EReference ref = reference;
-		while (container != null) {
-			predicate = predicateProvider.getPredicate(container.eClass(), ref);
-			if (!(predicate instanceof EmptyPredicate)) {
-				break;
-			}
-			ref = (EReference) container.eContainingFeature();
-			container = container.eContainer();
-		}
-		return predicate;
+	protected IScope addScopeForComplexType(final ComplexType type, IScope scope) {
+		return Scopes.scopeFor(type.getAllFeatures(), scope);
 	}
 
-	/**
-	 * Returns the toplevel scope
-	 */
-	protected IScope getNamedTopLevelScope(final EObject context, EReference reference) {
+	protected IScope getNamedTopLevelScope(final EObject context, EReference reference, IScope outer) {
 		List<EObject> scopeCandidates = Lists.newArrayList();
 		Statechart statechart = getStatechart(context);
 		if (statechart == null)
@@ -198,12 +155,9 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 				}
 			}
 		}
-		return Scopes.scopeFor(scopeCandidates);
+		return Scopes.scopeFor(scopeCandidates, outer);
 	}
 
-	/**
-	 * Returns a scope with all toplevel declarations of unnamed scope
-	 */
 	protected IScope getUnnamedTopLevelScope(final EObject context, EReference reference) {
 		List<EObject> scopeCandidates = Lists.newArrayList();
 		Statechart statechart = getStatechart(context);
@@ -226,9 +180,6 @@ public class STextScopeProvider extends AbstractDeclarativeScopeProvider {
 		return Scopes.scopeFor(scopeCandidates, scope);
 	}
 
-	/**
-	 * Returns the {@link Statechart} for a context element
-	 */
 	protected Statechart getStatechart(EObject context) {
 		final ContextElementAdapter provider = (ContextElementAdapter) EcoreUtil.getExistingAdapter(context.eResource(),
 				ContextElementAdapter.class);

+ 36 - 27
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/ContextPredicateProvider.java

@@ -8,7 +8,7 @@
  * Contributors:
  *     committers of YAKINDU - initial API and implementation
  */
-package org.yakindu.sct.model.stext.scoping;
+package org.yakindu.sct.model.stext.validation;
 
 import static org.yakindu.base.expressions.expressions.ExpressionsPackage.Literals.ASSIGNMENT_EXPRESSION;
 import static org.yakindu.base.expressions.expressions.ExpressionsPackage.Literals.ASSIGNMENT_EXPRESSION__EXPRESSION;
@@ -32,10 +32,10 @@ import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.EVENT_VALU
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.LOCAL_REACTION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.REACTION_EFFECT;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.REGULAR_EVENT_SPEC;
+import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.STATE_SPECIFICATION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.TRANSITION_REACTION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.TRANSITION_SPECIFICATION;
 import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.VARIABLE_DEFINITION;
-import static org.yakindu.sct.model.stext.stext.StextPackage.Literals.STATE_SPECIFICATION;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -46,10 +46,8 @@ import org.eclipse.emf.ecore.EReference;
 import org.eclipse.xtext.resource.IEObjectDescription;
 import org.eclipse.xtext.util.Pair;
 import org.eclipse.xtext.util.Tuples;
-import org.yakindu.base.types.ComplexType;
-import org.yakindu.base.types.TypedElement;
 import org.yakindu.base.types.TypesPackage;
-import org.yakindu.sct.model.stext.stext.StextPackage;
+import org.yakindu.sct.model.sgraph.SGraphPackage;
 
 import com.google.common.base.Predicate;
 import com.google.common.base.Predicates;
@@ -63,15 +61,18 @@ public class ContextPredicateProvider {
 
 	public static class TypePredicate implements Predicate<IEObjectDescription> {
 		public boolean apply(IEObjectDescription input) {
-			return TypesPackage.Literals.TYPE.isSuperTypeOf(input.getEClass())
-					&& !TypesPackage.Literals.TYPE_PARAMETER.isSuperTypeOf(input.getEClass());
+			EClass eClass = input.getEClass();
+			return TypesPackage.Literals.TYPE.isSuperTypeOf(eClass)
+					&& !TypesPackage.Literals.TYPE_PARAMETER.isSuperTypeOf(eClass);
 		}
 	}
 
 	public static class FeaturedTypePredicate implements Predicate<IEObjectDescription> {
 		public boolean apply(IEObjectDescription input) {
-			return TypesPackage.Literals.TYPE.isSuperTypeOf(input.getEClass())
-					&& TypesPackage.Literals.DECLARATION.isSuperTypeOf(input.getEClass());
+			EClass eClass = input.getEClass();
+			return SGraphPackage.Literals.SCOPE.isSuperTypeOf(eClass)
+					|| (TypesPackage.Literals.TYPE.isSuperTypeOf(eClass)
+							&& TypesPackage.Literals.DECLARATION.isSuperTypeOf(eClass));
 		}
 	}
 
@@ -80,16 +81,7 @@ public class ContextPredicateProvider {
 		public boolean apply(IEObjectDescription input) {
 			if (super.apply(input))
 				return true;
-			return TypesPackage.Literals.EVENT.isSuperTypeOf(input.getEClass()) || isComplexTypeVariable(input);
-		}
-
-		protected boolean isComplexTypeVariable(IEObjectDescription input) {
-			if (StextPackage.Literals.VARIABLE_DEFINITION.isSuperTypeOf(input.getEClass())) {
-				TypedElement definition = (TypedElement) input.getEObjectOrProxy();
-				EObject element = (EObject) definition.eGet(TypesPackage.Literals.TYPED_ELEMENT__TYPE, false);
-				return (element != null && !element.eIsProxy() && definition.getType() instanceof ComplexType);
-			}
-			return false;
+			return TypesPackage.Literals.EVENT.isSuperTypeOf(input.getEClass());
 		}
 	}
 
@@ -108,8 +100,9 @@ public class ContextPredicateProvider {
 		public boolean apply(IEObjectDescription input) {
 			if (super.apply(input))
 				return true;
-			return (TypesPackage.Literals.PROPERTY.isSuperTypeOf(input.getEClass()) || TypesPackage.Literals.OPERATION
-					.isSuperTypeOf(input.getEClass()));
+			EClass eClass = input.getEClass();
+			return (TypesPackage.Literals.PROPERTY.isSuperTypeOf(eClass)
+					|| TypesPackage.Literals.OPERATION.isSuperTypeOf(eClass));
 		}
 	}
 
@@ -118,11 +111,12 @@ public class ContextPredicateProvider {
 		public boolean apply(IEObjectDescription input) {
 			if (super.apply(input))
 				return true;
-			return (TypesPackage.Literals.PROPERTY.isSuperTypeOf(input.getEClass()) //
-					|| TypesPackage.Literals.OPERATION.isSuperTypeOf(input.getEClass()) //
-					|| TypesPackage.Literals.EVENT.isSuperTypeOf(input.getEClass()) //
-					|| TypesPackage.Literals.ENUMERATOR.isSuperTypeOf(input.getEClass()) //
-					|| TypesPackage.Literals.ENUMERATION_TYPE.isSuperTypeOf(input.getEClass()));
+			EClass eClass = input.getEClass();
+			return (TypesPackage.Literals.PROPERTY.isSuperTypeOf(eClass)
+					|| TypesPackage.Literals.OPERATION.isSuperTypeOf(eClass)
+					|| TypesPackage.Literals.EVENT.isSuperTypeOf(eClass)
+					|| TypesPackage.Literals.ENUMERATOR.isSuperTypeOf(eClass)
+					|| TypesPackage.Literals.ENUMERATION_TYPE.isSuperTypeOf(eClass));
 		}
 	}
 
@@ -187,7 +181,7 @@ public class ContextPredicateProvider {
 		filter.put(key(STATE_SPECIFICATION), EVENTS);
 	}
 
-	public Predicate<IEObjectDescription> getPredicate(EClass clazz, EReference reference) {
+	protected Predicate<IEObjectDescription> getPredicate(EClass clazz, EReference reference) {
 		Predicate<IEObjectDescription> predicate = filter.get(key(clazz, reference));
 		if (predicate == null) {
 			predicate = filter.get(key(clazz, null));
@@ -197,4 +191,19 @@ public class ContextPredicateProvider {
 		}
 		return predicate;
 	}
+
+	public Predicate<IEObjectDescription> calculateFilterPredicate(final EObject context, final EReference reference) {
+		Predicate<IEObjectDescription> predicate = null;
+		EObject container = context;
+		EReference ref = reference;
+		while (container != null) {
+			predicate = getPredicate(container.eClass(), ref);
+			if (!(predicate instanceof EmptyPredicate)) {
+				break;
+			}
+			ref = (EReference) container.eContainingFeature();
+			container = container.eContainer();
+		}
+		return predicate;
+	}
 }

+ 89 - 71
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextJavaValidator.java

@@ -33,6 +33,8 @@ import org.eclipse.xtext.naming.QualifiedName;
 import org.eclipse.xtext.nodemodel.ICompositeNode;
 import org.eclipse.xtext.nodemodel.INode;
 import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
+import org.eclipse.xtext.resource.EObjectDescription;
+import org.eclipse.xtext.resource.IEObjectDescription;
 import org.eclipse.xtext.resource.XtextResource;
 import org.eclipse.xtext.validation.Check;
 import org.eclipse.xtext.validation.CheckType;
@@ -54,7 +56,6 @@ import org.yakindu.base.types.Operation;
 import org.yakindu.base.types.Parameter;
 import org.yakindu.base.types.Property;
 import org.yakindu.base.types.TypesPackage;
-import org.yakindu.base.types.annotations.TypeAnnotations;
 import org.yakindu.base.types.inferrer.ITypeSystemInferrer;
 import org.yakindu.sct.domain.extension.DomainRegistry;
 import org.yakindu.sct.model.sgraph.Choice;
@@ -127,44 +128,58 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 	@Inject(optional = true)
 	@Named(DomainRegistry.DOMAIN_ID)
 	private String domainID = BasePackage.Literals.DOMAIN_ELEMENT__DOMAIN_ID.getDefaultValueLiteral();
+	@Inject
+	private ContextPredicateProvider contextPredicateProvider;
 
-	@Check
+	@Check(CheckType.FAST)
+	public void checkContextElement(ElementReferenceExpression expression) {
+		Predicate<IEObjectDescription> predicate = contextPredicateProvider.calculateFilterPredicate(expression,
+				ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE);
+		IEObjectDescription desc = EObjectDescription
+				.create(nameProvider.getFullyQualifiedName(expression.getReference()), expression.getReference());
+		if (!predicate.apply(desc)) {
+			String name = expression.getReference().eClass().getName();
+			error(String.format(ERROR_WRONG_CONTEXT_ELEMENT_MSG, name), null, -1, ERROR_WRONG_CONTEXT_ELEMENT_CODE);
+		}
+	}
+
+	@Check(CheckType.FAST)
 	public void checkExpression(VariableDefinition expression) {
 		if (expression.getType() == null || expression.getType().eIsProxy())
 			return;
 		typeInferrer.infer(expression, this);
 	}
 
-	@Check
+	@Check(CheckType.FAST)
 	public void checkExpression(TimeEventSpec expression) {
 		typeInferrer.infer(expression, this);
 	}
 
-	@Check
+	@Check(CheckType.FAST)
 	public void checkExpression(Guard expression) {
 		typeInferrer.infer(expression, this);
 	}
-	
-	@Check
+
+	@Check(CheckType.FAST)
 	public void checkNoAssignmentInGuard(Guard guard) {
 		TreeIterator<EObject> eAllContents = guard.eAllContents();
-		while(eAllContents.hasNext()) {
+		while (eAllContents.hasNext()) {
 			EObject e = eAllContents.next();
-			if(e instanceof AssignmentExpression) {
+			if (e instanceof AssignmentExpression) {
 				error(GUARD_CONTAINS_ASSIGNMENT, guard, null);
 			}
 		}
 	}
-	
+
 	@Check(CheckType.FAST)
 	public void transitionsWithNoTrigger(Transition trans) {
 
-		if (trans.getSource() instanceof Entry 
-			|| trans.getSource() instanceof Choice
-			|| trans.getSource() instanceof Synchronization
-			|| (trans.getTarget() instanceof Synchronization && (trans.getTarget().getIncomingTransitions().size() > 1))
-			) { return; }
-		
+		if (trans.getSource() instanceof Entry || trans.getSource() instanceof Choice
+				|| trans.getSource() instanceof Synchronization || (trans.getTarget() instanceof Synchronization
+						&& (trans.getTarget().getIncomingTransitions().size() > 1))) {
+			return;
+		}
+
 		if (trans.getSource() instanceof org.yakindu.sct.model.sgraph.State) {
 			org.yakindu.sct.model.sgraph.State state = (org.yakindu.sct.model.sgraph.State) trans.getSource();
 			if (state.isComposite()) {
@@ -217,7 +232,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		Expression varRef = expression.getVarRef();
 		if (varRef instanceof FeatureCall) {
 			EObject referencedObject = ((FeatureCall) varRef).getFeature();
-		 if (!(referencedObject instanceof Property)) {
+			if (!(referencedObject instanceof Property)) {
 				error(LEFT_HAND_ASSIGNMENT, ExpressionsPackage.Literals.ASSIGNMENT_EXPRESSION__VAR_REF);
 			}
 		} else if (varRef instanceof ElementReferenceExpression) {
@@ -326,7 +341,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 
 	}
 
-	@Check(CheckType.FAST)
+	@Check(CheckType.NORMAL)
 	public void checkValueReferenedBeforeDefined(Scope scope) {
 		EList<Declaration> declarations = scope.getDeclarations();
 		Set<QualifiedName> defined = Sets.newHashSet();
@@ -360,7 +375,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		}
 	}
 
-	@Check(CheckType.FAST)
+	@Check(CheckType.NORMAL)
 	public void checkUnusedExit(final Exit exit) {
 		if (exit.getParentRegion().getComposite() instanceof org.yakindu.sct.model.sgraph.State
 				&& exit.getOutgoingTransitions().isEmpty()) {
@@ -443,7 +458,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		}
 	}
 
-	@Check(CheckType.FAST)
+	@Check(CheckType.NORMAL)
 	public void checkUnboundEntryPoints(final org.yakindu.sct.model.sgraph.State state) {
 		if (state.isComposite()) {
 			final List<Transition>[] transitions = STextValidationModelUtils
@@ -496,26 +511,28 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 			}
 		}
 	}
-	@Check(CheckType.FAST)
+
+	@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
+		// 1. check if is toplevel
 		if (isTopLevelRegionEntry) {
 			boolean isDefaultEntry = STextValidationModelUtils.isDefault(entry);
-			//2. check if is default entry
+			// 2. check if is default entry
 			if (!isDefaultEntry) {
-				Map<Region, List<Entry>> regionsWithoutDefaultEntry = STextValidationModelUtils.getRegionsWithoutDefaultEntry(Lists.newArrayList(parentRegion));
+				Map<Region, List<Entry>> regionsWithoutDefaultEntry = STextValidationModelUtils
+						.getRegionsWithoutDefaultEntry(Lists.newArrayList(parentRegion));
 				List<Entry> list = regionsWithoutDefaultEntry.get(parentRegion);
-				if(list!=null)
-					error(TOP_LEVEL_REGION_ENTRY_HAVE_TO_BE_A_DEFAULT_ENTRY, entry,
-							SGraphPackage.Literals.ENTRY__KIND,-1);
+				if (list != null)
+					error(TOP_LEVEL_REGION_ENTRY_HAVE_TO_BE_A_DEFAULT_ENTRY, entry, SGraphPackage.Literals.ENTRY__KIND,
+							-1);
 				else
 					warning(TOP_LEVEL_REGION_ENTRY_HAVE_TO_BE_A_DEFAULT_ENTRY, entry,
-							SGraphPackage.Literals.ENTRY__KIND,-1);
+							SGraphPackage.Literals.ENTRY__KIND, -1);
 			}
 		}
 	}
@@ -564,18 +581,6 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		}
 	}
 
-	private String getVariableName(AssignmentExpression exp) {
-		Expression varRef = exp.getVarRef();
-		if (varRef instanceof ElementReferenceExpression
-				&& ((ElementReferenceExpression) varRef).getReference() instanceof Property) {
-			Property reference = (Property) ((ElementReferenceExpression) varRef).getReference();
-			return reference.getName();
-		} else if (varRef instanceof FeatureCall && ((FeatureCall) varRef).getFeature() instanceof Property) {
-			Property reference = (Property) ((FeatureCall) varRef).getFeature();
-			return reference.getName();
-		}
-		return null;
-	}
 
 	@Check(CheckType.FAST)
 	public void checkFeatureCall(FeatureCall call) {
@@ -655,26 +660,19 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		}
 	}
 
-	protected void checkElementReferenceEffect(ElementReferenceExpression refExp) {
-		if (!(refExp.getReference() instanceof Operation)) {
-			if (refExp.getReference() instanceof Property) {
-				error("Access to property '" + nameProvider.getFullyQualifiedName(refExp.getReference())
-						+ "' has no effect.", refExp,
-						ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE, INSIGNIFICANT_INDEX,
-						FEATURE_CALL_HAS_NO_EFFECT);
-			} else if (refExp.getReference() instanceof Event) {
-				error("Access to event '" + nameProvider.getFullyQualifiedName(refExp.getReference())
-						+ "' has no effect.", refExp,
-						ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE, INSIGNIFICANT_INDEX,
-						FEATURE_CALL_HAS_NO_EFFECT);
-			} else {
-				error("Access to feature '" + nameProvider.getFullyQualifiedName(refExp.getReference())
-						+ "' has no effect.", refExp,
-						ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE, INSIGNIFICANT_INDEX,
-						FEATURE_CALL_HAS_NO_EFFECT);
-			}
+	private String getVariableName(AssignmentExpression exp) {
+		Expression varRef = exp.getVarRef();
+		if (varRef instanceof ElementReferenceExpression
+				&& ((ElementReferenceExpression) varRef).getReference() instanceof Property) {
+			Property reference = (Property) ((ElementReferenceExpression) varRef).getReference();
+			return reference.getName();
+		} else if (varRef instanceof FeatureCall && ((FeatureCall) varRef).getFeature() instanceof Property) {
+			Property reference = (Property) ((FeatureCall) varRef).getFeature();
+			return reference.getName();
 		}
+		return null;
 	}
+	
 
 	@Check(CheckType.FAST)
 	public void checkEventDefinition(EventDefinition event) {
@@ -711,7 +709,7 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		}
 	}
 
-	@Check
+	@Check(CheckType.FAST)
 	public void checkChoiceWithoutDefaultTransition(final Choice choice) {
 		boolean found = false;
 		for (Transition transition : choice.getOutgoingTransitions()) {
@@ -723,8 +721,8 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		if (!found)
 			warning(CHOICE_ONE_OUTGOING_DEFAULT_TRANSITION, SGraphPackage.Literals.VERTEX__OUTGOING_TRANSITIONS);
 	}
-	//TODO Extract TypesValidator
-	@Check
+
+	@Check(CheckType.FAST)
 	public void checkAnnotationTarget(final AnnotatableElement element) {
 		EList<Annotation> annotations = element.getAnnotations();
 		for (Annotation annotation : annotations) {
@@ -742,9 +740,38 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 			}
 		}
 	}
+	
+	@Check(CheckType.FAST)
+	public void checkImportExists(Import importDef) {
+		String namespace = importDef.getImportedNamespace();
+		if (resolver.getPackageForNamespace(getResource(importDef), namespace) == null) {
+			error("The import " + namespace + " cannot be resolved.", importDef,
+					StextPackage.Literals.IMPORT__IMPORTED_NAMESPACE, IMPORT_NOT_RESOLVED);
+		}
+	}
 
-	protected boolean isDefault(Trigger trigger) {
+	protected void checkElementReferenceEffect(ElementReferenceExpression refExp) {
+		if (!(refExp.getReference() instanceof Operation)) {
+			if (refExp.getReference() instanceof Property) {
+				error("Access to property '" + nameProvider.getFullyQualifiedName(refExp.getReference())
+				+ "' has no effect.", refExp,
+				ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE, INSIGNIFICANT_INDEX,
+				FEATURE_CALL_HAS_NO_EFFECT);
+			} else if (refExp.getReference() instanceof Event) {
+				error("Access to event '" + nameProvider.getFullyQualifiedName(refExp.getReference())
+				+ "' has no effect.", refExp,
+				ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE, INSIGNIFICANT_INDEX,
+				FEATURE_CALL_HAS_NO_EFFECT);
+			} else {
+				error("Access to feature '" + nameProvider.getFullyQualifiedName(refExp.getReference())
+				+ "' has no effect.", refExp,
+				ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE, INSIGNIFICANT_INDEX,
+				FEATURE_CALL_HAS_NO_EFFECT);
+			}
+		}
+	}
 
+	protected boolean isDefault(Trigger trigger) {
 		return trigger == null || trigger instanceof DefaultTrigger
 				|| ((trigger instanceof ReactionTrigger) && ((ReactionTrigger) trigger).getTriggers().size() == 0
 						&& ((ReactionTrigger) trigger).getGuard() == null);
@@ -814,15 +841,6 @@ public class STextJavaValidator extends AbstractSTextJavaValidator implements ST
 		return result;
 	}
 
-	@Check(CheckType.FAST)
-	public void checkImportExists(Import importDef) {
-		String namespace = importDef.getImportedNamespace();
-		if (resolver.getPackageForNamespace(getResource(importDef), namespace) == null) {
-			error("The import " + namespace + " cannot be resolved.", importDef,
-					StextPackage.Literals.IMPORT__IMPORTED_NAMESPACE, IMPORT_NOT_RESOLVED);
-		}
-	}
-
 	protected Resource getResource(EObject context) {
 		final ContextElementAdapter provider = (ContextElementAdapter) EcoreUtil.getExistingAdapter(context.eResource(),
 				ContextElementAdapter.class);

+ 2 - 0
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextValidationMessages.java

@@ -53,5 +53,7 @@ public interface STextValidationMessages {
 	public static final String INTERNAL_DECLARATION_UNUSED = "Internal declaration is not used in statechart.";
 	public static final String ERROR_WRONG_ANNOTATION_TARGET_CODE = "WrongAnnotationTarget";
 	public static final String ERROR_WRONG_ANNOTATION_TARGET_MSG = "Annotation '%s' can not be applied on %s ";
+	public static final String ERROR_WRONG_CONTEXT_ELEMENT_MSG = "Element of type '%s' is not allowed in this context.";
+	public static final String ERROR_WRONG_CONTEXT_ELEMENT_CODE = "ElementNotAllowedInContext";
 
 }

+ 1 - 1
plugins/org.yakindu.sct.simulation.core/model/sruntime.ecore

@@ -50,6 +50,6 @@
   </eClassifiers>
   <eClassifiers xsi:type="ecore:EDataType" name="JavaObject" instanceClassName="java.lang.Object"/>
   <eClassifiers xsi:type="ecore:EClass" name="ReferenceSlot" eSuperTypes="#//CompositeSlot">
-    <eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="#//CompositeSlot"/>
+    <eStructuralFeatures xsi:type="ecore:EReference" name="reference" eType="#//ExecutionSlot"/>
   </eClassifiers>
 </ecore:EPackage>

+ 4 - 4
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/ReferenceSlot.java

@@ -18,10 +18,10 @@ package org.yakindu.sct.simulation.core.sruntime;
  *
  * <p>
  * The following features are supported:
+ * </p>
  * <ul>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.ReferenceSlot#getReference <em>Reference</em>}</li>
  * </ul>
- * </p>
  *
  * @see org.yakindu.sct.simulation.core.sruntime.SRuntimePackage#getReferenceSlot()
  * @model
@@ -37,12 +37,12 @@ public interface ReferenceSlot extends CompositeSlot {
 	 * </p>
 	 * <!-- end-user-doc -->
 	 * @return the value of the '<em>Reference</em>' reference.
-	 * @see #setReference(CompositeSlot)
+	 * @see #setReference(ExecutionSlot)
 	 * @see org.yakindu.sct.simulation.core.sruntime.SRuntimePackage#getReferenceSlot_Reference()
 	 * @model
 	 * @generated
 	 */
-	CompositeSlot getReference();
+	ExecutionSlot getReference();
 
 	/**
 	 * Sets the value of the '{@link org.yakindu.sct.simulation.core.sruntime.ReferenceSlot#getReference <em>Reference</em>}' reference.
@@ -52,6 +52,6 @@ public interface ReferenceSlot extends CompositeSlot {
 	 * @see #getReference()
 	 * @generated
 	 */
-	void setReference(CompositeSlot value);
+	void setReference(ExecutionSlot value);
 
 } // ReferenceSlot

+ 22 - 11
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/ReferenceSlotImpl.java

@@ -27,10 +27,10 @@ import org.yakindu.sct.simulation.core.sruntime.SRuntimePackage;
  * <!-- end-user-doc -->
  * <p>
  * The following features are implemented:
+ * </p>
  * <ul>
  *   <li>{@link org.yakindu.sct.simulation.core.sruntime.impl.ReferenceSlotImpl#getReference <em>Reference</em>}</li>
  * </ul>
- * </p>
  *
  * @generated
  */
@@ -43,7 +43,7 @@ public class ReferenceSlotImpl extends CompositeSlotImpl implements ReferenceSlo
 	 * @generated
 	 * @ordered
 	 */
-	protected CompositeSlot reference;
+	protected ExecutionSlot reference;
 
 	/**
 	 * <!-- begin-user-doc -->
@@ -69,10 +69,10 @@ public class ReferenceSlotImpl extends CompositeSlotImpl implements ReferenceSlo
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public CompositeSlot getReference() {
+	public ExecutionSlot getReference() {
 		if (reference != null && reference.eIsProxy()) {
 			InternalEObject oldReference = (InternalEObject)reference;
-			reference = (CompositeSlot)eResolveProxy(oldReference);
+			reference = (ExecutionSlot)eResolveProxy(oldReference);
 			if (reference != oldReference) {
 				if (eNotificationRequired())
 					eNotify(new ENotificationImpl(this, Notification.RESOLVE, SRuntimePackage.REFERENCE_SLOT__REFERENCE, oldReference, reference));
@@ -86,7 +86,7 @@ public class ReferenceSlotImpl extends CompositeSlotImpl implements ReferenceSlo
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public CompositeSlot basicGetReference() {
+	public ExecutionSlot basicGetReference() {
 		return reference;
 	}
 
@@ -95,8 +95,8 @@ public class ReferenceSlotImpl extends CompositeSlotImpl implements ReferenceSlo
 	 * <!-- end-user-doc -->
 	 * @generated
 	 */
-	public void setReference(CompositeSlot newReference) {
-		CompositeSlot oldReference = reference;
+	public void setReference(ExecutionSlot newReference) {
+		ExecutionSlot oldReference = reference;
 		reference = newReference;
 		if (eNotificationRequired())
 			eNotify(new ENotificationImpl(this, Notification.SET, SRuntimePackage.REFERENCE_SLOT__REFERENCE, oldReference, reference));
@@ -126,7 +126,7 @@ public class ReferenceSlotImpl extends CompositeSlotImpl implements ReferenceSlo
 	public void eSet(int featureID, Object newValue) {
 		switch (featureID) {
 			case SRuntimePackage.REFERENCE_SLOT__REFERENCE:
-				setReference((CompositeSlot)newValue);
+				setReference((ExecutionSlot)newValue);
 				return;
 		}
 		super.eSet(featureID, newValue);
@@ -141,7 +141,7 @@ public class ReferenceSlotImpl extends CompositeSlotImpl implements ReferenceSlo
 	public void eUnset(int featureID) {
 		switch (featureID) {
 			case SRuntimePackage.REFERENCE_SLOT__REFERENCE:
-				setReference((CompositeSlot)null);
+				setReference((ExecutionSlot)null);
 				return;
 		}
 		super.eUnset(featureID);
@@ -166,10 +166,21 @@ public class ReferenceSlotImpl extends CompositeSlotImpl implements ReferenceSlo
 	 */
 	@Override
 	public List<ExecutionSlot> getSlots() {
-		if (getReference() != null) {
-			return getReference().getSlots();
+		if (getReference() != null && getReference() instanceof CompositeSlot) {
+			return ((CompositeSlot)getReference()).getSlots();
 		}
 		return super.getSlots();
 	}
+	
+	/**
+	 * @generated NOT
+	 */
+	@Override
+	public Object getValue() {
+		if (getReference() != null) {
+			return getReference().getValue();
+		}
+		return super.getValue();
+	}
 
 } //ReferenceSlotImpl

+ 3 - 3
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/SRuntimePackageImpl.java

@@ -19,6 +19,7 @@ import org.eclipse.emf.ecore.EPackage;
 import org.eclipse.emf.ecore.EReference;
 import org.eclipse.emf.ecore.impl.EPackageImpl;
 import org.yakindu.base.base.BasePackage;
+import org.yakindu.base.types.TypesPackage;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.simulation.core.sruntime.CompositeSlot;
 import org.yakindu.sct.simulation.core.sruntime.EventDirection;
@@ -141,7 +142,6 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 
 		// Initialize simple dependencies
 		SGraphPackage.eINSTANCE.eClass();
-		org.yakindu.base.types.TypesPackage.eINSTANCE.eClass();
 
 		// Create package meta-data objects
 		theSRuntimePackage.createPackageContents();
@@ -433,7 +433,7 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 		// Obtain other dependent packages
 		BasePackage theBasePackage = (BasePackage)EPackage.Registry.INSTANCE.getEPackage(BasePackage.eNS_URI);
 		SGraphPackage theSGraphPackage = (SGraphPackage)EPackage.Registry.INSTANCE.getEPackage(SGraphPackage.eNS_URI);
-		org.yakindu.base.types.TypesPackage theTypesPackage = (org.yakindu.base.types.TypesPackage)EPackage.Registry.INSTANCE.getEPackage(org.yakindu.base.types.TypesPackage.eNS_URI);
+		TypesPackage theTypesPackage = (TypesPackage)EPackage.Registry.INSTANCE.getEPackage(TypesPackage.eNS_URI);
 
 		// Create type parameters
 
@@ -493,7 +493,7 @@ public class SRuntimePackageImpl extends EPackageImpl implements SRuntimePackage
 		initEReference(getCompositeSlot_Slots(), this.getExecutionSlot(), null, "slots", null, 0, -1, CompositeSlot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
 		initEClass(referenceSlotEClass, ReferenceSlot.class, "ReferenceSlot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
-		initEReference(getReferenceSlot_Reference(), this.getCompositeSlot(), null, "reference", null, 0, 1, ReferenceSlot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+		initEReference(getReferenceSlot_Reference(), this.getExecutionSlot(), null, "reference", null, 0, 1, ReferenceSlot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
 
 		// Initialize enums and add enum literals
 		initEEnum(eventDirectionEEnum, EventDirection.class, "EventDirection");

+ 11 - 1
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/ExecutionContextLabelProvider.java

@@ -19,6 +19,7 @@ import org.yakindu.sct.simulation.core.sruntime.CompositeSlot;
 import org.yakindu.sct.simulation.core.sruntime.ExecutionEvent;
 import org.yakindu.sct.simulation.core.sruntime.ExecutionSlot;
 import org.yakindu.sct.simulation.core.sruntime.ExecutionVariable;
+import org.yakindu.sct.simulation.core.sruntime.ReferenceSlot;
 import org.yakindu.sct.simulation.ui.SimulationImages;
 
 /**
@@ -48,7 +49,16 @@ public class ExecutionContextLabelProvider extends StyledCellLabelProvider {
 
 	private void updateValueCell(ViewerCell cell) {
 		Object element = cell.getElement();
-		if (element instanceof ExecutionSlot) {
+		if (element instanceof ReferenceSlot) {
+			ReferenceSlot refSlot = (ReferenceSlot) element;
+			String label = "";
+			if (refSlot.getReference() != null) {
+				String refFqn = refSlot.getReference().getFqName();
+				Object refValue = refSlot.getReference().getValue();
+				label = refValue != null ? refFqn + " = " + refValue : refFqn;
+			}
+			cell.setText(label);
+		} else if (element instanceof ExecutionSlot) {
 			Object value = ((ExecutionSlot) element).getValue();
 			if (value != null) {
 				if (((ExecutionSlot) element).getType().getOriginType() instanceof EnumerationType) {

+ 5 - 1
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/EnumerationEditingSupport.java

@@ -73,7 +73,11 @@ public class EnumerationEditingSupport extends ScopeSlotEditingSupport {
 		if (element instanceof ExecutionSlot) {
 			if (!((ExecutionSlot) element).isWritable())
 				return false;
-			Type type = ((ExecutionSlot) element).getType().getOriginType();
+			
+			Type type = ((ExecutionSlot) element).getType();
+			if (type != null) {
+				type = type.getOriginType();
+			}
 			return type instanceof EnumerationType;
 		}
 		return false;

+ 13 - 1
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/view/editing/MultiEditingSupport.java

@@ -13,6 +13,8 @@ package org.yakindu.sct.simulation.ui.view.editing;
 import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.jface.viewers.ColumnViewer;
 import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.yakindu.sct.simulation.core.sruntime.ExecutionSlot;
 /**
  * 
  * @author andreas muelder - Initial contribution and API
@@ -32,6 +34,9 @@ public class MultiEditingSupport extends EditingSupport {
 
 	@Override
 	protected boolean canEdit(Object element) {
+		if (element instanceof ExecutionSlot && !((ExecutionSlot) element).isWritable()) {
+			return false;
+		}
 		for (PublicEditingSupport current : support) {
 			if (current.canEdit(element)) {
 				currentActive = current;
@@ -60,6 +65,13 @@ public class MultiEditingSupport extends EditingSupport {
 		return support;
 	}
 	
-	
+	@Override
+	protected void initializeCellEditorValue(CellEditor cellEditor, ViewerCell cell) {
+		try {
+			super.initializeCellEditorValue(cellEditor, cell);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
 
 }

+ 6 - 3
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/editor/ResourceSetValidationListener.java

@@ -43,15 +43,18 @@ public class ResourceSetValidationListener extends ResourceSetListenerImpl {
 				EObject eObject = (EObject) notification.getNotifier();
 				if (eObject.eClass().getEPackage() == SGraphPackage.eINSTANCE) {
 					validationJob.cancel();
-					if (liveValidationEnabled())
+					if (liveValidationEnabled()) {
 						validationJob.schedule(DELAY);
+						break;
+					}
 				} else
 					for (EClass eClass : eObject.eClass().getEAllSuperTypes()) {
 						if (SGraphPackage.eINSTANCE == eClass.getEPackage()) {
 							validationJob.cancel();
-							if (liveValidationEnabled())
+							if (liveValidationEnabled()) {
 								validationJob.schedule(DELAY);
-							return;
+								return;
+							}
 						}
 					}
 			}

+ 20 - 9
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/validation/SCTValidationJob.java

@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.emf.common.util.WrappedException;
@@ -56,7 +57,6 @@ public class SCTValidationJob extends Job implements IMarkerType {
 
 	private Resource resource;
 
-	
 	/**
 	 * Wrappes the {@link IResourceValidator} validate within a
 	 * {@link RunnableWithResult} to execute within a read only transaction
@@ -81,9 +81,13 @@ public class SCTValidationJob extends Job implements IMarkerType {
 		}
 
 		public void run() {
-			List<Issue> result = validator.validate(resource, checkMode, indicator);
-			setResult(result);
-			setStatus(Status.OK_STATUS);
+			try {
+				List<Issue> result = validator.validate(resource, checkMode, indicator);
+				setResult(result);
+				setStatus(Status.OK_STATUS);
+			} catch (OperationCanceledException ex) {
+				setStatus(Status.CANCEL_STATUS);
+			}
 		}
 	}
 
@@ -94,6 +98,7 @@ public class SCTValidationJob extends Job implements IMarkerType {
 
 	@Override
 	public IStatus run(final IProgressMonitor monitor) {
+//		long t = System.currentTimeMillis();
 		try {
 			if (!resource.isLoaded())
 				return Status.CANCEL_STATUS;
@@ -103,7 +108,7 @@ public class SCTValidationJob extends Job implements IMarkerType {
 			if (monitor.isCanceled())
 				return Status.CANCEL_STATUS;
 			TransactionalValidationRunner runner = new TransactionalValidationRunner(validator, resource,
-					CheckMode.ALL, new CancelIndicator() {
+					CheckMode.FAST_ONLY, new CancelIndicator() {
 						public boolean isCanceled() {
 							return monitor.isCanceled();
 
@@ -112,7 +117,12 @@ public class SCTValidationJob extends Job implements IMarkerType {
 			TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(resource);
 			if (editingDomain == null)
 				return Status.CANCEL_STATUS;
-			editingDomain.runExclusive(runner);
+			try {
+				editingDomain.runExclusive(runner);
+			} catch (Throwable ex) {
+				//Since xtext 2.8 this may throw an OperationCanceledError
+				return Status.CANCEL_STATUS;
+			}
 			final List<Issue> issues = runner.getResult();
 			if (issues == null)
 				return Status.CANCEL_STATUS;
@@ -123,6 +133,7 @@ public class SCTValidationJob extends Job implements IMarkerType {
 			ex.printStackTrace();
 			return new Status(IStatus.ERROR, DiagramActivator.PLUGIN_ID, ex.getMessage());
 		}
+//		System.out.println("Validation took " + (System.currentTimeMillis() - t));
 		return Status.OK_STATUS;
 	}
 
@@ -131,7 +142,7 @@ public class SCTValidationJob extends Job implements IMarkerType {
 	 * problem markers // will flicker otherwise
 	 */
 	private void refreshMarkers(final IFile target, final List<Issue> issues, final IProgressMonitor monitor) {
-		PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+		PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
 			public void run() {
 				try {
 					target.deleteMarkers(SCT_MARKER_TYPE, true, IResource.DEPTH_ZERO);
@@ -152,8 +163,8 @@ public class SCTValidationJob extends Job implements IMarkerType {
 	 */
 	protected void relinkModel(final IProgressMonitor monitor, final AbstractSCTResource eResource)
 			throws ExecutionException {
-		AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(
-				TransactionUtil.getEditingDomain(eResource), "", null) {
+		AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(TransactionUtil.getEditingDomain(eResource),
+				"", null) {
 			@Override
 			protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
 					throws ExecutionException {

+ 3 - 7
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/AllTests.java

@@ -22,13 +22,9 @@ import org.yakindu.sct.model.stext.test.validation.TransitionsWithNoTriggerTest;
  * 
  */
 @RunWith(value = Suite.class)
-@SuiteClasses(value = { 
-		TypeInferrerTest.class, 
-		StextParserRuleTest.class,
-		TestModelsContainErrorsTest.class, 
-		SCTUnitClassifierTest.class, 
-		STextJavaValidatorTest.class, 
-		TransitionsWithNoTriggerTest.class })
+@SuiteClasses(value = { TypeInferrerTest.class, StextParserRuleTest.class, TestModelsContainErrorsTest.class,
+		SCTUnitClassifierTest.class, STextJavaValidatorTest.class, TransitionsWithNoTriggerTest.class,
+		ContextPredicateProviderTest.class })
 
 public class AllTests {
 }

+ 246 - 0
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/ContextPredicateProviderTest.java

@@ -0,0 +1,246 @@
+/** 
+ * Copyright (c) 2015 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.stext.test;
+
+import java.util.Arrays;
+
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.junit4.validation.AssertableDiagnostics;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.yakindu.base.expressions.expressions.Expression;
+import org.yakindu.sct.model.stext.stext.LocalReaction;
+import org.yakindu.sct.model.stext.stext.ReactionEffect;
+import org.yakindu.sct.model.stext.stext.ReactionTrigger;
+import org.yakindu.sct.model.stext.stext.VariableDefinition;
+import org.yakindu.sct.model.stext.test.util.STextInjectorProvider;
+import org.yakindu.sct.model.stext.test.validation.AbstractSTextValidationTest;
+import org.yakindu.sct.model.stext.validation.ContextPredicateProvider;
+import org.yakindu.sct.model.stext.validation.STextValidationMessages;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * @author Johannes Dicks - Add tests covering {@link ContextPredicateProvider}
+ */
+@RunWith(Parameterized.class)
+public class ContextPredicateProviderTest extends AbstractSTextValidationTest {
+
+	public static final String INTERNAL_SCOPE = "" + //
+			"internal: " + //
+			"	in event e1 : void" + //
+			"	in event e2 : void" + //
+			"	var myInt : integer" + //
+			"	var myBool : boolean" + //
+			"	operation myOpp(param1 : integer) : void" + //
+			"	operation myOpp3() : integer" + //
+			"	operation myOpp4() : boolean" + //
+			"	operation myOpp5() : integer";
+
+	public static final String INTERFACE_SCOPE = "" + //
+			"interface Interface1:" + //
+			"	in event e3 : void" + //
+			"	in event e4 : void" + //
+			"	var myInt2 : integer" + //
+			"	var myBool2 : boolean" + //
+			"	operation myOpp2(param1 : integer) : void";
+
+	public static final String INTERFACE_SCOPE_AND_INTERNAL_SCOPE = INTERNAL_SCOPE + "\n" + INTERFACE_SCOPE;
+
+	private String statement;
+	private String ruleName;
+	private String scopes;
+	private boolean valid;
+
+	public ContextPredicateProviderTest(String statement, String ruleName, String scopes, Boolean isLinkable) {
+		this.statement = statement;
+		this.ruleName = ruleName;
+		this.scopes = scopes;
+		this.valid = isLinkable;
+
+		STextInjectorProvider provider = new STextInjectorProvider();
+		provider.getInjector().injectMembers(this);
+	}
+
+	@Test
+	public void test() {
+		EObject expression = parseExpression(statement, ruleName, scopes);
+		AssertableDiagnostics validationResult = tester.validate(expression);
+		if (!valid) {
+			validationResult.assertAny(AssertableDiagnostics.errorCode(STextValidationMessages.ERROR_WRONG_CONTEXT_ELEMENT_CODE));
+		} else {
+			validationResult.assertOK();
+		}
+	}
+
+	/**
+	 * @see {@link ContextPredicateProvider#filter}
+	 */
+	@Parameters(name = "{index}: {0} in rule {1} expected to be invalid = {3}")
+	public static Iterable<Object[]> data1() {
+		return Arrays.asList(new Object[][] { //
+				/* testGuardScopingSuccess */
+				{ "[e1]", ReactionTrigger.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "[Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE, true }, //
+				{ "[e1 && e2]", ReactionTrigger.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "[e1 && Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "[Interface1.e4 && Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE, true }, //
+				/*
+				 * filter.put(key(ASSIGNMENT_EXPRESSION),
+				 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
+				 */
+				{ "myInt = 0", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myInt = Interface1.myInt2", ReactionEffect.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myInt = myOpp3()", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myBool = e1", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				/*
+				 * filter.put(key(CONDITIONAL_EXPRESSION),
+				 * VARIABLES_AND_OPERATIONS)
+				 */
+				{ "myBool ? myOpp(1) : myOpp(2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myOpp4() ? myInt : myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
+				{ "myBool ? e1 : myOpp(2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				/*
+				 * filter.put(key(LOGICAL_OR_EXPRESSION),
+				 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
+				 */
+				{ "myBool || Interface1.myBool2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myBool || myOpp4()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myBool || e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				/*
+				 * filter.put(key(LOGICAL_AND_EXPRESSION),
+				 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
+				 */
+				{ "myBool && Interface1.myBool2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myBool && myOpp4()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myBool && e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				/*
+				 * filter.put(key(BITWISE_XOR_EXPRESSION), VARIABLES)
+				 */
+				{ "myInt ^ Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "e1 ^ e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				{ "myOpp(1) ^ myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				/*
+				 * filter.put(key(BITWISE_OR_EXPRESSION), VARIABLES)
+				 */
+				{ "myInt | Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "e1 | e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				{ "myOpp(1) | myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				/*
+				 * filter.put(key(BITWISE_AND_EXPRESSION), VARIABLES)
+				 */
+				{ "myInt & Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "e1 & e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				{ "myOpp(1) & myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				/*
+				 * filter.put(key(SHIFT_EXPRESSION), VARIABLES)
+				 */
+				{ "myInt << Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myInt >> Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "e1 >> e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				{ "e1 >> e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				{ "myOpp(1) >> myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				{ "myOpp(1) << myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				/*
+				 * filter.put(key(LOGICAL_NOT_EXPRESSION),
+				 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
+				 */
+				{ "!Interface1.myBool2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true }, //
+				{ "!myOpp4()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "!e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				/*
+				 * filter.put(key(LOGICAL_RELATION_EXPRESSION),
+				 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
+				 */
+				{ "myInt < Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myInt < myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myInt > Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myInt > myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myInt <= Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myInt <= myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myInt >= Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myInt >= myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myInt == Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myInt == myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myInt != Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myInt != myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				/*
+				 * filter.put(key(NUMERICAL_ADD_SUBTRACT_EXPRESSION),
+				 * VARIABLES_AND_OPERATIONS)
+				 */
+				{ "myInt + Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myInt - Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myOpp3() + myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myInt - myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myOpp3() + myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myOpp3() - myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "e1 + e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				{ "e1 - e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				/*
+				 * filter.put(key(NUMERICAL_MULTIPLY_DIVIDE_EXPRESSION),
+				 * VARIABLES_AND_OPERATIONS)
+				 */
+				{ "myInt * Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myInt / Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE,
+						true }, //
+				{ "myOpp3() * myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myInt / myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myOpp3() * myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "e1 * e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				{ "e1 / e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				/*
+				 * filter.put(key(NUMERICAL_UNARY_EXPRESSION),
+				 * VARIABLES_AND_OPERATIONS)
+				 */
+				{ "-myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "+myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "-myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "+myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "-e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				{ "+e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				/*
+				 * filter.put(key(EVENT_VALUE_REFERENCE_EXPRESSION), EVENTS)
+				 */
+				{ "valueof(e2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "valueof(myInt)", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				{ "valueof(myOpp3())", Expression.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				/*
+				 * filter.put(key(VARIABLE_DEFINITION, TYPED_ELEMENT__TYPE),
+				 * TYPES)
+				 */
+				{ "var x : integer", VariableDefinition.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				/* filter.put(key(REGULAR_EVENT_SPEC), EVENTS) */
+				{ "e1 / myInt = 0", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, true }, //
+				{ "myOpp(4) / myInt = 10", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+				{ "myInt / myInt = 10", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, false }, //
+		});
+	}
+}

+ 0 - 237
test-plugins/org.yakindu.sct.model.stext.test/src/org/yakindu/sct/model/stext/test/STextScopeProviderTest.java

@@ -1,237 +0,0 @@
-/** 
- * Copyright (c) 2015 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.stext.test;
-
-import static org.junit.Assert.fail;
-
-import java.util.Arrays;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.yakindu.base.expressions.expressions.Expression;
-import org.yakindu.sct.model.stext.expressions.STextExpressionParser.LinkingException;
-import org.yakindu.sct.model.stext.scoping.ContextPredicateProvider;
-import org.yakindu.sct.model.stext.stext.LocalReaction;
-import org.yakindu.sct.model.stext.stext.ReactionEffect;
-import org.yakindu.sct.model.stext.stext.ReactionTrigger;
-import org.yakindu.sct.model.stext.stext.VariableDefinition;
-import org.yakindu.sct.model.stext.test.util.AbstractSTextTest;
-import org.yakindu.sct.model.stext.test.util.STextInjectorProvider;
-
-/**
- * @author andreas muelder - Initial contribution and API
- * @author Johannes Dicks - Add tests covering {@link ContextPredicateProvider}
- */
-@RunWith(Parameterized.class)
-public class STextScopeProviderTest extends AbstractSTextTest {
-
-	public static final String INTERNAL_SCOPE = "" + //
-			"internal: " + //
-			"	in event e1 : void" + //
-			"	in event e2 : void" + //
-			"	var myInt : integer" + //
-			"	var myBool : boolean" + //
-			"	operation myOpp(param1 : integer) : void" + //
-			"	operation myOpp3() : integer" + //
-			"	operation myOpp4() : boolean" + //
-			"	operation myOpp5() : integer";
-
-	public static final String INTERFACE_SCOPE = "" + //
-			"interface Interface1:" + //
-			"	in event e3 : void" + //
-			"	in event e4 : void" + //
-			"	var myInt2 : integer" + //
-			"	var myBool2 : boolean" + //
-			"	operation myOpp2(param1 : integer) : void";
-
-	public static final String INTERFACE_SCOPE_AND_INTERNAL_SCOPE = INTERNAL_SCOPE + "\n" + INTERFACE_SCOPE;
-
-	private String statement;
-	private String ruleName;
-	private String scopes;
-	private boolean isLinkable;
-	
-	public STextScopeProviderTest(String statement, String ruleName, String scopes, Boolean isLinkable) {
-		this.statement = statement;
-		this.ruleName = ruleName;
-		this.scopes = scopes;
-		this.isLinkable = isLinkable;
-
-		STextInjectorProvider provider = new STextInjectorProvider();
-		provider.getInjector().injectMembers(this);
-	}
-
-	@Test
-	public void test() {
-		try {
-			parseExpression(statement, ruleName, scopes);
-			if (!isLinkable)
-				fail(String.format(
-						"Expected not to be linkable [parse '%s' in rule '%s' for scope '%s' expected linkable = '%s']",
-						statement, ruleName, scopes, isLinkable));
-		} catch (LinkingException e) {
-			if (isLinkable)
-				throw new RuntimeException("Expected linkable but : "+e.getMessage(),e);
-		}
-	}
-
-	/**
-	 * @see {@link ContextPredicateProvider#filter}
-	 */
-	@Parameters(name = "{index}: parse {0} in rule {1} expected linkable = {3}")
-	public static Iterable<Object[]> data1() {
-		return Arrays
-				.asList(new Object[][]{//
-						/* testGuardScopingSuccess */
-						{"[e1]", ReactionTrigger.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"[Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE, true}, //
-						{"[e1 && e2]", ReactionTrigger.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"[e1 && Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"[Interface1.e4 && Interface1.e3]", ReactionTrigger.class.getSimpleName(), INTERFACE_SCOPE, true}, //
-						/*
-						 * filter.put(key(ASSIGNMENT_EXPRESSION),
-						 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
-						 */
-						{"myInt = 0", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt = Interface1.myInt2", ReactionEffect.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt = myOpp3()", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myBool = e1", ReactionEffect.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						/*
-						 * filter.put(key(CONDITIONAL_EXPRESSION),
-						 * VARIABLES_AND_OPERATIONS)
-						 */
-						{"myBool ? myOpp(1) : myOpp(2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myOpp4() ? myInt : myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myBool ? e1 : myOpp(2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						/*
-						 * filter.put(key(LOGICAL_OR_EXPRESSION),
-						 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
-						 */
-						{"myInt || Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt || myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt || e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						/*
-						 * filter.put(key(LOGICAL_AND_EXPRESSION),
-						 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
-						 */
-						{"myInt && Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt && myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt && e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						/*
-						 * filter.put(key(BITWISE_XOR_EXPRESSION), VARIABLES)
-						 */
-						{"myInt ^ Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"e1 ^ e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						{"myOpp1(1) ^ myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						/*
-						 * filter.put(key(BITWISE_OR_EXPRESSION), VARIABLES)
-						 */
-						{"myInt | Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"e1 | e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						{"myOpp1(1) | myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						/*
-						 * filter.put(key(BITWISE_AND_EXPRESSION), VARIABLES)
-						 */
-						{"myInt & Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"e1 & e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						{"myOpp1(1) & myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						/*
-						 * filter.put(key(SHIFT_EXPRESSION), VARIABLES)
-						 */
-						{"myInt << Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt >> Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"e1 >> e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						{"e1 >> e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						{"myOpp1(1) >> myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						{"myOpp1(1) << myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						/*
-						 * filter.put(key(LOGICAL_NOT_EXPRESSION),
-						 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
-						 */
-						{"!Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"!myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"!e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						/*
-						 * filter.put(key(LOGICAL_RELATION_EXPRESSION),
-						 * VARIABLES_OPERATIONS_EVENTS_ENUMERATORS)
-						 */
-						{"myInt < Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt < myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt < e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt > Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt > myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt > e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt <= Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt <= myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt <= e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt >= Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt >= myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt >= e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt == Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt == myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt == e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt != Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt != myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt != e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						/*
-						 * filter.put(key(NUMERICAL_ADD_SUBTRACT_EXPRESSION),
-						 * VARIABLES_AND_OPERATIONS)
-						 */
-						{"myInt + Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt - Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myOpp3() + myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt - myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myOpp3() + myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myOpp3() - myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"e1 + e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						{"e1 - e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						/*
-						 * filter.put(key(NUMERICAL_MULTIPLY_DIVIDE_EXPRESSION),
-						 * VARIABLES_AND_OPERATIONS)
-						 */
-						{"myInt * Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myInt / Interface1.myInt2", Expression.class.getSimpleName(), INTERFACE_SCOPE_AND_INTERNAL_SCOPE, true}, //
-						{"myOpp3() * myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myInt / myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myOpp3() * myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"e1 * e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						{"e1 / e2", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						/*
-						 * filter.put(key(NUMERICAL_UNARY_EXPRESSION),
-						 * VARIABLES_AND_OPERATIONS)
-						 */
-						{"-myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"+myInt", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"-myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"+myOpp3()", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"-e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						{"+e1", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						/*
-						 * filter.put(key(EVENT_VALUE_REFERENCE_EXPRESSION), EVENTS)
-						 */
-						{"valueof(e2)", Expression.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"valueof(myInt)", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						{"valueof(myOpp3())", Expression.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						/*
-						 * filter.put(key(VARIABLE_DEFINITION, TYPED_ELEMENT__TYPE),
-						 * TYPES)
-						 */
-						{"var x : integer", VariableDefinition.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"var x : e1", VariableDefinition.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						/* filter.put(key(REGULAR_EVENT_SPEC), EVENTS) */
-						{"e1 / myInt = 0", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, true}, //
-						{"myOpp(4) / myInt = 10", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-						{"myInt / myInt = 10", LocalReaction.class.getSimpleName(), INTERNAL_SCOPE, false}, //
-		});
-	}
-}

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

@@ -347,6 +347,11 @@ public class STextJavaValidatorTest extends AbstractSTextValidationTest implemen
 	public void checkExpression() {
 		// Nothing to do
 	}
+	
+	@Test
+	public void checkContextElement(){
+		//Nothing to do -> this is covered by ContextPredicateProviderTest
+	}
 
 	/**
 	 * checks tht each @Check method of {@link STextJavaValidator} has a @Test