static void setOrRefreshErrorStripeRenderer( @NotNull EditorMarkupModel editorMarkupModel, @NotNull Project project, @NotNull Document document, PsiFile file) { ApplicationManager.getApplication().assertIsDispatchThread(); if (!editorMarkupModel.isErrorStripeVisible() || !DaemonCodeAnalyzer.getInstance(project).isHighlightingAvailable(file)) { return; } ErrorStripeRenderer renderer = editorMarkupModel.getErrorStripeRenderer(); if (renderer instanceof TrafficLightRenderer) { TrafficLightRenderer tlr = (TrafficLightRenderer) renderer; tlr.refresh(); ((EditorMarkupModelImpl) editorMarkupModel).repaintVerticalScrollBar(); if (tlr.myFile == null || tlr.myFile.isValid()) return; Disposer.dispose(tlr); } EditorImpl editor = (EditorImpl) editorMarkupModel.getEditor(); if (!editor.isDisposed()) { renderer = new TrafficLightRenderer(project, document, file); Disposer.register(editor.getDisposable(), (Disposable) renderer); editorMarkupModel.setErrorStripeRenderer(renderer); } }
public static void setOrRefreshErrorStripeRenderer( @NotNull EditorMarkupModel editorMarkupModel, @NotNull Project project, Document document, PsiFile file) { ApplicationManager.getApplication().assertIsDispatchThread(); ErrorStripeRenderer renderer = editorMarkupModel.getErrorStripeRenderer(); if (renderer instanceof TrafficLightRenderer) { ((TrafficLightRenderer) renderer).refresh(); ((EditorMarkupModelImpl) editorMarkupModel).repaintVerticalScrollBar(); } else { renderer = new TrafficLightRenderer(project, document, file); Disposer.register( ((EditorImpl) editorMarkupModel.getEditor()).getDisposable(), (Disposable) renderer); editorMarkupModel.setErrorStripeRenderer(renderer); } }