use of com.avaloq.tools.ddk.check.runtime.quickfix.ICoreXtextDocument in project dsl-devkit by dsldevkit.
the class ModificationContextRegistry method getXtextDocument.
/**
* {@inheritDoc}
*/
public ICoreXtextDocument getXtextDocument(final URI uri) {
final URI trimmedUri = uri.trimFragment();
ICoreXtextDocument xtextDocument = xtextDocuments.get().get(trimmedUri);
if (xtextDocument == null) {
XtextResource xtextResource = getXtextResource(trimmedUri);
xtextDocument = createDocument(xtextResource);
xtextDocuments.get().put(trimmedUri, xtextDocument);
}
return xtextDocument;
}
use of com.avaloq.tools.ddk.check.runtime.quickfix.ICoreXtextDocument in project dsl-devkit by dsldevkit.
the class ModificationContextRegistry method createDocument.
/**
* Creates a new document with the contents of the given {@link XtextResource}.
*
* @param resource
* the resource to be used as input to the document
* @return the created document
*/
private ICoreXtextDocument createDocument(final XtextResource resource) {
XtextDocument document = documentProvider.get();
if (resource.getParseResult() != null && resource.getParseResult().getRootNode() != null) {
document.set(resource.getParseResult().getRootNode().getText());
}
document.setInput(resource);
return new XtextDocumentAdapter(document);
}
Aggregations