public static boolean contextMenuInvokedOutsideOfSelection(@NotNull AnActionEvent e) {
    return ReadAction.compute(() -> {
      if (!ActionPlaces.EDITOR_POPUP.equals(e.getPlace())) return false;
      Editor editor = e.getData(CommonDataKeys.EDITOR);
      return editor != null && editor.getSelectionModel().hasSelection() &&
             !isCaretInsideSelection(e.getData(CommonDataKeys.CARET));
    });
  }
public static boolean contextMenuInvokedOutsideOfSelection(@NotNull AnActionEvent e)