AnActionButton (final AnAction action) { final Presentation presentation = action.getTemplatePresentation(); final AnActionButtonWrapper button = action instanceof CheckedActionGroup ? new CheckedAnActionButton(presentation, action) : action instanceof Toggleable ? new ToggleableButtonWrapper(presentation, action) : new AnActionButtonWrapper(presentation, action); button.setShortcut(action.getShortcutSet()); return button; }