Java Code Examples for com.intellij.openapi.editor.markup.RangeHighlighter#getErrorStripeTooltip()
The following examples show how to use
com.intellij.openapi.editor.markup.RangeHighlighter#getErrorStripeTooltip() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DesktopEditorMarkupModelImpl.java From consulo with Apache License 2.0 | 5 votes |
@Override public TooltipRenderer calcTooltipRenderer(@Nonnull final Collection<? extends RangeHighlighter> highlighters) { LineTooltipRenderer bigRenderer = null; //do not show same tooltip twice Set<String> tooltips = null; for (RangeHighlighter highlighter : highlighters) { final Object tooltipObject = highlighter.getErrorStripeTooltip(); if (tooltipObject == null) continue; final String text = tooltipObject instanceof HighlightInfo ? ((HighlightInfo)tooltipObject).getToolTip() : tooltipObject.toString(); if (text == null) continue; if (tooltips == null) { tooltips = new THashSet<>(); } if (tooltips.add(text)) { if (bigRenderer == null) { bigRenderer = new LineTooltipRenderer(text, new Object[]{highlighters}); } else { bigRenderer.addBelow(text); } } } return bigRenderer; }
Example 2
Source File: IdentifierHighlighterPass.java From consulo with Apache License 2.0 | 5 votes |
public static void clearMyHighlights(Document document, Project project) { MarkupModel markupModel = DocumentMarkupModel.forDocument(document, project, true); for (RangeHighlighter highlighter : markupModel.getAllHighlighters()) { Object tooltip = highlighter.getErrorStripeTooltip(); if (!(tooltip instanceof HighlightInfo)) { continue; } HighlightInfo info = (HighlightInfo)tooltip; if (info.type == HighlightInfoType.ELEMENT_UNDER_CARET_READ || info.type == HighlightInfoType.ELEMENT_UNDER_CARET_WRITE) { highlighter.dispose(); } } }
Example 3
Source File: HighlightInfo.java From consulo with Apache License 2.0 | 4 votes |
/** * Returns the HighlightInfo instance from which the given range highlighter was created, or null if there isn't any. */ @Nullable public static HighlightInfo fromRangeHighlighter(@Nonnull RangeHighlighter highlighter) { Object errorStripeTooltip = highlighter.getErrorStripeTooltip(); return errorStripeTooltip instanceof HighlightInfo ? (HighlightInfo)errorStripeTooltip : null; }
Example 4
Source File: ErrorStripeHandler.java From consulo with Apache License 2.0 | 4 votes |
private static HighlightInfo findInfo(final RangeHighlighter highlighter) { Object o = highlighter.getErrorStripeTooltip(); if (o instanceof HighlightInfo) return (HighlightInfo)o; return null; }
Example 5
Source File: DaemonTooltipRendererProvider.java From consulo with Apache License 2.0 | 4 votes |
@Override public TooltipRenderer calcTooltipRenderer(@Nonnull final Collection<? extends RangeHighlighter> highlighters) { LineTooltipRenderer bigRenderer = null; List<HighlightInfo> infos = new SmartList<>(); Collection<String> tooltips = new THashSet<>(); //do not show same tooltip twice for (RangeHighlighter marker : highlighters) { final Object tooltipObject = marker.getErrorStripeTooltip(); if (tooltipObject == null) continue; if (tooltipObject instanceof HighlightInfo) { HighlightInfo info = (HighlightInfo)tooltipObject; if (info.getToolTip() != null && tooltips.add(info.getToolTip())) { infos.add(info); } } else { final String text = tooltipObject.toString(); if (tooltips.add(text)) { if (bigRenderer == null) { bigRenderer = new DaemonTooltipRenderer(text, new Object[]{highlighters}); } else { bigRenderer.addBelow(text); } } } } if (!infos.isEmpty()) { // show errors first ContainerUtil.quickSort(infos, (o1, o2) -> { int i = SeverityRegistrar.getSeverityRegistrar(myProject).compare(o2.getSeverity(), o1.getSeverity()); if (i != 0) return i; return o1.getToolTip().compareTo(o2.getToolTip()); }); final HighlightInfoComposite composite = HighlightInfoComposite.create(infos); String toolTip = composite.getToolTip(); DaemonTooltipRenderer myRenderer; if (Registry.is("ide.tooltip.show.with.actions")) { TooltipAction action = TooltipActionProvider.calcTooltipAction(composite, myEditor); myRenderer = new DaemonTooltipWithActionRenderer(toolTip, action, 0, action == null ? new Object[]{toolTip} : new Object[]{toolTip, action}); } else{ myRenderer = new DaemonTooltipRenderer(toolTip, new Object[]{highlighters}); } if (bigRenderer != null) { myRenderer.addBelow(bigRenderer.getText()); } bigRenderer = myRenderer; } return bigRenderer; }