void (@NotNull ActionGroup actionGroup, @NotNull Collection<AnAction> autoCloseActions) { Collection<AnAction> actionsFromGroup = new HashSet<>(); Helpers.collectLeafActions(actionGroup, actionsFromGroup); if (!actionsFromGroup.containsAll(autoCloseActions)) { autoCloseActions.removeIf(a -> !actionsFromGroup.contains(a)); } }