use of org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput 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 && document instanceof XtextDocument) {
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);
}
use of org.eclipse.jdt.internal.ui.javaeditor.IClassFileEditorInput in project xtext-eclipse by eclipse.
the class XbaseDocumentProvider method createElementInfo.
@Override
protected ElementInfo createElementInfo(Object element) throws CoreException {
if (element instanceof IClassFileEditorInput) {
IDocument document = null;
IStatus status = null;
try {
document = createDocument(element);
} catch (CoreException x) {
status = x.getStatus();
document = createEmptyDocument();
}
ClassFileInfo info = new ClassFileInfo(document, createAnnotationModel(element));
info.fStatus = status;
registerAnnotationInfoProcessor(info);
return info;
}
return super.createElementInfo(element);
}
Aggregations