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); } }
void repaintErrorStripeRenderer(Editor editor) { if (!myProject.isInitialized()) return; final Document document = editor.getDocument(); final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document); final EditorMarkupModel markup = (EditorMarkupModel) editor.getMarkupModel(); markup.setErrorPanelPopupHandler(new DaemonEditorPopup(psiFile)); markup.setErrorStripTooltipRendererProvider(new DaemonTooltipRendererProvider(myProject)); markup.setMinMarkHeight(DaemonCodeAnalyzerSettings.getInstance().ERROR_STRIPE_MARK_MIN_HEIGHT); TrafficLightRenderer.setOrRefreshErrorStripeRenderer(markup, myProject, document, psiFile); }
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); } }