private static AnAction _createActionFromButton(@Nullable Action action,
                                                  @NotNull JButton button,
                                                  boolean useTextFromAction /*for optional buttons*/) {
    Object anAct = action == null ? null : action.getValue(OptionAction.AN_ACTION);
    if (anAct == null) {
      anAct = new MyAction(useTextFromAction, action, button);
    }
    if (!(anAct instanceof AnAction)) {
      return null;
    }
    TouchbarActionCustomizations.setComponent((AnAction)anAct, button).setShowText(true).setShowImage(false);
    return (AnAction)anAct;
  }
private static AnAction _createActionFromButton(@Nullable Action action,
                                                  @NotNull JButton button,
                                                  boolean useTextFromAction /*for optional buttons*/)