Search in sources :

Example 1 with EntityWithEnumAndReference

use of org.eclipse.xtext.enumrules.enumAndReferenceTestLanguage.EntityWithEnumAndReference in project xtext-core by eclipse.

the class EnumAndReferenceTestLanguageSemanticSequencer 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 == EnumAndReferenceTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case EnumAndReferenceTestLanguagePackage.ENTITY_WITH_ENUM_AND_REFERENCE:
                sequence_EntityWithEnumAndReference(context, (EntityWithEnumAndReference) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage) EntityWithEnumAndReference(org.eclipse.xtext.enumrules.enumAndReferenceTestLanguage.EntityWithEnumAndReference)

Example 2 with EntityWithEnumAndReference

use of org.eclipse.xtext.enumrules.enumAndReferenceTestLanguage.EntityWithEnumAndReference in project xtext-core by eclipse.

the class EntityWithEnumAndReferenceImpl method setRef.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setRef(EntityWithEnumAndReference newRef) {
    EntityWithEnumAndReference oldRef = ref;
    ref = newRef;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, EnumAndReferenceTestLanguagePackage.ENTITY_WITH_ENUM_AND_REFERENCE__REF, oldRef, ref));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) EntityWithEnumAndReference(org.eclipse.xtext.enumrules.enumAndReferenceTestLanguage.EntityWithEnumAndReference)

Example 3 with EntityWithEnumAndReference

use of org.eclipse.xtext.enumrules.enumAndReferenceTestLanguage.EntityWithEnumAndReference in project xtext-core by eclipse.

the class EnumAndReferenceTest method testNodes.

@Test
public void testNodes() throws Exception {
    String modelAsString = "kindOfKeyword Hoo reference Hoo";
    EntityWithEnumAndReference model = (EntityWithEnumAndReference) helper.getModel(modelAsString);
    ICompositeNode node = NodeModelUtils.getNode(model);
    assertNotNull(node);
    // 3 hidden WS + 4 visible LeafNodes
    assertTrue(Iterables.size(node.getChildren()) == 7);
}
Also used : ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) EntityWithEnumAndReference(org.eclipse.xtext.enumrules.enumAndReferenceTestLanguage.EntityWithEnumAndReference) Test(org.junit.Test)

Example 4 with EntityWithEnumAndReference

use of org.eclipse.xtext.enumrules.enumAndReferenceTestLanguage.EntityWithEnumAndReference in project xtext-core by eclipse.

the class EnumAndReferenceTest method testSemantic.

@Test
public void testSemantic() throws Exception {
    String modelAsString = "kindOfKeyword Hoo reference Hoo";
    EntityWithEnumAndReference model = (EntityWithEnumAndReference) helper.getModel(modelAsString);
    assertNotNull(model);
    assertEquals("Hoo", model.getName());
    assertNotNull(model.getRef());
    assertEquals(model, model.getRef());
}
Also used : EntityWithEnumAndReference(org.eclipse.xtext.enumrules.enumAndReferenceTestLanguage.EntityWithEnumAndReference) Test(org.junit.Test)

Aggregations

EntityWithEnumAndReference (org.eclipse.xtext.enumrules.enumAndReferenceTestLanguage.EntityWithEnumAndReference)4 Test (org.junit.Test)2 EPackage (org.eclipse.emf.ecore.EPackage)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)1