Search in sources :

Example 1 with Foo

use of org.eclipse.xtext.metamodelreferencing.tests.anotherSimpleTest.Foo in project xtext-core by eclipse.

the class MetamodelRefTestLanguageSemanticSequencer method sequence.

@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
    EPackage epackage = semanticObject.eClass().getEPackage();
    ParserRule rule = context.getParserRule();
    Action action = context.getAssignedAction();
    Set<Parameter> parameters = context.getEnabledBooleanParameters();
    if (epackage == AnotherSimpleTestPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case AnotherSimpleTestPackage.FOO:
                sequence_Foo(context, (Foo) semanticObject);
                return;
        }
    else if (epackage == XtextPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case XtextPackage.PARSER_RULE:
                sequence_MyRule(context, (ParserRule) semanticObject);
                return;
            case XtextPackage.RULE_CALL:
                sequence_NameRef(context, (RuleCall) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Foo(org.eclipse.xtext.metamodelreferencing.tests.anotherSimpleTest.Foo) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Example 2 with Foo

use of org.eclipse.xtext.metamodelreferencing.tests.anotherSimpleTest.Foo in project xtext-core by eclipse.

the class MetamodelRefTest method testStuff.

@Test
public void testStuff() throws Exception {
    Foo parse = (Foo) getModelAndExpect("foo bar", 1);
    assertEquals(1, parse.getNameRefs().size());
}
Also used : Foo(org.eclipse.xtext.metamodelreferencing.tests.anotherSimpleTest.Foo) Test(org.junit.Test)

Aggregations

Foo (org.eclipse.xtext.metamodelreferencing.tests.anotherSimpleTest.Foo)2 EPackage (org.eclipse.emf.ecore.EPackage)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 Test (org.junit.Test)1