Search in sources :

Example 1 with ModelFeatures

use of org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.ModelFeatures in project xtext-core by eclipse.

the class UnassignedRuleCallTestLanguageSemanticSequencer 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 == UnassignedRuleCallTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case UnassignedRuleCallTestLanguagePackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case UnassignedRuleCallTestLanguagePackage.MODEL_FEATURES:
                sequence_ModelFeatures(context, (ModelFeatures) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) ModelFeatures(org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.ModelFeatures) Model(org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.Model) Parameter(org.eclipse.xtext.Parameter) EPackage(org.eclipse.emf.ecore.EPackage)

Example 2 with ModelFeatures

use of org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.ModelFeatures in project xtext-core by eclipse.

the class UnassignedRuleCallTest method testNodeModel_02.

@Test
public void testNodeModel_02() throws Exception {
    String modelAsText = "model 7 13 137 feature Foo 1 keyword 1 'bar';";
    Model model = (Model) getModel(modelAsText);
    ICompositeNode node = NodeModelUtils.getNode(model);
    assertEquals(8, Iterables.size(node.getChildren()));
    ModelFeatures modelFeatures = model.getModelFeatures();
    ICompositeNode featuresNode = NodeModelUtils.getNode(modelFeatures);
    assertSame(featuresNode, Iterables.get(node.getChildren(), 7));
    assertEquals(6, Iterables.size(featuresNode.getChildren()));
    ICompositeNode dataTypeNode = (ICompositeNode) Iterables.get(featuresNode.getChildren(), 4);
    assertEquals(8, Iterables.size(dataTypeNode.getChildren()));
}
Also used : ModelFeatures(org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.ModelFeatures) Model(org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.Model) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) Test(org.junit.Test)

Example 3 with ModelFeatures

use of org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.ModelFeatures in project xtext-core by eclipse.

the class ModelImpl method basicSetModelFeatures.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetModelFeatures(ModelFeatures newModelFeatures, NotificationChain msgs) {
    ModelFeatures oldModelFeatures = modelFeatures;
    modelFeatures = newModelFeatures;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UnassignedRuleCallTestLanguagePackage.MODEL__MODEL_FEATURES, oldModelFeatures, newModelFeatures);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ModelFeatures(org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.ModelFeatures) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 4 with ModelFeatures

use of org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.ModelFeatures in project xtext-core by eclipse.

the class UnassignedRuleCallTest method testNodeModel_01.

@Test
public void testNodeModel_01() throws Exception {
    String modelAsText = "model 7 feature Zonk 1 keyword 1;";
    Model model = (Model) getModel(modelAsText);
    ICompositeNode node = NodeModelUtils.getNode(model);
    assertEquals(4, Iterables.size(node.getChildren()));
    ModelFeatures modelFeatures = model.getModelFeatures();
    ICompositeNode featuresNode = NodeModelUtils.getNode(modelFeatures);
    assertSame(featuresNode, Iterables.get(node.getChildren(), 3));
    assertEquals(6, Iterables.size(featuresNode.getChildren()));
    ICompositeNode dataTypeNode = (ICompositeNode) Iterables.get(featuresNode.getChildren(), 4);
    assertEquals(6, Iterables.size(dataTypeNode.getChildren()));
}
Also used : ModelFeatures(org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.ModelFeatures) Model(org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.Model) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) Test(org.junit.Test)

Aggregations

ModelFeatures (org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.ModelFeatures)4 Model (org.eclipse.xtext.xtext.ecoreInference.unassignedRuleCallTestLanguage.Model)3 ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)2 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