boolean (Component component) { Window editor = ComponentUtil.getWindow(this); if (editor != null) { Window popup = ComponentUtil.getWindow(component); // light-weight popup is located on the layered pane of the same window if (popup == editor) { return true; } // heavy-weight popup opens new window with the corresponding parent if (popup != null && editor == popup.getParent()) { if (popup instanceof JDialog dialog) { return Dialog.ModalityType.MODELESS == dialog.getModalityType(); } return popup instanceof JWindow; } } return false; }