package jetbrains.mps.execution.impl.configurations.runners;

/*Generated by MPS */

import jetbrains.mps.annotations.GeneratedClass;
import com.intellij.execution.runners.DefaultProgramRunner;
import jetbrains.mps.logging.Logger;
import org.jetbrains.annotations.NotNull;
import com.intellij.execution.configurations.RunProfile;
import com.intellij.execution.executors.DefaultRunExecutor;
import jetbrains.mps.execution.api.configurations.BaseMpsRunConfiguration;

@GeneratedClass(node = "r:8b4f0747-4cce-403c-a9ed-8700a357a916(jetbrains.mps.execution.impl.configurations.runners)/5145867626676113213", model = "r:8b4f0747-4cce-403c-a9ed-8700a357a916(jetbrains.mps.execution.impl.configurations.runners)")
public class MPSProgramRunner extends DefaultProgramRunner {
  private static final Logger LOG = Logger.getLogger(MPSProgramRunner.class);
  public MPSProgramRunner() {
  }
  @NotNull
  @Override
  public String getRunnerId() {
    return "Default Runner";
  }
  @Override
  public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) {
    try {
      return executorId.equals(DefaultRunExecutor.EXECUTOR_ID) && (!(profile instanceof BaseMpsRunConfiguration) || ((BaseMpsRunConfiguration) profile).canExecute(executorId));
    } catch (Throwable throwable) {
      if (LOG.isErrorLevel()) {
        LOG.error("Run configuration " + profile + " is broken.", throwable);
      }
      return false;
    }
  }
}
