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

    return false;
  }
コード例 #2
0
    @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;
      }
    }
コード例 #3
0
 @Override
 public boolean hasSubstep(final ActionItem selectedValue) {
   return selectedValue != null
       && selectedValue.isEnabled()
       && selectedValue.getAction() instanceof ActionGroup;
 }
コード例 #4
0
 @Override
 public ListSeparator getSeparatorAbove(final ActionItem value) {
   return value.isPrependWithSeparator() ? new ListSeparator(value.getSeparatorText()) : null;
 }
コード例 #5
0
 @Override
 @NotNull
 public String getTextFor(final ActionItem value) {
   return value.getText();
 }
コード例 #6
0
 @Override
 public Icon getIconFor(final ActionItem aValue) {
   return aValue.getIcon();
 }
コード例 #7
0
 @Override
 public boolean isSelectable(final ActionItem value) {
   return value.isEnabled();
 }