private void highlightNotification(
      final Notification notification, String message, final int line1, final int line2) {

    final MarkupModel markupModel = myLogEditor.getValue().getMarkupModel();
    TextAttributes bold = new TextAttributes(null, null, null, null, Font.BOLD);
    final List<RangeHighlighter> lineColors = new ArrayList<RangeHighlighter>();
    for (int line = line1; line < line2; line++) {
      final RangeHighlighter lineHighlighter =
          markupModel.addLineHighlighter(line, HighlighterLayer.CARET_ROW + 1, bold);
      Color color =
          notification.getType() == NotificationType.ERROR
              ? JBColor.RED
              : notification.getType() == NotificationType.WARNING ? JBColor.YELLOW : JBColor.GREEN;
      lineHighlighter.setErrorStripeMarkColor(color);
      lineHighlighter.setErrorStripeTooltip(message);
      lineColors.add(lineHighlighter);
    }

    final Runnable removeHandler =
        new Runnable() {
          @Override
          public void run() {
            for (RangeHighlighter color : lineColors) {
              markupModel.removeHighlighter(color);
            }

            TextAttributes attributes =
                EditorColorsManager.getInstance()
                    .getGlobalScheme()
                    .getAttributes(ConsoleViewContentType.LOG_EXPIRED_ENTRY);
            for (int line = line1; line < line2; line++) {
              markupModel.addLineHighlighter(line, HighlighterLayer.CARET_ROW + 1, attributes);
            }

            TextAttributes italic = new TextAttributes(null, null, null, null, Font.ITALIC);
            for (int line = line1; line < line2; line++) {
              for (RangeHighlighter highlighter :
                  myHyperlinkSupport.getValue().findAllHyperlinksOnLine(line)) {
                markupModel.addRangeHighlighter(
                    highlighter.getStartOffset(),
                    highlighter.getEndOffset(),
                    HighlighterLayer.CARET_ROW + 2,
                    italic,
                    HighlighterTargetArea.EXACT_RANGE);
                myHyperlinkSupport.getValue().removeHyperlink(highlighter);
              }
            }
          }
        };
    if (!notification.isExpired()) {
      myProjectModel.removeHandlers.put(notification, removeHandler);
    } else {
      removeHandler.run();
    }
  }
  @Nullable
  private RangeHighlighter createHighlighter(@NotNull Range range) {
    myApplication.assertIsDispatchThread();

    LOG.assertTrue(!myReleased, "Already released");

    if (myMode == Mode.SILENT) return null;

    int first =
        range.getLine1() >= getLineCount(myDocument)
            ? myDocument.getTextLength()
            : myDocument.getLineStartOffset(range.getLine1());

    int second =
        range.getLine2() >= getLineCount(myDocument)
            ? myDocument.getTextLength()
            : myDocument.getLineStartOffset(range.getLine2());

    final TextAttributes attr = LineStatusTrackerDrawing.getAttributesFor(range);
    final RangeHighlighter highlighter =
        DocumentMarkupModel.forDocument(myDocument, myProject, true)
            .addRangeHighlighter(
                first,
                second,
                HighlighterLayer.FIRST - 1,
                attr,
                HighlighterTargetArea.LINES_IN_RANGE);

    highlighter.setThinErrorStripeMark(true);
    highlighter.setGreedyToLeft(true);
    highlighter.setGreedyToRight(true);
    highlighter.setLineMarkerRenderer(LineStatusTrackerDrawing.createRenderer(range, this));
    highlighter.setEditorFilter(MarkupEditorFilterFactory.createIsNotDiffFilter());

    final String tooltip;
    if (range.getLine1() == range.getLine2()) {
      if (range.getVcsLine1() + 1 == range.getVcsLine2()) {
        tooltip = VcsBundle.message("tooltip.text.line.before.deleted", range.getLine1() + 1);
      } else {
        tooltip =
            VcsBundle.message(
                "tooltip.text.lines.before.deleted",
                range.getLine1() + 1,
                range.getVcsLine2() - range.getVcsLine1());
      }
    } else if (range.getLine1() + 1 == range.getLine2()) {
      tooltip = VcsBundle.message("tooltip.text.line.changed", range.getLine1() + 1);
    } else {
      tooltip =
          VcsBundle.message("tooltip.text.lines.changed", range.getLine1() + 1, range.getLine2());
    }

    highlighter.setErrorStripeTooltip(tooltip);
    return highlighter;
  }
  @NotNull
  public static RangeHighlighter createRangeHighlighter(
      @NotNull Range range, @NotNull TextRange textRange, @NotNull MarkupModel markupModel) {
    TextAttributes attributes = getTextAttributes(range);

    final RangeHighlighter highlighter =
        markupModel.addRangeHighlighter(
            textRange.getStartOffset(),
            textRange.getEndOffset(),
            HighlighterLayer.FIRST - 1,
            attributes,
            HighlighterTargetArea.LINES_IN_RANGE);

    highlighter.setThinErrorStripeMark(true);
    highlighter.setGreedyToLeft(true);
    highlighter.setGreedyToRight(true);

    highlighter.setErrorStripeTooltip(getTooltipText(range));

    return highlighter;
  }