Search in sources :

Example 11 with ConfigurationFactory

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;
}
Also used : RunConfiguration(com.intellij.execution.configurations.RunConfiguration) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) LayeredIcon(com.intellij.ui.LayeredIcon) NotNull(org.jetbrains.annotations.NotNull)

Example 12 with ConfigurationFactory

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);
            }
        }
    }
}
Also used : ConfigurationType(com.intellij.execution.configurations.ConfigurationType) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) RunManagerImpl(com.intellij.execution.impl.RunManagerImpl)

Example 13 with ConfigurationFactory

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;
}
Also used : Project(com.intellij.openapi.project.Project) RunManagerEx(com.intellij.execution.RunManagerEx) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) ConfigurationFactoryEx(com.intellij.execution.configuration.ConfigurationFactoryEx) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) DeployToServerRunConfiguration(com.intellij.remoteServer.impl.configuration.deployment.DeployToServerRunConfiguration)

Example 14 with ConfigurationFactory

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);
}
Also used : Project(com.intellij.openapi.project.Project) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory)

Example 15 with ConfigurationFactory

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);
        }
    }
}
Also used : ConfigurationType(com.intellij.execution.configurations.ConfigurationType) AndroidJUnitConfigurationType(com.android.tools.idea.testartifacts.junit.AndroidJUnitConfigurationType) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) BeforeRunTaskProvider(com.intellij.execution.BeforeRunTaskProvider) MakeBeforeRunTaskProvider(com.android.tools.idea.gradle.run.MakeBeforeRunTaskProvider) RunManagerImpl(com.intellij.execution.impl.RunManagerImpl)

Aggregations

ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)18 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)7 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)6 Project (com.intellij.openapi.project.Project)6 NotNull (org.jetbrains.annotations.NotNull)6 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)4 RunManagerImpl (com.intellij.execution.impl.RunManagerImpl)3 MakeBeforeRunTaskProvider (com.android.tools.idea.gradle.run.MakeBeforeRunTaskProvider)2 RunManagerEx (com.intellij.execution.RunManagerEx)2 ConfigurationFactoryEx (com.intellij.execution.configuration.ConfigurationFactoryEx)2 DefaultDebugExecutor (com.intellij.execution.executors.DefaultDebugExecutor)2 RemoteConfiguration (com.intellij.execution.remote.RemoteConfiguration)2 RemoteConfigurationType (com.intellij.execution.remote.RemoteConfigurationType)2 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)2 AndroidRunConfiguration (com.android.tools.idea.run.AndroidRunConfiguration)1 AndroidJUnitConfiguration (com.android.tools.idea.testartifacts.junit.AndroidJUnitConfiguration)1 AndroidJUnitConfigurationType (com.android.tools.idea.testartifacts.junit.AndroidJUnitConfigurationType)1 DebugEnvironment (com.intellij.debugger.DebugEnvironment)1 DefaultDebugEnvironment (com.intellij.debugger.DefaultDebugEnvironment)1 RemoteStateState (com.intellij.debugger.engine.RemoteStateState)1