void (@NotNull RelativePoint point) { JBPopup hector = JBPopupFactory.getInstance().createComponentPopupBuilder(this, this) .setRequestFocus(true) .setMovable(true) .setCancelCallback(() -> { for (HectorComponentPanel additionalPanel : myAdditionalPanels) { if (!additionalPanel.canClose()) { return Boolean.FALSE; } } onClose(); return Boolean.TRUE; }) .createPopup(); Disposer.register(myFile.getProject(), () -> { JBPopup oldHector = getOldHector(); if (oldHector != null && !oldHector.isDisposed()) { Disposer.dispose(oldHector); } Disposer.dispose(hector); }); JBPopup oldHector = getOldHector(); if (oldHector != null){ oldHector.cancel(); } else { myHectorRef = new WeakReference<>(hector); UIEventLogger.HectorPopupDisplayed.log(myFile.getProject()); hector.show(point); } }