public static ActionGroup correctActionGroup(ActionGroup group,
                                               CustomActionsSchema schema,
                                               String defaultGroupName,
                                               String rootGroupName,
                                               boolean force) {
    if (!force && !schema.isCorrectActionGroup(group, defaultGroupName)) {
      return group;
    }

    String text = group.getTemplatePresentation().getText(true);
    if (text != null) {
      int index = group.getTemplatePresentation().getDisplayedMnemonicIndex();
      if (0 <= index && index <= text.length()) {
        text = text.substring(0, index) + UIUtil.MNEMONIC + text.substring(index);
      }
    }

    ActionGroup correctedGroup = new CustomisedActionGroup(text, group, schema, defaultGroupName, rootGroupName);
    String groupId = ActionManager.getInstance().getId(group);
    for (ActionUrl actionUrl : schema.getActions()) {
      Group g1 = actionUrl.getComponent() instanceof Group g ? g : null;
      if (g1 != null && Objects.equals(g1.getId(), groupId)) {
        if (g1.isForceShowAsPopup()) correctedGroup.setPopup(true);
        break;
      }
    }
    return correctedGroup;
  }
public static ActionGroup correctActionGroup(ActionGroup group,
                                               CustomActionsSchema schema,
                                               String defaultGroupName,
                                               String rootGroupName,
                                               boolean force)