Search in sources :

Example 36 with BeforeRunTask

use of com.intellij.execution.BeforeRunTask in project azure-tools-for-java by microsoft.

the class PushImageAction method runConfiguration.

@SuppressWarnings({ "deprecation", "Duplicates" })
private void runConfiguration(Module module) {
    Project project = module.getProject();
    final RunManagerEx manager = RunManagerEx.getInstanceEx(project);
    final ConfigurationFactory factory = configType.getPushImageRunConfigurationFactory();
    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)

Example 37 with BeforeRunTask

use of com.intellij.execution.BeforeRunTask in project azure-tools-for-java by microsoft.

the class RunOnDockerHostAction method runConfiguration.

@SuppressWarnings({ "deprecation", "Duplicates" })
private void runConfiguration(Module module) {
    Project project = module.getProject();
    final RunManagerEx manager = RunManagerEx.getInstanceEx(project);
    final ConfigurationFactory factory = configType.getDockerHostRunConfigurationFactory();
    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

BeforeRunTask (com.intellij.execution.BeforeRunTask)37 RunManagerEx (com.intellij.execution.RunManagerEx)24 ArrayList (java.util.ArrayList)22 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)17 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)13 Project (com.intellij.openapi.project.Project)12 MavenBeforeRunTask (org.jetbrains.idea.maven.tasks.MavenBeforeRunTask)6 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)4 BeforeRunTaskProvider (com.intellij.execution.BeforeRunTaskProvider)2 UnknownRunConfiguration (com.intellij.execution.configurations.UnknownRunConfiguration)2 ConfigurationSettingsEditorWrapper (com.intellij.execution.impl.ConfigurationSettingsEditorWrapper)2 DataContext (com.intellij.openapi.actionSystem.DataContext)2 ExternalSystemBeforeRunTask (com.intellij.openapi.externalSystem.service.execution.ExternalSystemBeforeRunTask)2 Module (com.intellij.openapi.module.Module)2 Key (com.intellij.openapi.util.Key)2 BuildArtifactsBeforeRunTask (com.intellij.packaging.impl.run.BuildArtifactsBeforeRunTask)2 FunctionDeploymentConfigurationFactory (com.microsoft.azure.toolkit.intellij.function.runner.deploy.FunctionDeploymentConfigurationFactory)2 FunctionRunConfigurationFactory (com.microsoft.azure.toolkit.intellij.function.runner.localrun.FunctionRunConfigurationFactory)2 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)2 LinkedList (java.util.LinkedList)2