use of org.eclipse.xtext.resource.containers.IAllContainersState in project xtext-eclipse by eclipse.
the class LiveShadowedAllContainerStateTest method formatContainers.
private String formatContainers(ResourceSet rs) {
IResourceDescriptions resourceDescriptions = resourceDescriptionProvider.getResourceDescriptions(rs);
IAllContainersState containerState = containerStateProvider.get(resourceDescriptions);
Set<URI> allURIs = Sets.newHashSet(Iterables.transform(rs.getResources(), Resource::getURI));
Set<String> allContainers = Sets.newHashSet((Iterables.filter(Iterables.transform(allURIs, it -> containerState.getContainerHandle(it)), Predicates.notNull())));
for (IProject p : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
allContainers.add(p.getName());
}
StringBuilder builder = new StringBuilder();
for (String container : allContainers) {
builder.append("container ");
builder.append(container);
builder.append(" isEmpty=");
builder.append(containerState.isEmpty(container));
builder.append(" {\n");
for (URI uri : IterableExtensions.sortBy(containerState.getContainedURIs(container), URI::toString)) {
builder.append(" resourceURI=");
builder.append(uri);
builder.append(" exported=[");
builder.append(Joiner.on(", ").join(Iterables.transform(resourceDescriptions.getResourceDescription(uri).getExportedObjects(), IEObjectDescription::getName)));
builder.append("]\n");
}
builder.append("}\n");
}
return builder.toString();
}
Aggregations