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();
    }
  }
  public void addComment(
      Editor editor, ChangeInfo changeInfo, String revisionId, Project project, Comment comment) {
    if (editor == null) return;
    MarkupModel markup = editor.getMarkupModel();

    RangeHighlighter rangeHighlighter = null;
    if (comment.range != null) {
      rangeHighlighter = highlightRangeComment(comment.range, editor, project);
    }

    int lineCount = markup.getDocument().getLineCount();

    int line = comment.line - 1;
    if (line < 0) {
      line = 0;
    }
    if (line > lineCount - 1) {
      line = lineCount - 1;
    }
    if (line >= 0) {
      final RangeHighlighter highlighter =
          markup.addLineHighlighter(line, HighlighterLayer.ERROR + 1, null);
      CommentGutterIconRenderer iconRenderer =
          new CommentGutterIconRenderer(
              this,
              editor,
              gerritUtil,
              selectedRevisions,
              addCommentActionBuilder,
              comment,
              changeInfo,
              revisionId,
              highlighter,
              rangeHighlighter);
      highlighter.setGutterIconRenderer(iconRenderer);
    }
  }
  private void addVCGutterIcons(
      VCOutputFile vco, Editor editor, Project project, MyProverListener listener) {
    if (!editor.isDisposed()) {
      highlighters.clear();
      MarkupModel markup = editor.getMarkupModel();
      RESOLVEPluginController controller = RESOLVEPluginController.getInstance(project);
      markup.removeAllHighlighters();

      // A mapping from [line number] -> [vc_1, .., vc_j]
      Map<Integer, List<VC>> byLine = vco.getVCsGroupedByLineNumber();
      List<RangeHighlighter> vcRelatedHighlighters = new ArrayList<>();

      for (Map.Entry<Integer, List<VC>> vcsByLine : byLine.entrySet()) {
        List<AnAction> actionsPerVC = new ArrayList<>();
        // create clickable actions for each vc
        for (VC vc : vcsByLine.getValue()) {
          actionsPerVC.add(
              new VCNavigationAction(listener, vc.getNumber() + "", vc.getExplanation()));
        }

        highlighter =
            markup.addLineHighlighter(
                vcsByLine.getKey() - 1, HighlighterLayer.ELEMENT_UNDER_CARET, null);
        highlighter.setGutterIconRenderer(
            new GutterIconRenderer() {
              @NotNull
              @Override
              public Icon getIcon() {
                return RESOLVEIcons.VC;
              }

              @Override
              public boolean equals(Object obj) {
                return false;
              }

              @Override
              public int hashCode() {
                return 0;
              }

              @Override
              public boolean isNavigateAction() {
                return true;
              }

              @Nullable
              public ActionGroup getPopupMenuActions() {
                DefaultActionGroup g = new DefaultActionGroup();
                g.addAll(actionsPerVC);
                return g;
              }

              @Nullable
              public AnAction getClickAction() {
                return null;
              }
            });
        vcRelatedHighlighters.add(highlighter);
        highlighters.add(highlighter);
      }

      editor
          .getDocument()
          .addDocumentListener(
              new DocumentListener() {
                @Override
                public void beforeDocumentChange(DocumentEvent event) {}

                @Override
                public void documentChanged(DocumentEvent event) {
                  // remove all highlighters
                  for (RangeHighlighter h : vcRelatedHighlighters) {
                    markup.removeHighlighter(h);
                  }
                  VerifierPanel verifierPanel = controller.getVerifierPanel();
                  controller.getVerifierWindow().hide(null);
                  verifierPanel.revertToBaseGUI();
                }
              });
    }
  }