private AntBuildFileBase addBuildFileImpl(final VirtualFile file, @Nullable Element element) throws AntNoFileException {
    PsiFile xmlFile = myPsiManager.findFile(file);
    if (!(xmlFile instanceof XmlFile)) {
      throw new AntNoFileException(AntBundle.message("ant.cannot.add.build.file.reason.file.is.not.xml"), file);
    }
    AntSupport.markFileAsAntFile(file, xmlFile.getProject(), true);
    if (!AntDomFileDescription.isAntFile(((XmlFile)xmlFile))) {
      throw new AntNoFileException(AntBundle.message("ant.cannot.add.build.file.reason.file.not.ant.file"), file);
    }
    final AntBuildFileImpl buildFile = new AntBuildFileImpl(xmlFile, this);
    if (element != null) {
      buildFile.readProperties(element);
    }
    myBuildFiles.add(buildFile);
    return buildFile;
  }
private AntBuildFileBase addBuildFileImpl(final VirtualFile file, @Nullable Element element)