private static boolean itemsHaveMnemonics(final List<ActionItem> items) {
    for (ActionItem item : items) {
      if (item.getAction().getTemplatePresentation().getMnemonic() != 0) return true;
    }

    return false;
  }
    @Override
    public PopupStep onChosen(
        ActionItem actionChoice, boolean finalChoice, final int eventModifiers) {
      if (!actionChoice.isEnabled()) return FINAL_CHOICE;
      final AnAction action = actionChoice.getAction();
      DataManager mgr = DataManager.getInstance();

      final DataContext dataContext =
          myContext != null ? mgr.getDataContext(myContext) : mgr.getDataContext();

      if (action instanceof ActionGroup
          && (!finalChoice || !((ActionGroup) action).canBePerformed(dataContext))) {
        return createActionsStep(
            (ActionGroup) action,
            dataContext,
            myEnableMnemonics,
            true,
            myShowDisabledActions,
            null,
            myContext,
            false,
            myPreselectActionCondition,
            false);
      } else {
        myFinalRunnable =
            new Runnable() {
              @Override
              public void run() {
                action.actionPerformed(
                    new AnActionEvent(
                        null,
                        dataContext,
                        ActionPlaces.UNKNOWN,
                        action.getTemplatePresentation().clone(),
                        ActionManager.getInstance(),
                        eventModifiers));
              }
            };
        return FINAL_CHOICE;
      }
    }
 @Override
 public boolean hasSubstep(final ActionItem selectedValue) {
   return selectedValue != null
       && selectedValue.isEnabled()
       && selectedValue.getAction() instanceof ActionGroup;
 }
 @Override
 public ListSeparator getSeparatorAbove(final ActionItem value) {
   return value.isPrependWithSeparator() ? new ListSeparator(value.getSeparatorText()) : null;
 }
 @Override
 @NotNull
 public String getTextFor(final ActionItem value) {
   return value.getText();
 }
 @Override
 public Icon getIconFor(final ActionItem aValue) {
   return aValue.getIcon();
 }
 @Override
 public boolean isSelectable(final ActionItem value) {
   return value.isEnabled();
 }