private static boolean isVisible(@NotNull DefaultActionGroup group) {
    if (group.getChildrenCount() == 0) {
      return false;
    }

    for (AnAction action : group.getChildActionsOrStubs()) {
      if (action instanceof DefaultActionGroup o) {
        if (isVisible(o)) {
          return true;
        }
      }
      else {
        return true;
      }
    }
    return false;
  }
private static boolean isVisible(@NotNull DefaultActionGroup group)