Search in sources :

Example 1 with UnresolvedProxyProperty

use of org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty in project xtext-core by eclipse.

the class BasicLazyLinkingTest method testBug281775_02.

@Test
public void testBug281775_02() throws Exception {
    String model = "type A {\n" + "  unresolved A B a;\n" + "}\n" + "type B {\n" + "  unresolved B A b;\n" + "}";
    XtextResource resource = getResource(new StringInputStream(model));
    Model m = (Model) resource.getContents().get(0);
    Type t1 = m.getTypes().get(0);
    assertEquals("A", t1.getName());
    Type t2 = m.getTypes().get(1);
    assertEquals("B", t2.getName());
    UnresolvedProxyProperty propA = t1.getUnresolvedProxyProperty().get(0);
    assertEquals(2, propA.getType().size());
    assertEquals(t1, propA.getType().get(0));
    assertEquals(t2, propA.getType().get(1));
    UnresolvedProxyProperty propB = t2.getUnresolvedProxyProperty().get(0);
    assertEquals(2, propB.getType().size());
    assertEquals(t2, propB.getType().get(0));
    assertEquals(t1, propB.getType().get(1));
}
Also used : StringInputStream(org.eclipse.xtext.util.StringInputStream) Type(org.eclipse.xtext.linking.lazy.lazyLinking.Type) Model(org.eclipse.xtext.linking.lazy.lazyLinking.Model) XtextResource(org.eclipse.xtext.resource.XtextResource) UnresolvedProxyProperty(org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty) Test(org.junit.Test)

Example 2 with UnresolvedProxyProperty

use of org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty in project xtext-core by eclipse.

the class LazyLinkingTestLanguageSemanticSequencer 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 == LazyLinkingPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case LazyLinkingPackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
            case LazyLinkingPackage.PROPERTY:
                sequence_Property(context, (Property) semanticObject);
                return;
            case LazyLinkingPackage.TYPE:
                sequence_Type(context, (Type) semanticObject);
                return;
            case LazyLinkingPackage.UNRESOLVED_PROXY_PROPERTY:
                sequence_UnresolvedProxyProperty(context, (UnresolvedProxyProperty) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) Type(org.eclipse.xtext.linking.lazy.lazyLinking.Type) Model(org.eclipse.xtext.linking.lazy.lazyLinking.Model) Parameter(org.eclipse.xtext.Parameter) UnresolvedProxyProperty(org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty) UnresolvedProxyProperty(org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty) Property(org.eclipse.xtext.linking.lazy.lazyLinking.Property) EPackage(org.eclipse.emf.ecore.EPackage)

Aggregations

Model (org.eclipse.xtext.linking.lazy.lazyLinking.Model)2 Type (org.eclipse.xtext.linking.lazy.lazyLinking.Type)2 UnresolvedProxyProperty (org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty)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 Property (org.eclipse.xtext.linking.lazy.lazyLinking.Property)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1 StringInputStream (org.eclipse.xtext.util.StringInputStream)1 Test (org.junit.Test)1