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);
}
}
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;
}
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);
}
}
Aggregations