boolean (@NotNull JFrame frame, @Nullable Project project) { if (project != null && myProject != null) { return project == myProject; } if (myDialog != null) { DialogWrapper popup = myDialog.getPopup(); if (popup != null) { return UIUtil.isAncestor(frame, popup.getOwner()); } } return false; }