void (@NotNull InputEvent event, @NotNull AnalyzerStatus analyzerStatus) { hidePopup(); if (analyzerStatus.isEmpty()) return; // do not show new popup updateContentPanel(analyzerStatus); ComponentPopupBuilder myPopupBuilder = JBPopupFactory.getInstance().createComponentPopupBuilder(myContent, null). setCancelOnClickOutside(true). setCancelCallback(() -> analyzerStatus.getController().canClosePopup()); JBPopupListener myPopupListener = new JBPopupListener() { @Override public void onClosed(@NotNull LightweightWindowEvent event) { analyzerStatus.getController().onClosePopup(); myEditor.getComponent().removeAncestorListener(myAncestorListener); } }; myPopup = myPopupBuilder.createPopup(); myPopup.addListener(myPopupListener); myEditor.getComponent().addAncestorListener(myAncestorListener); JComponent owner = (JComponent)event.getComponent(); Dimension size = myContent.getPreferredSize(); size.width = Math.max(size.width, JBUIScale.scale(296)); RelativePoint point = new RelativePoint(owner, new Point(owner.getWidth() - owner.getInsets().right + JBUIScale.scale(DELTA_X) - size.width, owner.getHeight() + JBUIScale.scale(DELTA_Y))); myPopup.setSize(size); myPopup.show(point); }