public static void setButtonActions(@NotNull JComponent component,
                                      Collection<? extends JButton> buttons,
                                      Collection<? extends JButton> principal,
                                      JButton defaultButton,
                                      @Nullable ActionGroup extraActions) {
    if (!SystemInfoRt.isMac || !LoadingState.COMPONENTS_REGISTERED.isOccurred() || ApplicationManager.getApplication() == null) {
      return;
    }

    ActionManagerEx.doWithLazyActionManager(instance -> {
      DefaultActionGroup result = new DefaultActionGroup();
      if (buttons != null) {
        result.add(buildActionsFromButtons(buttons, defaultButton, false));
      }
      if (extraActions != null) {
        result.add(extraActions);
      }
      if (principal != null) {
        result.add(buildActionsFromButtons(principal, defaultButton, true));
      }

      setActions(component, result);
    });
  }
public static void setButtonActions(@NotNull JComponent component,
                                      Collection<? extends JButton> buttons,
                                      Collection<? extends JButton> principal,
                                      JButton defaultButton,
                                      @Nullable ActionGroup extraActions)