void (final @NotNull AnActionEvent e) { boolean selected = isSelected(e); Presentation presentation = e.getPresentation(); Toggleable.setSelected(presentation, selected); if (e.isFromContextMenu()) { // force showing check marks instead of toggle icons in the context menu presentation.setIcon(null); } }