/** * Detaches the coverage annotation model from the given editor. If the editor does not have a * model attached, this method does nothing. * * @param editor Editor to detach the annotation model from */ public static void detach(ITextEditor editor) { 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; modelex.removeAnnotationModel(KEY); }
/** * Detaches the coverage annotation model from the given editor. If the editor does not have a * model attached, this method does nothing. * * @param editor Editor to detach the annotation model from */ public static void detach(ITextEditor editor) { IDocumentProvider provider = editor.getDocumentProvider(); if (provider != null) { IAnnotationModel model = provider.getAnnotationModel(editor.getEditorInput()); if (model instanceof IAnnotationModelExtension) { IAnnotationModelExtension modelex = (IAnnotationModelExtension) model; modelex.removeAnnotationModel(KEY); } } }