boolean (@NotNull JFrame frame, @Nullable Project project) { Object[] entities = getCurrentModalEntities(); int forOtherProjects = 0; for (Object entity : entities) { if (entity instanceof ModalContextProjectLocator && !((ModalContextProjectLocator)entity).isPartOf(frame, project)) { forOtherProjects++; } else if (entity instanceof Component && !isAncestor(frame, (Component)entity)) { forOtherProjects++; } } if (forOtherProjects == entities.length) { return false; } return true; }