use of org.eclipse.xtext.util.IAcceptor in project xtext-core by eclipse.
the class DefaultResourceDescription method computeExportedObjects.
@Override
protected List<IEObjectDescription> computeExportedObjects() {
if (!getResource().isLoaded()) {
try {
getResource().load(null);
} catch (IOException e) {
log.error(e.getMessage(), e);
return Collections.<IEObjectDescription>emptyList();
}
}
final List<IEObjectDescription> exportedEObjects = newArrayList();
IAcceptor<IEObjectDescription> acceptor = new IAcceptor<IEObjectDescription>() {
@Override
public void accept(IEObjectDescription eObjectDescription) {
exportedEObjects.add(eObjectDescription);
}
};
TreeIterator<EObject> allProperContents = EcoreUtil.getAllProperContents(getResource(), false);
while (allProperContents.hasNext()) {
EObject content = allProperContents.next();
if (!strategy.createEObjectDescriptions(content, acceptor))
allProperContents.prune();
}
return exportedEObjects;
}
Aggregations