@Override
  public boolean configureTask(@NotNull RunConfiguration runConfiguration, @NotNull MavenBeforeRunTask task) {
    MavenEditGoalDialog dialog = new MavenEditGoalDialog(myProject);

    dialog.setTitle(TasksBundle.message("maven.tasks.select.goal.title"));

    if (task.getGoal() == null) {
      // just created empty task.
      MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(myProject);
      List<MavenProject> rootProjects = projectsManager.getRootProjects();
      if (rootProjects.size() > 0) {
        dialog.setSelectedMavenProject(rootProjects.get(0));
      }
      else {
        dialog.setSelectedMavenProject(null);
      }
    }
    else {
      String goals = splitToGoalsAndPomFileName(task.getGoal()).first;

      MavenProject mavenProject = getMavenProject(task);
      if (mavenProject != null) {
        String pomFileName = mavenProject.getFile().getName();
        if (FileUtil.namesEqual(pomFileName, MavenConstants.POM_XML)) {
          dialog.setGoals(goals);
        }
        else {
          dialog.setGoals(goals + " -f " + ParametersListUtil.join(pomFileName));
        }
        dialog.setSelectedMavenProject(mavenProject);
      }
      else {
        dialog.setGoals(goals);
        dialog.setSelectedMavenProject(null);
      }
    }

    if (!dialog.showAndGet()) {
      return false;
    }

    Pair<String, String> goalsAndPomFileName = splitToGoalsAndPomFileName(dialog.getGoals());
    task.setProjectPath(dialog.getWorkDirectory() + "/" + goalsAndPomFileName.second);
    task.setGoal(goalsAndPomFileName.first);
    return true;
  }
@Override
  public boolean configureTask(@NotNull RunConfiguration runConfiguration, @NotNull MavenBeforeRunTask task)