Search in sources :

Example 1 with FunctionRunConfigurationFactory

use of com.microsoft.azure.toolkit.intellij.function.runner.localrun.FunctionRunConfigurationFactory 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)

Aggregations

BeforeRunTask (com.intellij.execution.BeforeRunTask)1 RunManagerEx (com.intellij.execution.RunManagerEx)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)1 Project (com.intellij.openapi.project.Project)1 FunctionRunConfigurationFactory (com.microsoft.azure.toolkit.intellij.function.runner.localrun.FunctionRunConfigurationFactory)1 ArrayList (java.util.ArrayList)1