String (@NotNull final Editor editor, final int lineIndex) { String autoDescription = editor.getSelectionModel().getSelectedText(); if (autoDescription == null) { Document document = editor.getDocument(); autoDescription = document.getCharsSequence() .subSequence(document.getLineStartOffset(lineIndex), document.getLineEndOffset(lineIndex)).toString().trim(); } if (autoDescription.length() > MAX_AUTO_DESCRIPTION_SIZE) { return autoDescription.substring(0, MAX_AUTO_DESCRIPTION_SIZE) + "..."; } return autoDescription; }