use of org.eclipse.xtext.resource.IResourceDescriptions in project xtext-core by eclipse.
the class ImportUriGlobalScopeProvider method getScope.
@Override
protected IScope getScope(Resource resource, boolean ignoreCase, EClass type, Predicate<IEObjectDescription> filter) {
final LinkedHashSet<URI> uniqueImportURIs = getImportedUris(resource);
IResourceDescriptions descriptions = getResourceDescriptions(resource, uniqueImportURIs);
List<URI> urisAsList = Lists.newArrayList(uniqueImportURIs);
Collections.reverse(urisAsList);
IScope scope = IScope.NULLSCOPE;
for (URI uri : urisAsList) {
scope = createLazyResourceScope(scope, uri, descriptions, type, filter, ignoreCase);
}
return scope;
}
use of org.eclipse.xtext.resource.IResourceDescriptions in project xtext-core by eclipse.
the class LiveShadowedChunkedContainerTest method assertGlobalDescriptionsAreUnaffected.
private void assertGlobalDescriptionsAreUnaffected() {
IResourceDescriptions _globalDescriptions = this.liveShadowedChunkedResourceDescriptions.getGlobalDescriptions();
final Function1<IEObjectDescription, String> _function = (IEObjectDescription it) -> {
return it.getQualifiedName().toString();
};
Assert.assertEquals("foo", IterableExtensions.join(IterableExtensions.<IEObjectDescription, String>map(((ChunkedResourceDescriptions) _globalDescriptions).getContainer("foo").getExportedObjects(), _function), ","));
IResourceDescriptions _globalDescriptions_1 = this.liveShadowedChunkedResourceDescriptions.getGlobalDescriptions();
final Function1<IEObjectDescription, String> _function_1 = (IEObjectDescription it) -> {
return it.getQualifiedName().toString();
};
Assert.assertEquals("bar", IterableExtensions.join(IterableExtensions.<IEObjectDescription, String>map(((ChunkedResourceDescriptions) _globalDescriptions_1).getContainer("bar").getExportedObjects(), _function_1), ","));
}
use of org.eclipse.xtext.resource.IResourceDescriptions in project xtext-eclipse by eclipse.
the class Bug334456Test method testSameResourceCountForTwoProjects.
@Test
public void testSameResourceCountForTwoProjects() throws Exception {
IProject fooProject = createPluginProject("foo");
waitForBuild();
IResourceDescriptions descriptions = BuilderUtil.getBuilderState();
int firstSize = Iterables.size(descriptions.getAllResourceDescriptions());
IProject barProject = createPluginProject("bar");
waitForBuild();
descriptions = BuilderUtil.getBuilderState();
int secondSize = Iterables.size(descriptions.getAllResourceDescriptions());
assertEquals(firstSize, secondSize);
barProject.close(null);
waitForBuild();
descriptions = BuilderUtil.getBuilderState();
int thirdSize = Iterables.size(descriptions.getAllResourceDescriptions());
assertEquals(firstSize, thirdSize);
fooProject.close(null);
waitForBuild();
descriptions = BuilderUtil.getBuilderState();
int forthSize = Iterables.size(descriptions.getAllResourceDescriptions());
// no remaining references to archives - fewer entries in index
assertTrue(firstSize > forthSize);
}
use of org.eclipse.xtext.resource.IResourceDescriptions in project xtext-eclipse by eclipse.
the class Bug334456Test method testNoCopiedResourceDescription.
@Test
public void testNoCopiedResourceDescription() throws Exception {
createPluginProject("foo");
waitForBuild();
IResourceDescriptions descriptions = BuilderUtil.getBuilderState();
assertFalse(Iterables.isEmpty(descriptions.getAllResourceDescriptions()));
for (IResourceDescription description : descriptions.getAllResourceDescriptions()) {
if (description instanceof CopiedResourceDescription) {
fail("Did not expect an instance of copied resource description in builder state");
}
}
}
use of org.eclipse.xtext.resource.IResourceDescriptions in project xtext-eclipse by eclipse.
the class BuilderUtil method indexContainsElement.
public static boolean indexContainsElement(final String fileUri, final String eObjectName) {
IResourceDescriptions descriptions = getBuilderState();
URI uri = URI.createURI("platform:/resource" + fileUri);
IResourceDescription description = descriptions.getResourceDescription(uri);
if (description != null) {
return description.getExportedObjects(EcorePackage.Literals.EOBJECT, QualifiedName.create(eObjectName), false).iterator().hasNext();
}
return false;
}
Aggregations