use of org.eclipse.xtext.scoping.IScopeProvider in project xtext-core by eclipse.
the class URINormalizationTest method testGetElementByClasspathURIEObject.
@Test
public void testGetElementByClasspathURIEObject() throws Exception {
with(ImportUriTestLanguageStandaloneSetup.class);
Main main = (Main) getModel("import 'classpath:/org/eclipse/xtext/linking/05.importuritestlanguage'\n" + "type Bar extends Foo");
Type bar = main.getTypes().get(0);
Type foo = bar.getExtends();
assertNotNull(foo);
assertFalse(foo.eIsProxy());
// they are partially normalized
if (Platform.isRunning()) {
assertEquals("bundleresource", EcoreUtil.getURI(foo).scheme());
} else {
assertEquals("file", EcoreUtil.getURI(foo).scheme());
}
IScopeProvider scopeProvider = get(IScopeProvider.class);
IScope scope = scopeProvider.getScope(bar, ImportedURIPackage.Literals.TYPE__EXTENDS);
Iterable<IEObjectDescription> elements = scope.getElements(foo);
assertEquals(1, size(elements));
assertEquals(EcoreUtil2.getPlatformResourceOrNormalizedURI(foo), elements.iterator().next().getEObjectURI());
}
Aggregations