IDocumentProvider provider = editor.getDocumentProvider();
// there may be text editors without document providers (SF #1725100)
if (provider == null) return;
IAnnotationModel model = provider.getAnnotationModel(editor.getEditorInput());
if (!(model instanceof IAnnotationModelExtension)) return;
IAnnotationModelExtension modelex = (IAnnotationModelExtension) model;
IDocument document = provider.getDocument(editor.getEditorInput());
CoverageAnnotationModel coveragemodel = (CoverageAnnotationModel) modelex.getAnnotationModel(KEY);
if (coveragemodel == null) {
coveragemodel = new CoverageAnnotationModel(editor, document);
modelex.addAnnotationModel(KEY, coveragemodel);
}
}