@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    final Project project = e.getProject();
    if (project == null) {
      return;
    }
    final VirtualFile[] contextFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
    if (contextFiles == null || contextFiles.length == 0) {
      return;
    }
    final AntConfiguration antConfiguration = AntConfiguration.getInstance(project);

    final Set<VirtualFile> files = new HashSet<>(List.of(contextFiles));
    for (AntBuildFile buildFile : antConfiguration.getBuildFileList()) {
      VirtualFile virtualFile = buildFile.getVirtualFile();
      if (virtualFile != null) {
        files.remove(virtualFile);
      }
    }

    int filesAdded = 0;
    @Nls final StringBuilder errors = new StringBuilder();

    for (VirtualFile file : files) {
      try {
        if (antConfiguration.addBuildFile(file) != null) {
          filesAdded++;
        }
      }
      catch (AntNoFileException ex) {
        String message = ex.getMessage();
        if (message == null || message.isEmpty()) {
          message = AntBundle.message("cannot.add.build.files.from.excluded.directories.error.message", ex.getFile().getPresentableUrl());
        }
        if (!errors.isEmpty()) {
          errors.append("\n");
        }
        errors.append(message);
      }
    }

    if (!errors.isEmpty()) {
      Messages.showWarningDialog(project, errors.toString(), AntBundle.message("cannot.add.build.file.dialog.title"));
    }
    if (filesAdded > 0) {
      ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.ANT_BUILD);
      if (window == null) {
        window = ActivateAntToolWindowAction.Manager.INSTANCE.createToolWindow(project);
      }
      window.activate(null);
    }
  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)