private static <T> boolean processParentProjectFile(
      MavenDomProjectModel projectDom,
      final Processor<T> processor,
      final Project project,
      final Function<? super MavenDomProfile, T> domProfileFunction,
      final Function<? super MavenDomProjectModel, T> projectDomFunction,
      final Set<MavenDomProjectModel> processed) {
    Boolean aBoolean =
        new DomParentProjectFileProcessor<Boolean>(MavenProjectsManager.getInstance(project)) {
          protected Boolean doProcessParent(VirtualFile parentFile) {
            MavenDomProjectModel parentProjectDom =
                MavenDomUtil.getMavenDomProjectModel(project, parentFile);
            if (parentProjectDom == null) return false;

            return MavenDomProjectProcessorUtils.process(
                parentProjectDom,
                processor,
                project,
                domProfileFunction,
                projectDomFunction,
                processed);
          }
        }.process(projectDom);

    return aBoolean == null ? false : aBoolean.booleanValue();
  }
 private static void collectChildrenProjects(
     @NotNull final MavenDomProjectModel model, @NotNull Set<MavenDomProjectModel> models) {
   MavenProject mavenProject = MavenDomUtil.findProject(model);
   if (mavenProject != null) {
     final Project project = model.getManager().getProject();
     for (MavenProject inheritor :
         MavenProjectsManager.getInstance(project).findInheritors(mavenProject)) {
       MavenDomProjectModel inheritorProjectModel =
           MavenDomUtil.getMavenDomProjectModel(project, inheritor.getFile());
       if (inheritorProjectModel != null && !models.contains(inheritorProjectModel)) {
         models.add(inheritorProjectModel);
         collectChildrenProjects(inheritorProjectModel, models);
       }
     }
   }
 }
  @Nullable
  public static MavenDomProjectModel findParent(
      @NotNull MavenDomParent mavenDomParent, Project project) {
    if (!DomUtil.hasXml(mavenDomParent)) return null;

    MavenId id =
        new MavenId(
            mavenDomParent.getGroupId().getStringValue(),
            mavenDomParent.getArtifactId().getStringValue(),
            mavenDomParent.getVersion().getStringValue());
    MavenProject mavenProject = MavenProjectsManager.getInstance(project).findProject(id);

    return mavenProject != null
        ? MavenDomUtil.getMavenDomProjectModel(project, mavenProject.getFile())
        : null;
  }
    @Nullable
    public T process(@NotNull MavenDomProjectModel projectDom) {
      MavenDomParent parent = projectDom.getMavenParent();
      MavenParentDesc parentDesc = null;
      if (DomUtil.hasXml(parent)) {
        String parentGroupId = parent.getGroupId().getStringValue();
        String parentArtifactId = parent.getArtifactId().getStringValue();
        String parentVersion = parent.getVersion().getStringValue();
        String parentRelativePath = parent.getRelativePath().getStringValue();
        if (StringUtil.isEmptyOrSpaces(parentRelativePath)) parentRelativePath = "../pom.xml";
        MavenId parentId = new MavenId(parentGroupId, parentArtifactId, parentVersion);
        parentDesc = new MavenParentDesc(parentId, parentRelativePath);
      }

      return process(
          myManager.getGeneralSettings(), MavenDomUtil.getVirtualFile(projectDom), parentDesc);
    }
  private static <T> boolean processSettingsXml(
      @Nullable MavenProject mavenProject,
      @NotNull Processor<T> processor,
      @NotNull Project project,
      Function<? super MavenDomProfile, T> domProfileFunction) {
    MavenGeneralSettings settings = MavenProjectsManager.getInstance(project).getGeneralSettings();

    for (VirtualFile each : settings.getEffectiveSettingsFiles()) {
      MavenDomSettingsModel settingsDom =
          MavenDomUtil.getMavenDomModel(project, each, MavenDomSettingsModel.class);
      if (settingsDom == null) continue;

      if (processProfiles(settingsDom.getProfiles(), mavenProject, processor, domProfileFunction))
        return true;
    }
    return false;
  }
  public static void processChildrenRecursively(
      @Nullable MavenDomProjectModel model,
      @NotNull Processor<MavenDomProjectModel> processor,
      @NotNull Project project,
      @NotNull Set<MavenDomProjectModel> processedModels,
      boolean strict) {
    if (model != null && !processedModels.contains(model)) {
      processedModels.add(model);

      if (strict && processor.process(model)) return;

      MavenProject mavenProject = MavenDomUtil.findProject(model);
      if (mavenProject != null) {
        for (MavenProject childProject :
            MavenProjectsManager.getInstance(project).findInheritors(mavenProject)) {
          MavenDomProjectModel childProjectModel =
              MavenDomUtil.getMavenDomProjectModel(project, childProject.getFile());

          processChildrenRecursively(childProjectModel, processor, project, processedModels, true);
        }
      }
    }
  }
 protected VirtualFile findManagedFile(@NotNull MavenId id) {
   MavenProject project = myManager.findProject(id);
   return project == null ? null : project.getFile();
 }