private static boolean checkOrPerform(DataContext context, boolean perform) {
    final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
    if (goals == null || goals.isEmpty()) return false;

    final Project project = MavenActionUtil.getProject(context);
    if (project == null) return false;
    final MavenProject mavenProject = MavenActionUtil.getMavenProject(context);
    if (mavenProject == null) return false;

    if (!perform) return true;

    final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(context);
    if (projectsManager == null) return false;
    MavenExplicitProfiles explicitProfiles = projectsManager.getExplicitProfiles();
    final MavenRunnerParameters params = new MavenRunnerParameters(true,
                                                                   mavenProject.getDirectory(),
                                                                   mavenProject.getFile().getName(),
                                                                   goals,
                                                                   explicitProfiles.getEnabledProfiles(),
                                                                   explicitProfiles.getDisabledProfiles());

    MavenRunConfigurationType.runConfiguration(project, params, null);
    return true;
  }
private static boolean checkOrPerform(DataContext context, boolean perform)