use of org.eclipse.xtext.ui.generator.trace.WrappedCoreException in project xtext-eclipse by eclipse.
the class XbaseDocumentProvider method setDocumentContent.
@Override
protected boolean setDocumentContent(IDocument document, IEditorInput input, String encoding) throws CoreException {
if (input instanceof IClassFileEditorInput) {
IClassFile classFile = ((IClassFileEditorInput) input).getClassFile();
ILocationInEclipseResource source = getClassFileSourceStorage(classFile);
if (source == null) {
return false;
}
InputStream contents = null;
try {
contents = source.getContents();
if (contents != null)
setDocumentContent(document, contents, encoding);
} catch (WrappedCoreException e) {
throw e.getCause();
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, plugin.getBundle().getSymbolicName(), e.getMessage(), e));
} finally {
try {
if (contents != null)
contents.close();
} catch (IOException e1) {
}
}
setDocumentResource((XtextDocument) document, input, encoding);
return true;
}
return super.setDocumentContent(document, input, encoding);
}
Aggregations