void (@NotNull Editor editor) { SelectionModel model = editor.getSelectionModel(); document = editor.getDocument(); if (!model.hasSelection()) { int offset = editor.getCaretModel().getOffset(); if (offset <= document.getTextLength()) { line = document.getLineNumber(offset); lineStart = document.getLineStartOffset(line); getJsonString(document, document.getLineEndOffset(line)); } return; } lineStart = model.getSelectionStart(); int end = model.getSelectionEnd(); line = document.getLineNumber(lineStart); if (line == document.getLineNumber(end)) { getJsonString(document, end); } }