void (@NotNull ActionGroup actionGroup, @NotNull AnActionEvent event) { if (myPopupState.isRecentlyHidden()) return; // do not show new popup ActionManagerImpl am = (ActionManagerImpl) ActionManager.getInstance(); ActionPopupMenu popupMenu = am.createActionPopupMenu(event.getPlace(), actionGroup, new MenuItemPresentationFactory() { @Override protected void processPresentation(@NotNull Presentation presentation) { super.processPresentation(presentation); if (StringUtil.defaultIfEmpty(presentation.getText(), "").equals(myPresentation.getText()) && StringUtil.defaultIfEmpty(presentation.getDescription(), "").equals(myPresentation.getDescription())) { presentation.setEnabled(selectedActionEnabled()); } } }); popupMenu.setTargetComponent(this); JPopupMenu menu = popupMenu.getComponent(); myPopupState.prepareToShow(menu); if (event.isFromActionToolbar()) { menu.show(this, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE.width + getInsets().left, getHeight()); } else { JBPopupMenu.showAtRight(this, menu); } HelpTooltip.setMasterPopupOpenCondition(this, () -> !menu.isVisible()); }