void (@NotNull AnActionEvent e) { Handler handler = getHandler(e); boolean enabled = handler != null; boolean selected = enabled && handler.isPinned; e.getPresentation().setIcon(e.isFromActionToolbar() ? AllIcons.General.Pin_tab : null); Toggleable.setSelected(e.getPresentation(), selected); e.getPresentation().setText(selected ? IdeBundle.message("action.unpin.tab") : IdeBundle.message("action.pin.tab")); e.getPresentation().setEnabledAndVisible(enabled); }