List<RangeHighlighter> () { List<RangeHighlighter> highlighters = new ArrayList<>(); PaintMode editorMode = PaintMode.DEFAULT; PaintMode gutterMode = PaintMode.DEFAULT; if (ignored) { editorMode = PaintMode.IGNORED; } if (excludedInEditor) { editorMode = PaintMode.EXCLUDED_EDITOR; } if (excludedInGutter) { gutterMode = PaintMode.EXCLUDED_GUTTER; } if (resolved) { editorMode = PaintMode.RESOLVED; gutterMode = PaintMode.RESOLVED; } if (fixedEditorMode != null) { editorMode = fixedEditorMode; } if (fixedGutterMode != null) { gutterMode = fixedGutterMode; } boolean isEmptyRange = startLine == endLine; boolean isFirstLine = startLine == 0; boolean isLastLine = endLine == getLineCount(editor.getDocument()); TextRange offsets = DiffUtil.getLinesRange(editor.getDocument(), startLine, endLine); int start = offsets.getStartOffset(); int end = offsets.getEndOffset(); TextAttributes attributes = isEmptyRange ? null : getTextAttributes(type, editor, editorMode.background); TextAttributes stripeAttributes = hideStripeMarkers || editorMode.background == BackgroundType.NONE ? null : getStripeTextAttributes(type, editor); boolean dottedLine = editorMode.border == BorderType.DOTTED; RangeHighlighter highlighter = editor.getMarkupModel() .addRangeHighlighter(start, end, getLayer(DEFAULT_LAYER, layerPriority), attributes, HighlighterTargetArea.LINES_IN_RANGE); highlighters.add(highlighter); if (!hideGutterMarkers) { highlighter.setLineMarkerRenderer(new DiffLineMarkerRenderer(highlighter, type, editorMode, gutterMode, hideWithoutLineNumbers, isEmptyRange, isFirstLine, isLastLine, alignedSides)); } if (isEmptyRange && !alignedSides) { LineMarkerBuilder builder = isFirstLine ? new LineMarkerBuilder(editor, 0, SeparatorPlacement.TOP, layerPriority) : new LineMarkerBuilder(editor, startLine - 1, SeparatorPlacement.BOTTOM, layerPriority); builder.withDefaultRenderer(type, true, dottedLine, highlighter); highlighters.addAll(builder.done()); } else if (editorMode.border != BorderType.NONE && !alignedSides) { LineMarkerBuilder firstLineBuilder = new LineMarkerBuilder(editor, startLine, SeparatorPlacement.TOP, layerPriority) .withDefaultRenderer(type, false, dottedLine, highlighter); LineMarkerBuilder secondLineBuilder = new LineMarkerBuilder(editor, endLine - 1, SeparatorPlacement.BOTTOM, layerPriority) .withDefaultRenderer(type, false, dottedLine, highlighter); highlighters.addAll(firstLineBuilder.done()); highlighters.addAll(secondLineBuilder.done()); } if (stripeAttributes != null) { RangeHighlighter stripeHighlighter = editor.getMarkupModel() .addRangeHighlighter(start, end, STRIPE_LAYER, stripeAttributes, HighlighterTargetArea.LINES_IN_RANGE); highlighters.add(stripeHighlighter); } return highlighters; }