BaseAction (final JComponent component) { final ActionBehaviour<List<T>> behaviour = new ActionBehaviour<>() { @Override public List<T> performAction(final @NotNull AnActionEvent e) { if (myConfirmation != null && !myConfirmation.value((List<T>)Arrays.asList(myList.getSelectedValues()))) { return Collections.emptyList(); } return ListUtil.removeSelectedItems(myList, myEnableCondition); } @Override public void updateAction(final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(ListUtil.canRemoveSelectedItems(myList, myEnableCondition)); } }; final BaseAction action = createAction(behaviour); action.registerCustomShortcutSet(CommonShortcuts.getDelete(), component); return action; }