use of com.intellij.execution.impl.RunManagerImpl in project android by JetBrains.
the class PostSyncProjectSetup method setMakeStepInJunitRunConfigurations.
private void setMakeStepInJunitRunConfigurations(@NotNull String makeTaskName) {
ConfigurationType junitConfigurationType = AndroidJUnitConfigurationType.getInstance();
BeforeRunTaskProvider<BeforeRunTask>[] taskProviders = Extensions.getExtensions(BeforeRunTaskProvider.EXTENSION_POINT_NAME, myProject);
BeforeRunTaskProvider targetProvider = null;
for (BeforeRunTaskProvider<? extends BeforeRunTask> provider : taskProviders) {
if (makeTaskName.equals(provider.getName())) {
targetProvider = provider;
break;
}
}
if (targetProvider != null) {
RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myProject);
// Set the correct "Make step" in the "JUnit Run Configuration" template.
for (ConfigurationFactory configurationFactory : junitConfigurationType.getConfigurationFactories()) {
RunnerAndConfigurationSettings template = runManager.getConfigurationTemplate(configurationFactory);
RunConfiguration runConfiguration = template.getConfiguration();
setMakeStepInJUnitConfiguration(targetProvider, runConfiguration);
}
// Set the correct "Make step" in existing JUnit Configurations.
for (RunConfiguration runConfiguration : runManager.getConfigurationsList(junitConfigurationType)) {
setMakeStepInJUnitConfiguration(targetProvider, runConfiguration);
}
}
}
use of com.intellij.execution.impl.RunManagerImpl in project android by JetBrains.
the class PostSyncProjectSetup method setMakeStepInJUnitConfiguration.
private void setMakeStepInJUnitConfiguration(@NotNull BeforeRunTaskProvider targetProvider, @NotNull RunConfiguration runConfiguration) {
// Only "make" steps of beforeRunTasks should be overridden (see http://b.android.com/194704 and http://b.android.com/227280)
List<BeforeRunTask> newBeforeRunTasks = new LinkedList<>();
RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myProject);
for (BeforeRunTask beforeRunTask : runManager.getBeforeRunTasks(runConfiguration)) {
if (beforeRunTask.getProviderId().equals(CompileStepBeforeRun.ID)) {
BeforeRunTask task = targetProvider.createTask(runConfiguration);
if (task != null) {
task.setEnabled(true);
newBeforeRunTasks.add(task);
}
} else {
newBeforeRunTasks.add(beforeRunTask);
}
}
runManager.setBeforeRunTasks(runConfiguration, newBeforeRunTasks, false);
}
Aggregations