Search in sources :

Example 6 with GExpression

use of org.eclipse.gemoc.gexpressions.GExpression in project gemoc-studio by eclipse.

the class TestXtextSerializer2 method loadGexpressionTestFile.

public static void loadGexpressionTestFile() {
    // Getting the serializer
    GExpressionsStandaloneSetup setup = new GExpressionsStandaloneSetup();
    Injector injector = setup.createInjectorAndDoEMFRegistration();
    GexpressionsPackage.eINSTANCE.eClass();
    Serializer serializer = injector.getInstance(Serializer.class);
    // Load the model
    URI modelURI = URI.createFileURI("/home/flatombe/thesis/gemoc/git/gemoc-dev/org/eclipse/gemoc/GEL/org.eclipse.gemoc.gel.gexpressions.test/model/test.gexpressions");
    XtextResourceSet resSet = injector.getInstance(XtextResourceSet.class);
    resSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
    Resource resource = resSet.getResource(modelURI, true);
    GProgram program = (GProgram) resource.getContents().get(0);
    List<GExpression> exps = program.getExpressions();
    for (GExpression exp : exps) {
        // Serializing
        String s = serializer.serialize(exp);
        System.out.println(s);
    }
}
Also used : GExpression(org.eclipse.gemoc.gexpressions.GExpression) Injector(com.google.inject.Injector) XtextResourceSet(org.eclipse.xtext.resource.XtextResourceSet) GProgram(org.eclipse.gemoc.gexpressions.GProgram) XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) URI(org.eclipse.emf.common.util.URI) GExpressionsStandaloneSetup(org.eclipse.gemoc.gexpressions.xtext.GExpressionsStandaloneSetup) Serializer(org.eclipse.xtext.serializer.impl.Serializer)

Example 7 with GExpression

use of org.eclipse.gemoc.gexpressions.GExpression in project gemoc-studio by eclipse.

the class GUnaryOperatorExpressionImpl method basicSetOperand.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetOperand(GExpression newOperand, NotificationChain msgs) {
    GExpression oldOperand = operand;
    operand = newOperand;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GexpressionsPackage.GUNARY_OPERATOR_EXPRESSION__OPERAND, oldOperand, newOperand);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : GExpression(org.eclipse.gemoc.gexpressions.GExpression) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 8 with GExpression

use of org.eclipse.gemoc.gexpressions.GExpression in project gemoc-studio by eclipse.

the class GIfExpressionImpl method basicSetElseExpression.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetElseExpression(GExpression newElseExpression, NotificationChain msgs) {
    GExpression oldElseExpression = elseExpression;
    elseExpression = newElseExpression;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GexpressionsPackage.GIF_EXPRESSION__ELSE_EXPRESSION, oldElseExpression, newElseExpression);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : GExpression(org.eclipse.gemoc.gexpressions.GExpression) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 9 with GExpression

use of org.eclipse.gemoc.gexpressions.GExpression in project gemoc-studio by eclipse.

the class GIfExpressionImpl method basicSetThenExpression.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetThenExpression(GExpression newThenExpression, NotificationChain msgs) {
    GExpression oldThenExpression = thenExpression;
    thenExpression = newThenExpression;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GexpressionsPackage.GIF_EXPRESSION__THEN_EXPRESSION, oldThenExpression, newThenExpression);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : GExpression(org.eclipse.gemoc.gexpressions.GExpression) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Aggregations

GExpression (org.eclipse.gemoc.gexpressions.GExpression)9 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)8 Injector (com.google.inject.Injector)1 URI (org.eclipse.emf.common.util.URI)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 GProgram (org.eclipse.gemoc.gexpressions.GProgram)1 GExpressionsStandaloneSetup (org.eclipse.gemoc.gexpressions.xtext.GExpressionsStandaloneSetup)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1 XtextResourceSet (org.eclipse.xtext.resource.XtextResourceSet)1 Serializer (org.eclipse.xtext.serializer.impl.Serializer)1