Group (ActionGroup actionGroup, @NlsActions.ActionText String groupName, @Nullable Supplier<? extends @Nullable Icon> icon, boolean forceAsPopup, Predicate<? super AnAction> filtered, boolean normalizeSeparators) { ActionManager actionManager = ActionManager.getInstance(); Group group = new Group(groupName, actionManager.getId(actionGroup), icon); AnAction[] children = getActions(actionGroup, actionManager); for (AnAction action : children) { if (action == null) { LOG.error(groupName + " contains null actions"); continue; } if (action instanceof ActionGroup childGroup) { Group subGroup = createGroup(childGroup, getName(action), null, forceAsPopup, filtered, normalizeSeparators); if (forceAsPopup || childGroup.isPopup() || !Strings.isEmpty(childGroup.getTemplateText())) { if (subGroup.getSize() > 0 || filtered == null || filtered.test(childGroup)) { group.addGroup(subGroup); } } else { group.addAll(subGroup); } } else if (action instanceof Separator) { if (filtered == null || filtered.test(action)) { group.addSeparator(); } } else { String id = actionManager.getId(action); if (id != null) { if (filtered == null || filtered.test(action)) { group.addActionId(id); } } } } if (normalizeSeparators) group.normalizeSeparators(); return group; }