public static List<String> resourceOffsets(Resource resource) {
List<String> result = new ArrayList<String>();
TreeIterator<Object> iterator = EcoreUtil.getAllContents(resource, true);
while (iterator.hasNext()) {
InternalEObject child = (InternalEObject)iterator.next();
INode node = (INode)child.eAdapters().get(0);
result.add("" + node.getOffset() + ", " + node.getSemanticElement());
}
return result;
}