@Nullable
  private static String getContentFromEditor(@NotNull final Editor editor, boolean onlySelection) {
    String text = ReadAction.compute(() -> editor.getSelectionModel().getSelectedText());
    if (text == null && !onlySelection) {
      text = editor.getDocument().getText();
    }

    if (StringUtil.isEmptyOrSpaces(text)) {
      return null;
    }
    return text;
  }
@Nullable
  private static String getContentFromEditor(@NotNull final Editor editor, boolean onlySelection)