@Override public LightweightHint show(@NotNull Editor editor, @NotNull Point p, boolean alignToRight, @NotNull TooltipGroup group, @NotNull HintHint hintHint) { myTrafficLightRenderer = (TrafficLightRenderer)((EditorMarkupModelImpl)editor.getMarkupModel()).getErrorStripeRenderer(); myPanel = new TrafficProgressPanel(myTrafficLightRenderer, editor, hintHint); repaintTooltipWindow(); LineTooltipRenderer.correctLocation(editor, myPanel, p, alignToRight, true, myPanel.getMinWidth()); LightweightHint hint = new LightweightHint(myPanel); HintManagerImpl hintManager = (HintManagerImpl)HintManager.getInstance(); hintManager.showEditorHint(hint, editor, p, HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_OTHER_HINT | HintManager.HIDE_BY_SCROLLING, 0, false, hintHint); hint.addHintListener(new HintListener() { @Override public void hintHidden(EventObject event) { if (myPanel == null) return; //double hide? myPanel = null; onHide.run(); } }); return hint; }
private void repaintTrafficIcon(@NotNull final PsiFile file, final Editor editor, double progress) { if (ApplicationManager.getApplication().isCommandLine()) return; if (repaintIconAlarm.isEmpty() || progress >= 1) { repaintIconAlarm.addRequest(new Runnable() { @Override public void run() { Project myProject = file.getProject(); if (myProject.isDisposed()) return; Editor myeditor = editor; if (myeditor == null) { myeditor = PsiUtilBase.findEditor(file); } if (myeditor == null || myeditor.isDisposed()) return; EditorMarkupModelImpl markup = (EditorMarkupModelImpl)myeditor.getMarkupModel(); markup.repaintTrafficLightIcon(); DaemonListeners.repaintErrorStripeRenderer(myeditor, myProject); } }, 50, null); } }
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); } }
@Override public LightweightHint show(@NotNull Editor editor, @NotNull Point p, boolean alignToRight, @NotNull TooltipGroup group, @NotNull HintHint hintHint) { myTrafficLightRenderer = (TrafficLightRenderer)((EditorMarkupModelImpl)editor.getMarkupModel()).getErrorStripeRenderer(); myPanel = new TrafficProgressPanel(myTrafficLightRenderer, editor, hintHint); LineTooltipRenderer.correctLocation(editor, myPanel, p, alignToRight, false, -1); LightweightHint hint = new LightweightHint(myPanel); HintManagerImpl hintManager = (HintManagerImpl)HintManager.getInstance(); hintManager.showEditorHint(hint, editor, p, HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_OTHER_HINT | HintManager.HIDE_BY_SCROLLING, 0, false, hintHint); hint.addHintListener(new HintListener() { @Override public void hintHidden(EventObject event) { if (myPanel == null) return; //double hide? myPanel = null; onHide.run(); } }); repaintTooltipWindow(); return hint; }
public 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); } renderer = new TrafficLightRenderer(project, document, file); Disposer.register(((EditorImpl)editorMarkupModel.getEditor()).getDisposable(), (Disposable)renderer); editorMarkupModel.setErrorStripeRenderer(renderer); }
private void repaintTrafficIcon() { if (ApplicationManager.getApplication().isCommandLine()) return; if (repaintIconAlarm.isEmpty() || getProgressCount() >= getProgressLimit()) { repaintIconAlarm.addRequest(new Runnable() { @Override public void run() { if (myProject.isDisposed()) return; Editor editor = myFile == null ? null : PsiUtilBase.findEditor(myFile); if (editor == null || editor.isDisposed()) return; EditorMarkupModelImpl markup = (EditorMarkupModelImpl)editor.getMarkupModel(); markup.repaintTrafficLightIcon(); } }, 50, null); } }
@Override public LightweightHint show(@Nonnull Editor editor, @Nonnull Point p, boolean alignToRight, @Nonnull TooltipGroup group, @Nonnull HintHint hintHint) { myTrafficLightRenderer = (TrafficLightRenderer)((EditorMarkupModelImpl)editor.getMarkupModel()).getErrorStripeRenderer(); myPanel = new TrafficProgressPanel(myTrafficLightRenderer, editor, hintHint); repaintTooltipWindow(); LineTooltipRenderer.correctLocation(editor, myPanel, p, alignToRight, true, myPanel.getMinWidth()); LightweightHint hint = new LightweightHint(myPanel); HintManagerImpl hintManager = (HintManagerImpl)HintManager.getInstance(); hintManager.showEditorHint(hint, editor, p, HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_OTHER_HINT | HintManager.HIDE_BY_SCROLLING, 0, false, hintHint); hint.addHintListener(new HintListener() { @Override public void hintHidden(EventObject event) { if (myPanel == null) return; //double hide? myPanel = null; onHide.run(); } }); return hint; }
private void repaintTrafficIcon(@Nonnull final PsiFile file, @Nullable Editor editor, double progress) { if (ApplicationManager.getApplication().isCommandLine()) return; if (repaintIconAlarm.isEmpty() || progress >= 1) { repaintIconAlarm.addRequest(() -> { Project myProject = file.getProject(); if (myProject.isDisposed()) return; Editor myeditor = editor; if (myeditor == null) { myeditor = PsiUtilBase.findEditor(file); } if (myeditor == null || myeditor.isDisposed()) return; EditorMarkupModelImpl markup = (EditorMarkupModelImpl)myeditor.getMarkupModel(); markup.repaintTrafficLightIcon(); DaemonListeners.repaintErrorStripeRenderer(myeditor, myProject); }, 50, null); } }
@RequiredDispatchThread static void setOrRefreshErrorStripeRenderer(@Nonnull EditorMarkupModel editorMarkupModel, @Nonnull Project project, @Nonnull 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); } }