Search in sources :

Example 6 with Property

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

the class TracingSugarTest method __generateTypeWithDebugging.

public StringConcatenationClient __generateTypeWithDebugging(final Type it) {
    StringConcatenationClient _client = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            _builder.append("Class ");
            IGeneratorNode __name = TracingSugarTest.this._myExtensions._name(it);
            _builder.append(__name);
            _builder.append(" {");
            _builder.newLineIfNotEmpty();
            {
                EList<Property> _properties = it.getProperties();
                for (final Property p : _properties) {
                    _builder.append("\t");
                    IGeneratorNode __generateProperty = TracingSugarTest.this._generateProperty(p);
                    _builder.append(__generateProperty, "\t");
                    _builder.newLineIfNotEmpty();
                }
            }
            _builder.append("}");
            _builder.newLine();
        }
    };
    return _client;
}
Also used : IGeneratorNode(org.eclipse.xtext.generator.trace.node.IGeneratorNode) EList(org.eclipse.emf.common.util.EList) StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) UnresolvedProxyProperty(org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty) Property(org.eclipse.xtext.linking.lazy.lazyLinking.Property)

Example 7 with Property

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

the class TracingSugarTest method __generateType.

public StringConcatenationClient __generateType(final Type it) {
    StringConcatenationClient _client = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            _builder.append("Class ");
            IGeneratorNode __name = TracingSugarTest.this._myExtensions._name(it);
            _builder.append(__name);
            _builder.append(" {");
            _builder.newLineIfNotEmpty();
            {
                EList<Property> _properties = it.getProperties();
                for (final Property p : _properties) {
                    _builder.append("\t");
                    IGeneratorNode __generateProperty = TracingSugarTest.this._generateProperty(p);
                    _builder.append(__generateProperty, "\t");
                    _builder.newLineIfNotEmpty();
                }
            }
            _builder.append("}");
            _builder.newLine();
        }
    };
    return _client;
}
Also used : IGeneratorNode(org.eclipse.xtext.generator.trace.node.IGeneratorNode) EList(org.eclipse.emf.common.util.EList) StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) UnresolvedProxyProperty(org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty) Property(org.eclipse.xtext.linking.lazy.lazyLinking.Property)

Example 8 with Property

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

the class TracingSugarTest method __generateTypeWithDebugging02.

public StringConcatenationClient __generateTypeWithDebugging02(final Type it) {
    StringConcatenationClient _client = new StringConcatenationClient() {

        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
            _builder.append("Class ");
            IGeneratorNode __name = TracingSugarTest.this._myExtensions._name(it);
            _builder.append(__name);
            _builder.append(" {");
            _builder.newLineIfNotEmpty();
            {
                EList<Property> _properties = it.getProperties();
                for (final Property p : _properties) {
                    _builder.append("\t");
                    IGeneratorNode __generatePropertyWithDebugging = TracingSugarTest.this._generatePropertyWithDebugging(p);
                    _builder.append(__generatePropertyWithDebugging, "\t");
                    _builder.newLineIfNotEmpty();
                }
            }
            _builder.append("}");
            _builder.newLine();
        }
    };
    return _client;
}
Also used : IGeneratorNode(org.eclipse.xtext.generator.trace.node.IGeneratorNode) EList(org.eclipse.emf.common.util.EList) StringConcatenationClient(org.eclipse.xtend2.lib.StringConcatenationClient) UnresolvedProxyProperty(org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty) Property(org.eclipse.xtext.linking.lazy.lazyLinking.Property)

Example 9 with Property

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

the class BasicLazyLinkingTest method testLazyMultiRef.

@Test
public void testLazyMultiRef() throws Exception {
    XtextResource resource = getResource(new StringInputStream("type A {} type B { A B a; }"));
    Model m = (Model) resource.getContents().get(0);
    Type t2 = m.getTypes().get(1);
    Property property = t2.getProperties().get(0);
    EList<Type> types = property.getType();
    assertTrue(((InternalEObject) ((InternalEList<Type>) types).basicGet(0)).eIsProxy());
    assertTrue(((InternalEObject) ((InternalEList<Type>) types).basicGet(0)).eIsProxy());
    assertFalse(((InternalEObject) types.get(0)).eIsProxy());
    assertFalse(((InternalEObject) types.get(1)).eIsProxy());
}
Also used : StringInputStream(org.eclipse.xtext.util.StringInputStream) Type(org.eclipse.xtext.linking.lazy.lazyLinking.Type) Model(org.eclipse.xtext.linking.lazy.lazyLinking.Model) InternalEList(org.eclipse.emf.ecore.util.InternalEList) XtextResource(org.eclipse.xtext.resource.XtextResource) UnresolvedProxyProperty(org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty) Property(org.eclipse.xtext.linking.lazy.lazyLinking.Property) Test(org.junit.Test)

Example 10 with Property

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

the class BasicLazyLinkingTest method doTest.

private void doTest(XtextResource resource) {
    assertTrue(resource instanceof LazyLinkingResource);
    Model model = (Model) resource.getContents().get(0);
    Type typeA = model.getTypes().get(0);
    Type typeB = model.getTypes().get(1);
    Property parentId = typeA.getParentId();
    assertEquals(typeB.getProperties().get(0), parentId);
}
Also used : Type(org.eclipse.xtext.linking.lazy.lazyLinking.Type) Model(org.eclipse.xtext.linking.lazy.lazyLinking.Model) UnresolvedProxyProperty(org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty) Property(org.eclipse.xtext.linking.lazy.lazyLinking.Property)

Aggregations

Property (org.eclipse.xtext.linking.lazy.lazyLinking.Property)13 UnresolvedProxyProperty (org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty)11 Model (org.eclipse.xtext.linking.lazy.lazyLinking.Model)7 Type (org.eclipse.xtext.linking.lazy.lazyLinking.Type)6 EList (org.eclipse.emf.common.util.EList)5 Test (org.junit.Test)5 XtextResource (org.eclipse.xtext.resource.XtextResource)4 StringInputStream (org.eclipse.xtext.util.StringInputStream)4 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)3 IGeneratorNode (org.eclipse.xtext.generator.trace.node.IGeneratorNode)3 InternalEList (org.eclipse.emf.ecore.util.InternalEList)2 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)2 Adapter (org.eclipse.emf.common.notify.Adapter)1 EPackage (org.eclipse.emf.ecore.EPackage)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 ResourceSetImpl (org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)1 Action (org.eclipse.xtext.Action)1 IGrammarAccess (org.eclipse.xtext.IGrammarAccess)1 Parameter (org.eclipse.xtext.Parameter)1