RunManagerEx runManager = RunManagerEx.getInstanceEx(project);
if (created) {
runManager.setTemporaryConfiguration(configuration);
}
runManager.setSelectedConfiguration(configuration);
ExecutionEnvironmentBuilder builder = ExecutionEnvironmentBuilder.createOrNull(executor, configuration);
if (builder != null) {
ExecutionManager.getInstance(project).restartRunProfile(builder.build());
}
}