void (@NotNull Project project, @Nullable RunConfiguration configuration, @Nullable RunnerAndConfigurationSettings settings, @NotNull DataContext dataContext, @NotNull Executor executor, @Nullable Consumer<? super ExecutionEnvironment> environmentCustomization) { if (configuration instanceof CompoundRunConfiguration) { RunManager runManager = RunManager.getInstance(project); for (SettingsAndEffectiveTarget settingsAndEffectiveTarget : ((CompoundRunConfiguration)configuration) .getConfigurationsWithEffectiveRunTargets()) { RunConfiguration subConfiguration = settingsAndEffectiveTarget.getConfiguration(); runSubProcess(project, subConfiguration, runManager.findSettings(subConfiguration), dataContext, executor, environmentCustomization); } } else { ExecutionEnvironmentBuilder builder = settings == null ? null : ExecutionEnvironmentBuilder.createOrNull(executor, settings); if (builder == null) { return; } RunToolbarData rtData = dataContext.getData(RunToolbarData.RUN_TOOLBAR_DATA_KEY); if(rtData != null) { ExecutionTarget target = rtData.getExecutionTarget(); builder = target == null ? builder.activeTarget() : builder.target(target); } else { builder = builder.activeTarget(); } ExecutionEnvironment environment = builder.dataContext(dataContext).build(); if(environmentCustomization != null) environmentCustomization.accept(environment); ExecutionManager.getInstance(project).restartRunProfile(environment); } }