use of org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy in project n4js by eclipse.
the class GlobalObjectScope method buildMap.
@Override
protected void buildMap(Resource resource, Map<QualifiedName, IEObjectDescription> elements) {
IDefaultResourceDescriptionStrategy strategy = ((XtextResource) resource).getResourceServiceProvider().get(IDefaultResourceDescriptionStrategy.class);
TreeIterator<EObject> allProperContents = EcoreUtil.getAllProperContents(resource, false);
IAcceptor<IEObjectDescription> acceptor = new IAcceptor<IEObjectDescription>() {
@Override
public void accept(IEObjectDescription description) {
elements.put(description.getQualifiedName(), description);
}
};
while (allProperContents.hasNext()) {
EObject content = allProperContents.next();
if (!strategy.createEObjectDescriptions(content, acceptor)) {
allProperContents.prune();
}
}
}
Aggregations