Search in sources :

Example 16 with ConfigurationFactory

use of com.intellij.execution.configurations.ConfigurationFactory in project android by JetBrains.

the class AndroidRunConfigurations method createRunConfiguration.

public void createRunConfiguration(@NotNull AndroidFacet facet) {
    Module module = facet.getModule();
    ConfigurationFactory configurationFactory = AndroidRunConfigurationType.getInstance().getFactory();
    List<RunConfiguration> configurations = RunManager.getInstance(module.getProject()).getConfigurationsList(configurationFactory.getType());
    for (RunConfiguration configuration : configurations) {
        if (configuration instanceof AndroidRunConfiguration && ((AndroidRunConfiguration) configuration).getConfigurationModule().getModule() == module) {
            // There is already a run configuration for this module.
            return;
        }
    }
    addRunConfiguration(facet, null, TargetSelectionMode.SHOW_DIALOG, null);
}
Also used : RunConfiguration(com.intellij.execution.configurations.RunConfiguration) AndroidRunConfiguration(com.android.tools.idea.run.AndroidRunConfiguration) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) AndroidRunConfiguration(com.android.tools.idea.run.AndroidRunConfiguration) Module(com.intellij.openapi.module.Module)

Example 17 with ConfigurationFactory

use of com.intellij.execution.configurations.ConfigurationFactory in project android by JetBrains.

the class PostSyncProjectSetupTest method testJUnitRunConfigurationSetup.

public void testJUnitRunConfigurationSetup() {
    when(myIdeInfo.isAndroidStudio()).thenReturn(true);
    PostSyncProjectSetup.Request request = new PostSyncProjectSetup.Request();
    mySetup.setUpProject(request, myProgressIndicator);
    ConfigurationFactory configurationFactory = AndroidJUnitConfigurationType.getInstance().getConfigurationFactories()[0];
    AndroidJUnitConfiguration jUnitConfiguration = new AndroidJUnitConfiguration("", getProject(), configurationFactory);
    myRunManager.addConfiguration(myRunManager.createConfiguration(jUnitConfiguration, configurationFactory), true);
    List<RunConfiguration> junitRunConfigurations = myRunManager.getConfigurationsList(AndroidJUnitConfigurationType.getInstance());
    for (RunConfiguration runConfiguration : junitRunConfigurations) {
        assertSize(1, myRunManager.getBeforeRunTasks(runConfiguration));
        assertEquals(MakeBeforeRunTaskProvider.ID, myRunManager.getBeforeRunTasks(runConfiguration).get(0).getProviderId());
    }
    RunConfiguration runConfiguration = junitRunConfigurations.get(0);
    List<BeforeRunTask> tasks = new LinkedList<>(myRunManager.getBeforeRunTasks(runConfiguration));
    BeforeRunTask newTask = new MakeBeforeRunTaskProvider(getProject()).createTask(runConfiguration);
    newTask.setEnabled(true);
    tasks.add(newTask);
    myRunManager.setBeforeRunTasks(runConfiguration, tasks, false);
    mySetup.setUpProject(request, myProgressIndicator);
    assertSize(2, myRunManager.getBeforeRunTasks(runConfiguration));
}
Also used : BeforeRunTask(com.intellij.execution.BeforeRunTask) MakeBeforeRunTaskProvider(com.android.tools.idea.gradle.run.MakeBeforeRunTaskProvider) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) AndroidJUnitConfiguration(com.android.tools.idea.testartifacts.junit.AndroidJUnitConfiguration) LinkedList(java.util.LinkedList)

Example 18 with ConfigurationFactory

use of com.intellij.execution.configurations.ConfigurationFactory in project intellij-plugins by JetBrains.

the class SimulatorRakeConsoleModifier method createConsoleBuilder.

@NotNull
@Override
public TextConsoleBuilder createConsoleBuilder(@NotNull RakeRunConfiguration config) {
    if (onDevice(config)) {
        return TextConsoleBuilderFactory.getInstance().createBuilder(config.getProject());
    }
    final ConfigurationFactory factory = IrbRunConfigurationType.getInstance().getConfigurationFactories()[0];
    final Project project = config.getProject();
    return new IrbConsoleBuilder(project, (IrbRunConfiguration) factory.createTemplateConfiguration(project));
}
Also used : Project(com.intellij.openapi.project.Project) IrbConsoleBuilder(org.jetbrains.plugins.ruby.console.config.IrbConsoleBuilder) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) NotNull(org.jetbrains.annotations.NotNull)

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