private static DefaultActionGroup wrapGroup(@NotNull DefaultActionGroup actionGroup,
                                              @NotNull Project project,
                                              @NotNull AnActionEvent event) {
    final DefaultActionGroup copy = new DefaultActionGroup();
    for (final AnAction action : actionGroup.getChildren(event.getActionManager())) {
      if (DumbService.isDumb(project) && !action.isDumbAware()) {
        continue;
      }

      if (action instanceof GenerateActionPopupTemplateInjector o) {
        final AnAction editTemplateAction = o.createEditTemplateAction(event.getDataContext());
        if (editTemplateAction != null) {
          copy.add(new GenerateWrappingGroup(action, editTemplateAction));
          continue;
        }
      }
      if (action instanceof DefaultActionGroup o) {
        copy.add(wrapGroup(o, project, event));
      }
      else {
        copy.add(action);
      }
    }
    return copy;
  }
private static DefaultActionGroup wrapGroup(@NotNull DefaultActionGroup actionGroup,
                                              @NotNull Project project,
                                              @NotNull AnActionEvent event)