Search in sources :

Example 1 with EditorMarkupModelImpl

use of com.intellij.openapi.editor.impl.EditorMarkupModelImpl in project intellij-community by JetBrains.

the class TrafficLightRenderer method setOrRefreshErrorStripeRenderer.

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);
    }
}
Also used : ErrorStripeRenderer(com.intellij.openapi.editor.markup.ErrorStripeRenderer) EditorImpl(com.intellij.openapi.editor.impl.EditorImpl) EditorMarkupModelImpl(com.intellij.openapi.editor.impl.EditorMarkupModelImpl)

Example 2 with EditorMarkupModelImpl

use of com.intellij.openapi.editor.impl.EditorMarkupModelImpl in project intellij-community by JetBrains.

the class TrafficTooltipRendererImpl method show.

@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) {
            //double hide?
            if (myPanel == null)
                return;
            myPanel = null;
            onHide.run();
        }
    });
    return hint;
}
Also used : HintListener(com.intellij.ui.HintListener) HintManagerImpl(com.intellij.codeInsight.hint.HintManagerImpl) LightweightHint(com.intellij.ui.LightweightHint) EditorMarkupModelImpl(com.intellij.openapi.editor.impl.EditorMarkupModelImpl) EventObject(java.util.EventObject)

Example 3 with EditorMarkupModelImpl

use of com.intellij.openapi.editor.impl.EditorMarkupModelImpl in project intellij-community by JetBrains.

the class DefaultHighlightInfoProcessor method repaintTrafficIcon.

private void repaintTrafficIcon(@NotNull final PsiFile file, final 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);
    }
}
Also used : Project(com.intellij.openapi.project.Project) Editor(com.intellij.openapi.editor.Editor) EditorMarkupModelImpl(com.intellij.openapi.editor.impl.EditorMarkupModelImpl)

Aggregations

EditorMarkupModelImpl (com.intellij.openapi.editor.impl.EditorMarkupModelImpl)3 HintManagerImpl (com.intellij.codeInsight.hint.HintManagerImpl)1 Editor (com.intellij.openapi.editor.Editor)1 EditorImpl (com.intellij.openapi.editor.impl.EditorImpl)1 ErrorStripeRenderer (com.intellij.openapi.editor.markup.ErrorStripeRenderer)1 Project (com.intellij.openapi.project.Project)1 HintListener (com.intellij.ui.HintListener)1 LightweightHint (com.intellij.ui.LightweightHint)1 EventObject (java.util.EventObject)1