List<AnAction> (final @NotNull ActionGroup action) { final ArrayList<AnAction> groups = new ArrayList<>(); String groupName; for (AnAction anAction : action.getChildren(null)) { if (anAction instanceof ActionGroup) { groupName = anAction.getTemplateText(); for (AnAction childAction : ((ActionGroup)anAction).getChildren(null)) { if (groupName != null) { setParentGroupName(groupName, childAction); } groups.add(childAction); } } else { groups.add(anAction); } } return groups; }