use of com.intellij.execution.configurations.ConfigurationFactory in project intellij-community by JetBrains.
the class ProgramRunnerUtil method getRawIcon.
@NotNull
public static Icon getRawIcon(RunnerAndConfigurationSettings settings) {
RunConfiguration configuration = settings.getConfiguration();
ConfigurationFactory factory = settings.getFactory();
Icon icon = factory != null ? factory.getIcon(configuration) : null;
if (icon == null)
icon = AllIcons.RunConfigurations.Unknown;
return icon;
}
use of com.intellij.execution.configurations.ConfigurationFactory in project intellij-community by JetBrains.
the class AntConfigurationImpl method convertToBeforeRunTask.
private static void convertToBeforeRunTask(Project project, String buildFileUrl, String targetName, String configType, String configName) {
if (buildFileUrl == null || targetName == null || configType == null) {
return;
}
final RunManagerImpl runManager = (RunManagerImpl) RunManagerEx.getInstanceEx(project);
final ConfigurationType type = runManager.getConfigurationType(configType);
if (type == null) {
return;
}
if (configName != null) {
for (RunConfiguration configuration : runManager.getConfigurationsList(type)) {
if (configName.equals(configuration.getName())) {
final List<AntBeforeRunTask> tasks = runManager.getBeforeRunTasks(configuration, AntBeforeRunTaskProvider.ID);
if (!tasks.isEmpty()) {
//This is legacy code, we had only one task that time
AntBeforeRunTask task = tasks.get(0);
task.setEnabled(true);
task.setTargetName(targetName);
task.setAntFileUrl(buildFileUrl);
}
}
}
} else {
for (ConfigurationFactory factory : type.getConfigurationFactories()) {
final RunConfiguration template = runManager.getConfigurationTemplate(factory).getConfiguration();
final List<AntBeforeRunTask> tasks = runManager.getBeforeRunTasks(template, AntBeforeRunTaskProvider.ID);
if (!tasks.isEmpty()) {
//This is legacy code, we had only one task that time
AntBeforeRunTask task = tasks.get(0);
task.setEnabled(true);
task.setTargetName(targetName);
task.setAntFileUrl(buildFileUrl);
}
}
}
}
use of com.intellij.execution.configurations.ConfigurationFactory in project intellij-community by JetBrains.
the class CloudRunConfigurationUtil method createRunConfiguration.
public static <SC extends ServerConfiguration, DC extends DeploymentConfiguration> DeployToServerRunConfiguration<SC, DC> createRunConfiguration(RemoteServer<SC> account, Module module, DeploymentSource deploymentSource, DC deploymentConfiguration) {
Project project = module.getProject();
String accountName = account.getName();
String name = generateRunConfigurationName(accountName, module.getName());
final RunManagerEx runManager = RunManagerEx.getInstanceEx(project);
ConfigurationFactory configurationFactory = getRunConfigurationType(account.getType()).getConfigurationFactories()[0];
final RunnerAndConfigurationSettings runSettings = runManager.createRunConfiguration(name, configurationFactory);
final DeployToServerRunConfiguration<SC, DC> result = (DeployToServerRunConfiguration<SC, DC>) runSettings.getConfiguration();
result.setServerName(accountName);
result.setDeploymentSource(deploymentSource);
result.setDeploymentConfiguration(deploymentConfiguration);
((ConfigurationFactoryEx) configurationFactory).onNewConfigurationCreated(runSettings.getConfiguration());
runManager.addConfiguration(runSettings, false);
runManager.setSelectedConfiguration(runSettings);
return result;
}
use of com.intellij.execution.configurations.ConfigurationFactory in project intellij-community by JetBrains.
the class PyUnitTestTask method runTestOn.
@Override
public void runTestOn(String sdkHome) throws Exception {
final Project project = getProject();
final ConfigurationFactory factory = PythonTestConfigurationType.getInstance().LEGACY_UNITTEST_FACTORY;
runConfiguration(factory, sdkHome, project);
}
use of com.intellij.execution.configurations.ConfigurationFactory 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);
}
}
}
Aggregations