mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 00:38:56 +00:00
warning if we have an emf resource without content
URIConverter replaced with ExtensibleURIConverter
This commit is contained in:
parent
71ce9fc657
commit
48c95a38e4
2 changed files with 9 additions and 9 deletions
|
@ -42,30 +42,30 @@ public class XtextResource extends ResourceImpl {
|
|||
@Inject
|
||||
private IParseTreeConstructor parsetreeConstructor;
|
||||
|
||||
private IParseResult parse;
|
||||
private IParseResult parseResult;
|
||||
|
||||
public XtextResource(URI uri) {
|
||||
super(uri);
|
||||
}
|
||||
|
||||
public IParseResult getParseResult() {
|
||||
return parse;
|
||||
return parseResult;
|
||||
}
|
||||
|
||||
public void update(int offset, String change) {
|
||||
CompositeNode rootNode = parse.getRootNode();
|
||||
CompositeNode rootNode = parseResult.getRootNode();
|
||||
int length = change.length();
|
||||
int documentGrowth = length - rootNode.length();
|
||||
int originalLength = length - documentGrowth;
|
||||
parse = parser.reparse(rootNode, offset, originalLength, change);
|
||||
parseResult = parser.reparse(rootNode, offset, originalLength, change);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doLoad(InputStream inputStream, Map<?, ?> options) throws IOException {
|
||||
getContents().clear();
|
||||
parse = parser.parse(inputStream, elementFactory);
|
||||
if (parse != null) {
|
||||
EObject rootElement = parse.getRootASTElement();
|
||||
parseResult = parser.parse(inputStream, elementFactory);
|
||||
if (parseResult != null) {
|
||||
EObject rootElement = parseResult.getRootASTElement();
|
||||
if (rootElement != null) {
|
||||
getContents().add(rootElement);
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ package org.eclipse.xtext.resource;
|
|||
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.resource.URIConverter;
|
||||
import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
|
||||
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||
import org.eclipse.emf.ecore.resource.impl.URIConverterImpl;
|
||||
|
||||
/**
|
||||
* A resource set that is capable of resolving classpath URIs.
|
||||
|
@ -34,7 +34,7 @@ public class XtextResourceSet extends ResourceSetImpl {
|
|||
@Override
|
||||
public URIConverter getURIConverter() {
|
||||
if (uriConverter == null) {
|
||||
uriConverter = new URIConverterImpl() {
|
||||
uriConverter = new ExtensibleURIConverterImpl() {
|
||||
@Override
|
||||
public URI normalize(URI uri) {
|
||||
if (ClasspathUriUtil.isClassapthUri(uri)) {
|
||||
|
|
Loading…
Reference in a new issue