void () { AbstractPopup hint = myHint; if (hint == null || mySizeTrackerRegistered) return; mySizeTrackerRegistered = true; hint.addResizeListener(this::onManualResizing, this); ApplicationManager.getApplication().getMessageBus().connect(this).subscribe(AnActionListener.TOPIC, new AnActionListener() { @Override public void afterActionPerformed(@NotNull AnAction action, @NotNull AnActionEvent event, @NotNull AnActionResult result) { if (action instanceof WindowAction) onManualResizing(); } }); }