void doReset(RunnerAndConfigurationSettings settings) {
    myRunConfiguration = settings.getConfiguration();

    originalTasks.clear();
    RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myRunConfiguration.getProject());
    originalTasks.addAll(runManager.getBeforeRunTasks(myRunConfiguration));
    myModel.replaceAll(originalTasks);
    myShowSettingsBeforeRunCheckBox.setSelected(settings.isEditBeforeRun());
    myShowSettingsBeforeRunCheckBox.setEnabled(!(isUnknown()));
    myPanel.setVisible(checkBeforeRunTasksAbility(false));
    updateText();
  }
Esempio n. 2
0
  private boolean checkRunConfiguration(
      Executor executor, Project project, RunnerAndConfigurationSettings configuration) {
    ExecutionTarget target = ExecutionTargetManager.getActiveTarget(project);

    if (!ExecutionTargetManager.canRun(configuration, target)) {
      ExecutionUtil.handleExecutionError(
          project,
          executor.getToolWindowId(),
          configuration.getConfiguration(),
          new ExecutionException(
              StringUtil.escapeXml(
                  "Cannot run '"
                      + configuration.getName()
                      + "' on '"
                      + target.getDisplayName()
                      + "'")));
      return false;
    }

    if (!RunManagerImpl.canRunConfiguration(configuration, executor)
        || configuration.isEditBeforeRun()) {
      if (!RunDialog.editConfiguration(project, configuration, "Edit configuration", executor)) {
        return false;
      }

      while (!RunManagerImpl.canRunConfiguration(configuration, executor)) {
        if (0
            == Messages.showYesNoDialog(
                project,
                "Configuration is still incorrect. Do you want to edit it again?",
                "Change Configuration Settings",
                "Edit",
                "Continue Anyway",
                Messages.getErrorIcon())) {
          if (!RunDialog.editConfiguration(
              project, configuration, "Edit configuration", executor)) {
            break;
          }
        } else {
          break;
        }
      }
    }
    return true;
  }
 private static void start(@NotNull ExecutionEnvironment environment) {
   RunnerAndConfigurationSettings settings = environment.getRunnerAndConfigurationSettings();
   ProgramRunnerUtil.executeConfiguration(
       environment, settings != null && settings.isEditBeforeRun(), true);
 }