use of com.jetbrains.python.run.AbstractPythonRunConfigurationParams in project intellij-community by JetBrains.
the class ConfigurationBasedProcessRunner method createExecutionEnvironment.
@NotNull
private ExecutionEnvironment createExecutionEnvironment(@NotNull final String sdkPath, @NotNull final Project project, @NotNull final String workingDir) throws ExecutionException {
final RunnerAndConfigurationSettings settings = RunManager.getInstance(project).createRunConfiguration("test", myConfigurationFactory);
final AbstractPythonRunConfigurationParams config = (AbstractPythonRunConfigurationParams) settings.getConfiguration();
assert myExpectedConfigurationType.isInstance(config) : String.format("Expected configuration %s, but got %s", myExpectedConfigurationType, config.getClass());
// Checked by assert
@SuppressWarnings("unchecked") final CONF_T castedConfiguration = (CONF_T) config;
castedConfiguration.setSdkHome(sdkPath);
castedConfiguration.setWorkingDirectory(workingDir);
new WriteAction() {
@Override
protected void run(@NotNull final Result result) throws Throwable {
configurationCreatedAndWillLaunch(castedConfiguration);
RunManagerEx.getInstanceEx(project).addConfiguration(settings, false);
RunManagerEx.getInstanceEx(project).setSelectedConfiguration(settings);
Assert.assertSame(settings, RunManagerEx.getInstanceEx(project).getSelectedConfiguration());
}
}.execute();
// Execute
final Executor executor = DefaultRunExecutor.getRunExecutorInstance();
return ExecutionEnvironmentBuilder.create(executor, settings).build();
}
Aggregations