@Override
    public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) {
      if (e == null) return EMPTY_ARRAY;
      UpdateSession updateSession = e.getUpdateSession();
      List<ActionGroup> groups = updateSession.compute(
        this, "collectActionGroups", ActionUpdateThread.EDT, this::collectActionGroups);
      if (groups.isEmpty()) return EMPTY_ARRAY;
      List<AnAction> result = new ArrayList<>();
      for (ActionGroup group : groups) {
        Iterable<? extends AnAction> actions = updateSession.expandedChildren(group);
        for (AnAction action : actions) {
          if (action instanceof ToggleAction && !result.contains(action)) {
            result.add(action);
          }
          else if (action instanceof Separator && !result.isEmpty() &&
                   !(ContainerUtil.getLastItem(result) instanceof Separator)) {
            result.add(Separator.getInstance());
          }
        }
      }
      boolean popup = ContainerUtil.count(result, it -> !(it instanceof Separator)) > 3;
      if (!popup && !result.isEmpty()) result.add(Separator.getInstance());
      return result.toArray(EMPTY_ARRAY);
    }
@Override
    public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e)