@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 boolean isSelectable(final ActionItem value) {
   return value.isEnabled();
 }