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);
}
}