Search in sources :

Example 1 with GexpressionsFactory

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

the class TestXtextSerializer method main.

public static void main(String[] args) {
    // Getting the serializer
    GExpressionsStandaloneSetup setup = new GExpressionsStandaloneSetup();
    Injector injector = setup.createInjectorAndDoEMFRegistration();
    Serializer serializer = injector.getInstance(Serializer.class);
    // Creating a model
    GexpressionsFactory factory = GexpressionsFactory.eINSTANCE;
    GAdditionExpression exp = factory.createGAdditionExpression();
    GIntegerExpression un = factory.createGIntegerExpression();
    un.setValue(1);
    GStringExpression deux = factory.createGStringExpression();
    deux.setValue("deux");
    exp.setLeftOperand(un);
    exp.setRightOperand(deux);
    // Serializing
    String s = serializer.serialize(exp);
    System.out.println(s);
}
Also used : GexpressionsFactory(org.eclipse.gemoc.gexpressions.GexpressionsFactory) Injector(com.google.inject.Injector) GStringExpression(org.eclipse.gemoc.gexpressions.GStringExpression) GIntegerExpression(org.eclipse.gemoc.gexpressions.GIntegerExpression) GAdditionExpression(org.eclipse.gemoc.gexpressions.GAdditionExpression) GExpressionsStandaloneSetup(org.eclipse.gemoc.gexpressions.xtext.GExpressionsStandaloneSetup) Serializer(org.eclipse.xtext.serializer.impl.Serializer)

Aggregations

Injector (com.google.inject.Injector)1 GAdditionExpression (org.eclipse.gemoc.gexpressions.GAdditionExpression)1 GIntegerExpression (org.eclipse.gemoc.gexpressions.GIntegerExpression)1 GStringExpression (org.eclipse.gemoc.gexpressions.GStringExpression)1 GexpressionsFactory (org.eclipse.gemoc.gexpressions.GexpressionsFactory)1 GExpressionsStandaloneSetup (org.eclipse.gemoc.gexpressions.xtext.GExpressionsStandaloneSetup)1 Serializer (org.eclipse.xtext.serializer.impl.Serializer)1