use of com.intellij.openapi.editor.markup.RangeHighlighter in project intellij-community by JetBrains.
the class UnifiedDiffChange method destroyHighlighter.
public void destroyHighlighter() {
for (RangeHighlighter highlighter : myHighlighters) {
highlighter.dispose();
}
myHighlighters.clear();
for (MyGutterOperation operation : myOperations) {
operation.dispose();
}
myOperations.clear();
}
use of com.intellij.openapi.editor.markup.RangeHighlighter in project intellij-community by JetBrains.
the class TextMergeChange method createOperation.
@Nullable
private MyGutterOperation createOperation(@NotNull ThreeSide side, @NotNull OperationType type) {
if (isResolved(side))
return null;
EditorEx editor = myViewer.getEditor(side);
Document document = editor.getDocument();
int line = getStartLine(side);
int offset = line == DiffUtil.getLineCount(document) ? document.getTextLength() : document.getLineStartOffset(line);
RangeHighlighter highlighter = editor.getMarkupModel().addRangeHighlighter(offset, offset, HighlighterLayer.ADDITIONAL_SYNTAX, null, HighlighterTargetArea.LINES_IN_RANGE);
return new MyGutterOperation(side, highlighter, type);
}
use of com.intellij.openapi.editor.markup.RangeHighlighter in project intellij-community by JetBrains.
the class SimpleOnesideDiffViewer method clearDiffPresentation.
private void clearDiffPresentation() {
myPanel.resetNotifications();
for (RangeHighlighter highlighter : myHighlighters) {
highlighter.dispose();
}
myHighlighters.clear();
}
use of com.intellij.openapi.editor.markup.RangeHighlighter in project intellij-community by JetBrains.
the class DaemonTooltipRendererProvider method calcTooltipRenderer.
@Override
public TooltipRenderer calcTooltipRenderer(@NotNull final Collection<RangeHighlighter> highlighters) {
LineTooltipRenderer bigRenderer = null;
List<HighlightInfo> infos = new SmartList<>();
//do not show same tooltip twice
Collection<String> tooltips = new THashSet<>();
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 MyRenderer(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 = new HighlightInfoComposite(infos);
String toolTip = composite.getToolTip();
MyRenderer myRenderer = new MyRenderer(toolTip == null ? null : UIUtil.convertSpace2Nbsp(toolTip), new Object[] { highlighters });
if (bigRenderer == null) {
bigRenderer = myRenderer;
} else {
myRenderer.addBelow(bigRenderer.getText());
bigRenderer = myRenderer;
}
}
return bigRenderer;
}
use of com.intellij.openapi.editor.markup.RangeHighlighter in project intellij-community by JetBrains.
the class HighlightersRecycler method pickupHighlighterFromGarbageBin.
// null means no highlighter found in the cache
@Nullable
RangeHighlighter pickupHighlighterFromGarbageBin(int startOffset, int endOffset, int layer) {
TextRange range = new TextRange(startOffset, endOffset);
Collection<RangeHighlighter> collection = incinerator.get(range);
for (RangeHighlighter highlighter : collection) {
if (highlighter.isValid() && highlighter.getLayer() == layer) {
incinerator.remove(range, highlighter);
return highlighter;
}
}
return null;
}
Aggregations