@Override
  public void update(@NotNull AnActionEvent e) {
    e.getPresentation().setEnabledAndVisible(true); // FN-keys are always enabled and visible
    e.getPresentation().setText("");
    myIsActionDisabled = false;
    myAction = null;

    final String[] ids = getActionsIds(TouchBarsManager.getLastModifiersEx());
    if (ids == null || ids.length < 1) {
      return;
    }

    int c = 0;
    myAction = e.getActionManager().getAction(ids[c]);
    while (myAction == null && c + 1 < ids.length) {
      ++c;
      e.getActionManager().getAction(ids[c]);
    }

    if (myAction == null) {
      return;
    }

    myAction.update(e);
    myIsActionDisabled = !e.getPresentation().isEnabled();
    e.getPresentation().setEnabledAndVisible(true); // FN-keys are always enabled and visible

    final String text = e.getPresentation().getText();
    if (SHOW_ACTION_TEMPLATE_TEXT || text == null || text.isEmpty()) {
      // replace with template presentation text
      e.getPresentation().setText(myAction.getTemplateText());
    }
  }
@Override
  public void update(@NotNull AnActionEvent e)