Runnable (@Nullable Component owner) { return new Runnable() { JBPopup helpPopup; @Override public void run() { if (helpPopup != null && !helpPopup.isDisposed() && helpPopup.isVisible()) { return; } RegExHelpPopup content = new RegExHelpPopup(); ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(content, content); helpPopup = builder .setCancelOnClickOutside(false) .setBelongsToGlobalPopupStack(true) .setFocusable(true) .setRequestFocus(true) .setMovable(true) .setResizable(true) .setCancelOnOtherWindowOpen(false).setCancelButton(new MinimizeButton(LangBundle.message("tooltip.hide"))) .setTitle(LangBundle.message("popup.title.regular.expressions.syntax")).setDimensionServiceKey(null, "RegExHelpPopup", true).createPopup(); Disposer.register(helpPopup, () -> destroyPopup()); if (owner != null) { helpPopup.showInCenterOf(owner); } else { helpPopup.showInFocusCenter(); } } private void destroyPopup() { helpPopup = null; } }; }