use of org.eclipse.xtext.linking.lazy.lazyLinking.Property in project xtext-core by eclipse.
the class BasicLazyLinkingTest method testLazyMultiRefDuplicates.
@Test
public void testLazyMultiRefDuplicates() throws Exception {
XtextResource resource = getResource(new StringInputStream("type A {} type B { A B A a; }"));
Model m = (Model) resource.getContents().get(0);
Type t1 = m.getTypes().get(0);
Type t2 = m.getTypes().get(1);
Property property = t2.getProperties().get(0);
EList<Type> types = property.getType();
assertEquals(t1, types.get(0));
assertEquals(t2, types.get(1));
assertEquals(t1, types.get(2));
assertEquals(t1, types.get(0));
assertEquals(t2, types.get(1));
assertEquals(t1, types.get(2));
}
use of org.eclipse.xtext.linking.lazy.lazyLinking.Property in project xtext-core by eclipse.
the class BasicLazyLinkingTest method testBug281775_01.
@Test
public void testBug281775_01() throws Exception {
String model = "type A {\n" + " A B a;\n" + "}\n" + "type B {\n" + " 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());
Property propA = t1.getProperties().get(0);
assertEquals(2, propA.getType().size());
assertEquals(t1, propA.getType().get(0));
assertEquals(t2, propA.getType().get(1));
Property propB = t2.getProperties().get(0);
assertEquals(2, propB.getType().size());
assertEquals(t2, propB.getType().get(0));
assertEquals(t1, propB.getType().get(1));
}
use of org.eclipse.xtext.linking.lazy.lazyLinking.Property in project xtext-core by eclipse.
the class LazyLinkingResourceTest method testResolveLazyCrossReferences_02.
@Test
public void testResolveLazyCrossReferences_02() throws Exception {
with(lazyLinkingTestLangaugeSetup());
ResourceSetImpl rs = new ResourceSetImpl();
final Resource res1 = rs.createResource(URI.createURI("file1.lazylinkingtestlanguage"));
Resource res2 = rs.createResource(URI.createURI("file2.lazylinkingtestlanguage"));
res1.load(new StringInputStream("type Foo { } type Baz { Foo Bar prop; } }"), null);
res2.load(new StringInputStream("type Bar { }"), null);
res1.eAdapters().add(notificationAlert);
Model m = (Model) res1.getContents().get(0);
Type t = m.getTypes().get(1);
Property p = t.getProperties().get(0);
final InternalEList<Type> types = (InternalEList<Type>) p.getType();
assertEquals(2, types.size());
for (Iterator<Type> it = types.basicIterator(); it.hasNext(); ) {
final Type tt = it.next();
assertTrue(tt.eIsProxy());
}
((LazyLinkingResource) res1).resolveLazyCrossReferences(CancelIndicator.NullImpl);
assertFalse(types.basicGet(0).eIsProxy());
assertTrue(types.basicGet(1).eIsProxy());
res1.eAdapters().remove(notificationAlert);
EcoreUtil.resolveAll(res1);
assertFalse(types.basicGet(0).eIsProxy());
assertFalse(types.basicGet(1).eIsProxy());
}
Aggregations