Search in sources :

Example 26 with IEObjectDescription

use of org.eclipse.xtext.resource.IEObjectDescription in project xtext-eclipse by eclipse.

the class AbstractConstructorScopeTest method testGetElementByName_05.

@Test
public void testGetElementByName_05() {
    IEObjectDescription objectElement = getConstructorScope().getSingleElement(QualifiedName.create(List.class.getName()));
    assertNull(objectElement);
}
Also used : IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Example 27 with IEObjectDescription

use of org.eclipse.xtext.resource.IEObjectDescription in project xtext-eclipse by eclipse.

the class AbstractConstructorScopeTest method testGetElementsByName_03.

@Test
public void testGetElementsByName_03() {
    List<String> segments = Strings.split("org.eclipse.xtext.common.types.testSetups.NestedParameterizedTypes.WrappedCollection.WrappedIterator", '.');
    QualifiedName qualifiedName = QualifiedName.create(segments);
    Iterable<IEObjectDescription> descriptions = getConstructorScope().getElements(qualifiedName);
    for (IEObjectDescription description : descriptions) {
        assertEquals(qualifiedName, description.getName());
    }
    assertEquals(3, Iterables.size(descriptions));
}
Also used : QualifiedName(org.eclipse.xtext.naming.QualifiedName) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Example 28 with IEObjectDescription

use of org.eclipse.xtext.resource.IEObjectDescription in project xtext-eclipse by eclipse.

the class AbstractConstructorScopeTest method testGetElementByName_06.

@Test
public void testGetElementByName_06() {
    IEObjectDescription hashMapEntry = getConstructorScope().getSingleElement(QualifiedName.create("java", "util", "Hashtable$Entry"));
    assertNotNull(hashMapEntry);
    assertFalse(hashMapEntry.getEObjectOrProxy().eIsProxy());
    assertEquals(TypesPackage.Literals.JVM_CONSTRUCTOR, hashMapEntry.getEClass());
    assertEquals(QualifiedName.create("java", "util", "Hashtable$Entry"), hashMapEntry.getName());
}
Also used : IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Example 29 with IEObjectDescription

use of org.eclipse.xtext.resource.IEObjectDescription in project xtext-eclipse by eclipse.

the class AbstractConstructorScopeTest method testGetElementsByName_01.

@Test
public void testGetElementsByName_01() {
    Iterable<IEObjectDescription> descriptions = getConstructorScope().getElements(QualifiedName.create("java", "util", "Hashtable$Entry"));
    IEObjectDescription hashMapEntry = Iterables.getOnlyElement(descriptions);
    assertNotNull(hashMapEntry);
    assertFalse(hashMapEntry.getEObjectOrProxy().eIsProxy());
    assertEquals(TypesPackage.Literals.JVM_CONSTRUCTOR, hashMapEntry.getEClass());
    assertEquals(QualifiedName.create("java", "util", "Hashtable$Entry"), hashMapEntry.getName());
}
Also used : IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Example 30 with IEObjectDescription

use of org.eclipse.xtext.resource.IEObjectDescription in project xtext-eclipse by eclipse.

the class AbstractConstructorScopeTest method testGetElementByInstance_02.

@Test
public void testGetElementByInstance_02() {
    JvmVoid voidType = TypesFactory.eINSTANCE.createJvmVoid();
    IEObjectDescription element = getConstructorScope().getSingleElement(voidType);
    assertNull(element);
}
Also used : JvmVoid(org.eclipse.xtext.common.types.JvmVoid) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) Test(org.junit.Test)

Aggregations

IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)324 Test (org.junit.Test)95 EObject (org.eclipse.emf.ecore.EObject)82 QualifiedName (org.eclipse.xtext.naming.QualifiedName)79 IScope (org.eclipse.xtext.scoping.IScope)56 URI (org.eclipse.emf.common.util.URI)41 IResourceDescription (org.eclipse.xtext.resource.IResourceDescription)33 EClass (org.eclipse.emf.ecore.EClass)30 Resource (org.eclipse.emf.ecore.resource.Resource)28 EObjectDescription (org.eclipse.xtext.resource.EObjectDescription)22 AliasedEObjectDescription (org.eclipse.xtext.resource.impl.AliasedEObjectDescription)22 ArrayList (java.util.ArrayList)19 IResourceDescriptions (org.eclipse.xtext.resource.IResourceDescriptions)14 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)12 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)12 StyledString (org.eclipse.jface.viewers.StyledString)12 XtextResource (org.eclipse.xtext.resource.XtextResource)11 StringInputStream (org.eclipse.xtext.util.StringInputStream)11 EReference (org.eclipse.emf.ecore.EReference)10 List (java.util.List)9