use of org.eclipse.xtext.nodemodel.serialization.DeserializationConversionContext in project xtext-core by eclipse.
the class ResourceStorageLoadable method readNodeModel.
protected void readNodeModel(final StorageAwareResource resource, final InputStream inputStream) throws IOException {
final SerializableNodeModel serializableNodeModel = new SerializableNodeModel(resource);
boolean _exists = resource.getResourceSet().getURIConverter().exists(resource.getURI(), resource.getResourceSet().getLoadOptions());
boolean _not = (!_exists);
if (_not) {
URI _uRI = resource.getURI();
String _plus = ("Skipping loading node model for synthetic resource " + _uRI);
ResourceStorageLoadable.LOG.info(_plus);
return;
}
final InputStream stream = resource.getResourceSet().getURIConverter().createInputStream(resource.getURI());
String _encoding = resource.getEncoding();
final InputStreamReader in = new InputStreamReader(stream, _encoding);
final String completeContent = CharStreams.toString(in);
final DeserializationConversionContext deserializationContext = new DeserializationConversionContext(resource, completeContent);
final DataInputStream dataIn = new DataInputStream(inputStream);
serializableNodeModel.readObjectData(dataIn, deserializationContext);
EObject _head = IterableExtensions.<EObject>head(resource.getContents());
boolean _hasErrors = deserializationContext.hasErrors();
ParseResult _parseResult = new ParseResult(_head, serializableNodeModel.root, _hasErrors);
resource.setParseResult(_parseResult);
}
Aggregations