JBPopup (@NotNull ActionGroup actionGroup, @NotNull AnActionEvent event) { myShowPopup = true; JBPopup popup = super.createAndShowActionGroupPopup(actionGroup, event); popup.addListener(new JBPopupListener() { @Override public void onClosed(@NotNull LightweightWindowEvent event) { myShowPopup = false; ApplicationManager.getApplication().invokeLater(() -> myMoreButton.setVisible(myState == EventHandler.SelectionType.HOVER)); } }); return popup; }