Search in sources :

Example 11 with RunManagerEx

use of com.intellij.execution.RunManagerEx in project intellij-community by JetBrains.

the class RecentTestsListProvider method initRunConfigurationsMap.

private void initRunConfigurationsMap() {
    RunManagerEx manager = RunManagerEx.getInstanceEx(myProject);
    ConfigurationType[] types = manager.getConfigurationFactories();
    for (ConfigurationType type : types) {
        Map<String, List<RunnerAndConfigurationSettings>> structure = manager.getStructure(type);
        for (Map.Entry<String, List<RunnerAndConfigurationSettings>> e : structure.entrySet()) {
            for (RunnerAndConfigurationSettings settings : e.getValue()) {
                myConfigurationsMap.put(settings.getName().hashCode(), settings);
            }
        }
    }
}
Also used : ConfigurationType(com.intellij.execution.configurations.ConfigurationType) RunManagerEx(com.intellij.execution.RunManagerEx) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) List(java.util.List) Map(java.util.Map)

Example 12 with RunManagerEx

use of com.intellij.execution.RunManagerEx in project intellij-community by JetBrains.

the class AbstractExternalSystemRuntimeConfigurationProducer method createConfigurationByElement.

@Nullable
@Override
protected RunnerAndConfigurationSettings createConfigurationByElement(Location location, ConfigurationContext context) {
    if (!(location instanceof ExternalSystemTaskLocation)) {
        return null;
    }
    ExternalSystemTaskLocation taskLocation = (ExternalSystemTaskLocation) location;
    mySourceElement = taskLocation.getPsiElement();
    RunManagerEx runManager = RunManagerEx.getInstanceEx(taskLocation.getProject());
    RunnerAndConfigurationSettings settings = runManager.createConfiguration("", getConfigurationFactory());
    ExternalSystemRunConfiguration configuration = (ExternalSystemRunConfiguration) settings.getConfiguration();
    ExternalSystemTaskExecutionSettings taskExecutionSettings = configuration.getSettings();
    ExternalTaskExecutionInfo task = taskLocation.getTaskInfo();
    taskExecutionSettings.setExternalProjectPath(task.getSettings().getExternalProjectPath());
    taskExecutionSettings.setTaskNames(task.getSettings().getTaskNames());
    configuration.setName(AbstractExternalSystemTaskConfigurationType.generateName(location.getProject(), taskExecutionSettings));
    return settings;
}
Also used : RunManagerEx(com.intellij.execution.RunManagerEx) ExternalTaskExecutionInfo(com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) ExternalSystemTaskExecutionSettings(com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings) Nullable(org.jetbrains.annotations.Nullable)

Example 13 with RunManagerEx

use of com.intellij.execution.RunManagerEx in project intellij-community by JetBrains.

the class RunExternalSystemTaskAction method perform.

@Override
protected void perform(@NotNull Project project, @NotNull ProjectSystemId projectSystemId, @NotNull TaskData taskData, @NotNull AnActionEvent e) {
    final ExternalTaskExecutionInfo taskExecutionInfo = ExternalSystemActionUtil.buildTaskInfo(taskData);
    ExternalSystemUtil.runTask(taskExecutionInfo.getSettings(), taskExecutionInfo.getExecutorId(), project, projectSystemId);
    final DataContext dataContext = e.getDataContext();
    final ConfigurationContext context = ConfigurationContext.getFromContext(dataContext);
    RunnerAndConfigurationSettings configuration = context.findExisting();
    RunManagerEx runManager = (RunManagerEx) context.getRunManager();
    if (configuration == null) {
        configuration = context.getConfiguration();
        if (configuration == null) {
            return;
        }
        runManager.setTemporaryConfiguration(configuration);
    }
    runManager.setSelectedConfiguration(configuration);
}
Also used : ConfigurationContext(com.intellij.execution.actions.ConfigurationContext) DataContext(com.intellij.openapi.actionSystem.DataContext) RunManagerEx(com.intellij.execution.RunManagerEx) ExternalTaskExecutionInfo(com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings)

Example 14 with RunManagerEx

use of com.intellij.execution.RunManagerEx in project intellij-community by JetBrains.

the class DeploymentConfigurationManagerImpl method createAndRunConfiguration.

@Override
public void createAndRunConfiguration(@NotNull ServerType<?> serverType, @Nullable RemoteServer<?> remoteServer) {
    DeployToServerConfigurationType configurationType = DeployToServerConfigurationTypesRegistrar.getDeployConfigurationType(serverType);
    RunManagerEx runManager = RunManagerEx.getInstanceEx(myProject);
    ConfigurationFactoryEx factory = configurationType.getFactory();
    RunnerAndConfigurationSettings settings = runManager.createRunConfiguration(configurationType.getDisplayName(), factory);
    factory.onNewConfigurationCreated(settings.getConfiguration());
    DeployToServerRunConfiguration<?, ?> runConfiguration = (DeployToServerRunConfiguration<?, ?>) settings.getConfiguration();
    if (remoteServer != null) {
        runConfiguration.setServerName(remoteServer.getName());
    }
    if (RunDialog.editConfiguration(myProject, settings, "Create Deployment Configuration", DefaultRunExecutor.getRunExecutorInstance())) {
        runManager.addConfiguration(settings, runManager.isConfigurationShared(settings), runManager.getBeforeRunTasks(runConfiguration), false);
        runManager.setSelectedConfiguration(settings);
        ProgramRunnerUtil.executeConfiguration(myProject, settings, DefaultRunExecutor.getRunExecutorInstance());
    }
}
Also used : RunManagerEx(com.intellij.execution.RunManagerEx) ConfigurationFactoryEx(com.intellij.execution.configuration.ConfigurationFactoryEx) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings)

Example 15 with RunManagerEx

use of com.intellij.execution.RunManagerEx 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)

Aggregations

RunManagerEx (com.intellij.execution.RunManagerEx)19 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)14 Project (com.intellij.openapi.project.Project)5 ConfigurationFactoryEx (com.intellij.execution.configuration.ConfigurationFactoryEx)3 ExternalTaskExecutionInfo (com.intellij.openapi.externalSystem.model.execution.ExternalTaskExecutionInfo)3 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)2 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)2 DataContext (com.intellij.openapi.actionSystem.DataContext)2 ArrayList (java.util.ArrayList)2 CfmlRunConfiguration (com.intellij.coldFusion.UI.runner.CfmlRunConfiguration)1 BeforeRunTask (com.intellij.execution.BeforeRunTask)1 RunManagerListener (com.intellij.execution.RunManagerListener)1 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)1 RunnerAndConfigurationSettingsImpl (com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl)1 AntBeforeRunTask (com.intellij.lang.ant.config.impl.AntBeforeRunTask)1 ExecuteCompositeTargetEvent (com.intellij.lang.ant.config.impl.ExecuteCompositeTargetEvent)1 MetaTarget (com.intellij.lang.ant.config.impl.MetaTarget)1 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)1 ExternalSystemTaskExecutionSettings (com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)1 AbstractExternalSystemTaskConfigurationType (com.intellij.openapi.externalSystem.service.execution.AbstractExternalSystemTaskConfigurationType)1