JBPopup (@Nullable Component c) { if (c == null) return null; if (c instanceof JComponent) { JBPopup popup = (JBPopup)((JComponent)c).getClientProperty(JBPopup.KEY); if (popup != null) return popup; } final Window wnd = SwingUtilities.getWindowAncestor(c); if (wnd instanceof JWindow) { final JRootPane root = ((JWindow)wnd).getRootPane(); return (JBPopup)root.getClientProperty(JBPopup.KEY); } return null; }