boolean (Window w) { return myDispatchStack.stream() .flatMap(IdePopupEventDispatcher::getPopupStream) .filter(popup->!popup.isDisposed()) .map(JBPopup::getContent) .anyMatch(jbPopupContent -> SwingUtilities.getWindowAncestor(jbPopupContent) == w); }