Search in sources :

Example 31 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 32 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)

Example 33 with ConfigurationFactory

use of com.intellij.execution.configurations.ConfigurationFactory in project azure-tools-for-java by Microsoft.

the class DeploySpringCloudAppAction method deploy.

public static void deploy(@Nullable SpringCloudApp app, @Nonnull Project project) {
    final RunManagerEx manager = RunManagerEx.getInstanceEx(project);
    final ConfigurationFactory factory = configType.getConfigurationFactories()[0];
    final String configurationName = String.format("%s: %s", factory.getName(), project.getName());
    final RunnerAndConfigurationSettings existed = manager.findConfigurationByName(configurationName);
    final RunnerAndConfigurationSettings settings = Objects.nonNull(existed) ? existed : manager.createConfiguration(configurationName, factory);
    final SpringCloudDeploymentConfiguration configuration = ((SpringCloudDeploymentConfiguration) settings.getConfiguration());
    configuration.setApp(app);
    AzureTaskManager.getInstance().runLater(() -> {
        if (RunDialog.editConfiguration(project, settings, DEPLOY_SPRING_CLOUD_APP_TITLE, DefaultRunExecutor.getRunExecutorInstance())) {
            settings.storeInLocalWorkspace();
            manager.addConfiguration(settings);
            manager.setBeforeRunTasks(configuration, new ArrayList<>(manager.getBeforeRunTasks(settings.getConfiguration())));
            manager.setSelectedConfiguration(settings);
            ProgramRunnerUtil.executeConfiguration(settings, DefaultRunExecutor.getRunExecutorInstance());
        }
    });
}
Also used : RunManagerEx(com.intellij.execution.RunManagerEx) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings)

Example 34 with ConfigurationFactory

use of com.intellij.execution.configurations.ConfigurationFactory in project azure-tools-for-java by Microsoft.

the class RunFunctionAction method runConfiguration.

private void runConfiguration(Module module) {
    // todo: investigate when will module be null
    if (module == null) {
        return;
    }
    final Project project = module.getProject();
    final RunManagerEx manager = RunManagerEx.getInstanceEx(project);
    final ConfigurationFactory factory = new FunctionRunConfigurationFactory(configType);
    final RunnerAndConfigurationSettings settings = RunConfigurationUtils.getOrCreateRunConfigurationSettings(module, manager, factory);
    if (RunDialog.editConfiguration(project, settings, message("function.run.configuration.title"), DefaultRunExecutor.getRunExecutorInstance())) {
        final List<BeforeRunTask> tasks = new ArrayList<>(manager.getBeforeRunTasks(settings.getConfiguration()));
        manager.addConfiguration(settings, false, tasks, false);
        manager.setSelectedConfiguration(settings);
        ProgramRunnerUtil.executeConfiguration(project, settings, DefaultRunExecutor.getRunExecutorInstance());
    }
}
Also used : BeforeRunTask(com.intellij.execution.BeforeRunTask) Project(com.intellij.openapi.project.Project) RunManagerEx(com.intellij.execution.RunManagerEx) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) FunctionRunConfigurationFactory(com.microsoft.azure.toolkit.intellij.function.runner.localrun.FunctionRunConfigurationFactory) ArrayList(java.util.ArrayList) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) FunctionRunConfigurationFactory(com.microsoft.azure.toolkit.intellij.function.runner.localrun.FunctionRunConfigurationFactory)

Example 35 with ConfigurationFactory

use of com.intellij.execution.configurations.ConfigurationFactory in project azure-tools-for-java by Microsoft.

the class WebAppOnLinuxAction method runConfiguration.

@SuppressWarnings({ "deprecation", "Duplicates" })
private void runConfiguration(Module module) {
    Project project = module.getProject();
    final RunManagerEx manager = RunManagerEx.getInstanceEx(project);
    final ConfigurationFactory factory = configType.getWebAppOnLinuxDeployConfigurationFactory();
    RunnerAndConfigurationSettings settings = manager.findConfigurationByName(String.format("%s: %s:%s", factory.getName(), project.getName(), module.getName()));
    if (settings == null) {
        settings = manager.createConfiguration(String.format("%s: %s:%s", factory.getName(), project.getName(), module.getName()), factory);
    }
    if (RunDialog.editConfiguration(project, settings, DIALOG_TITLE, DefaultRunExecutor.getRunExecutorInstance())) {
        List<BeforeRunTask> tasks = new ArrayList<>(manager.getBeforeRunTasks(settings.getConfiguration()));
        manager.addConfiguration(settings, false, tasks, false);
        manager.setSelectedConfiguration(settings);
        ProgramRunnerUtil.executeConfiguration(project, settings, DefaultRunExecutor.getRunExecutorInstance());
    }
}
Also used : BeforeRunTask(com.intellij.execution.BeforeRunTask) Project(com.intellij.openapi.project.Project) RunManagerEx(com.intellij.execution.RunManagerEx) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) ArrayList(java.util.ArrayList) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings)

Aggregations

ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)38 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)23 Project (com.intellij.openapi.project.Project)14 RunManagerEx (com.intellij.execution.RunManagerEx)11 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)9 BeforeRunTask (com.intellij.execution.BeforeRunTask)7 RunManagerImpl (com.intellij.execution.impl.RunManagerImpl)6 ArrayList (java.util.ArrayList)6 NotNull (org.jetbrains.annotations.NotNull)6 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)4 RemoteConfiguration (com.intellij.execution.remote.RemoteConfiguration)4 Module (com.intellij.openapi.module.Module)4 RunManager (com.intellij.execution.RunManager)3 DefaultDebugExecutor (com.intellij.execution.executors.DefaultDebugExecutor)3 RunnerAndConfigurationSettingsImpl (com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl)3 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)3 MakeBeforeRunTaskProvider (com.android.tools.idea.gradle.run.MakeBeforeRunTaskProvider)2 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)2 ExecutionException (com.intellij.execution.ExecutionException)2 ConfigurationFactoryEx (com.intellij.execution.configuration.ConfigurationFactoryEx)2