Search in sources :

Example 11 with FeatureCall

use of org.yakindu.base.expressions.expressions.FeatureCall in project statecharts by Yakindu.

the class STextJavaValidator method checkValueOfNoEvent.

@Check(CheckType.FAST)
public void checkValueOfNoEvent(EventValueReferenceExpression exp) {
    Expression eventExpr = exp.getValue();
    EObject element = null;
    if (eventExpr instanceof ElementReferenceExpression) {
        element = ((ElementReferenceExpression) eventExpr).getReference();
    } else if (eventExpr instanceof FeatureCall) {
        element = ((FeatureCall) eventExpr).getFeature();
    }
    if (element != null && (!(element instanceof Event))) {
        String elementName = "";
        if (element instanceof NamedElement) {
            elementName = "'" + ((NamedElement) element).getName() + "' ";
        }
        error(elementName + "is no event.", StextPackage.Literals.EVENT_VALUE_REFERENCE_EXPRESSION__VALUE, 0, VALUE_OF_REQUIRES_EVENT);
    }
}
Also used : EventRaisingExpression(org.yakindu.sct.model.stext.stext.EventRaisingExpression) Expression(org.yakindu.base.expressions.expressions.Expression) AssignmentExpression(org.yakindu.base.expressions.expressions.AssignmentExpression) EventValueReferenceExpression(org.yakindu.sct.model.stext.stext.EventValueReferenceExpression) ElementReferenceExpression(org.yakindu.base.expressions.expressions.ElementReferenceExpression) PostFixUnaryExpression(org.yakindu.base.expressions.expressions.PostFixUnaryExpression) EObject(org.eclipse.emf.ecore.EObject) ExitEvent(org.yakindu.sct.model.stext.stext.ExitEvent) EntryEvent(org.yakindu.sct.model.stext.stext.EntryEvent) Event(org.yakindu.base.types.Event) ElementReferenceExpression(org.yakindu.base.expressions.expressions.ElementReferenceExpression) FeatureCall(org.yakindu.base.expressions.expressions.FeatureCall) NamedElement(org.yakindu.base.base.NamedElement) Check(org.eclipse.xtext.validation.Check)

Aggregations

FeatureCall (org.yakindu.base.expressions.expressions.FeatureCall)11 ElementReferenceExpression (org.yakindu.base.expressions.expressions.ElementReferenceExpression)9 EObject (org.eclipse.emf.ecore.EObject)8 Expression (org.yakindu.base.expressions.expressions.Expression)6 AssignmentExpression (org.yakindu.base.expressions.expressions.AssignmentExpression)5 Check (org.eclipse.xtext.validation.Check)4 NamedElement (org.yakindu.base.base.NamedElement)4 PostFixUnaryExpression (org.yakindu.base.expressions.expressions.PostFixUnaryExpression)4 EventRaisingExpression (org.yakindu.sct.model.stext.stext.EventRaisingExpression)3 EventValueReferenceExpression (org.yakindu.sct.model.stext.stext.EventValueReferenceExpression)3 InterfaceScope (org.yakindu.sct.model.stext.stext.InterfaceScope)3 Execution (org.yakindu.sct.model.sexec.Execution)2 InternalScope (org.yakindu.sct.model.stext.stext.InternalScope)2 VariableDefinition (org.yakindu.sct.model.stext.stext.VariableDefinition)2 ArrayList (java.util.ArrayList)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Keyword (org.eclipse.xtext.Keyword)1 QualifiedName (org.eclipse.xtext.naming.QualifiedName)1 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)1 IScope (org.eclipse.xtext.scoping.IScope)1