Search in sources :

Example 6 with RunManagerImpl

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

the class ConfigurationsTest method testExternalizeJUnitConfiguration.

public void testExternalizeJUnitConfiguration() {
    Module module = getModule1();
    JUnitConfiguration oldRc = createConfiguration(findTestA(module));
    oldRc.setWorkingDirectory(module.getModuleFilePath());
    RunManagerImpl runManager = new RunManagerImpl(myProject, new AppPropertiesComponentImpl());
    Element element = new Element("configuration");
    new RunnerAndConfigurationSettingsImpl(runManager, oldRc, false).writeExternal(element);
    RunnerAndConfigurationSettingsImpl settings = new RunnerAndConfigurationSettingsImpl(runManager);
    settings.readExternal(element);
    JUnitConfiguration newRc = (JUnitConfiguration) settings.getConfiguration();
    checkTestObject(oldRc.getPersistentData().TEST_OBJECT, newRc);
    assertThat(newRc.getModules()).containsOnly(module);
    checkClassName(oldRc.getPersistentData().getMainClassName(), newRc);
}
Also used : AppPropertiesComponentImpl(com.intellij.ide.util.AppPropertiesComponentImpl) Element(org.jdom.Element) RunnerAndConfigurationSettingsImpl(com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl) Module(com.intellij.openapi.module.Module) RunManagerImpl(com.intellij.execution.impl.RunManagerImpl)

Example 7 with RunManagerImpl

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

the class ProjectStartupTaskManager method getConfigurations.

private Collection<RunnerAndConfigurationSettings> getConfigurations(ProjectStartupConfigurationBase configuration) {
    if (configuration.isEmpty())
        return Collections.emptyList();
    final List<RunnerAndConfigurationSettings> result = new ArrayList<>();
    final List<ProjectStartupConfigurationBase.ConfigurationDescriptor> list = configuration.getList();
    for (ProjectStartupConfigurationBase.ConfigurationDescriptor descriptor : list) {
        final RunnerAndConfigurationSettings settings = ((RunManagerImpl) myRunManager).getConfigurationById(descriptor.getId());
        if (settings != null && settings.getName().equals(descriptor.getName())) {
            result.add(settings);
        } else {
            NOTIFICATION_GROUP.createNotification(PREFIX + " Run Configuration '" + descriptor.getName() + "' not found, removed from list.", MessageType.WARNING).notify(myProject);
        }
    }
    return result;
}
Also used : RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) RunManagerImpl(com.intellij.execution.impl.RunManagerImpl)

Example 8 with RunManagerImpl

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

the class ProjectStartupConfigurable method refreshDataUpdateSelection.

private void refreshDataUpdateSelection(RunnerAndConfigurationSettings settings) {
    if (myTable.isEmpty())
        return;
    myModel.reValidateConfigurations(new Processor<RunnerAndConfigurationSettings>() {

        private RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(myProject);

        @Override
        public boolean process(RunnerAndConfigurationSettings settings) {
            return runManager.getConfigurationById(settings.getUniqueID()) != null;
        }
    });
    if (settings != null) {
        final List<RunnerAndConfigurationSettings> configurations = myModel.getAllConfigurations();
        for (int i = 0; i < configurations.size(); i++) {
            final RunnerAndConfigurationSettings configuration = configurations.get(i);
            if (configuration == settings) {
                TableUtil.selectRows(myTable, new int[] { i });
                return;
            }
        }
    }
    TableUtil.selectRows(myTable, new int[] { 0 });
    myTable.getSelectionModel().setLeadSelectionIndex(0);
}
Also used : RelativePoint(com.intellij.ui.awt.RelativePoint) RunManagerImpl(com.intellij.execution.impl.RunManagerImpl)

Example 9 with RunManagerImpl

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

the class CompoundRunConfiguration method initIfNeed.

private void initIfNeed() {
    if (myInitialized)
        return;
    mySetToRun.clear();
    RunManagerImpl manager = RunManagerImpl.getInstanceImpl(getProject());
    for (Pair<String, String> pair : myPairs) {
        RunnerAndConfigurationSettings settings = manager.findConfigurationByTypeAndName(pair.first, pair.second);
        if (settings != null && settings.getConfiguration() != this) {
            mySetToRun.add(settings.getConfiguration());
        }
    }
    myInitialized = true;
}
Also used : RunManagerImpl(com.intellij.execution.impl.RunManagerImpl)

Example 10 with RunManagerImpl

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

the class AntConfigurationImpl method convertToBeforeRunTask.

private static void convertToBeforeRunTask(Project project, String buildFileUrl, String targetName, String configType, String configName) {
    if (buildFileUrl == null || targetName == null || configType == null) {
        return;
    }
    final RunManagerImpl runManager = (RunManagerImpl) RunManagerEx.getInstanceEx(project);
    final ConfigurationType type = runManager.getConfigurationType(configType);
    if (type == null) {
        return;
    }
    if (configName != null) {
        for (RunConfiguration configuration : runManager.getConfigurationsList(type)) {
            if (configName.equals(configuration.getName())) {
                final List<AntBeforeRunTask> tasks = runManager.getBeforeRunTasks(configuration, AntBeforeRunTaskProvider.ID);
                if (!tasks.isEmpty()) {
                    //This is legacy code, we had only one task that time
                    AntBeforeRunTask task = tasks.get(0);
                    task.setEnabled(true);
                    task.setTargetName(targetName);
                    task.setAntFileUrl(buildFileUrl);
                }
            }
        }
    } else {
        for (ConfigurationFactory factory : type.getConfigurationFactories()) {
            final RunConfiguration template = runManager.getConfigurationTemplate(factory).getConfiguration();
            final List<AntBeforeRunTask> tasks = runManager.getBeforeRunTasks(template, AntBeforeRunTaskProvider.ID);
            if (!tasks.isEmpty()) {
                //This is legacy code, we had only one task that time
                AntBeforeRunTask task = tasks.get(0);
                task.setEnabled(true);
                task.setTargetName(targetName);
                task.setAntFileUrl(buildFileUrl);
            }
        }
    }
}
Also used : ConfigurationType(com.intellij.execution.configurations.ConfigurationType) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) RunManagerImpl(com.intellij.execution.impl.RunManagerImpl)

Aggregations

RunManagerImpl (com.intellij.execution.impl.RunManagerImpl)12 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)4 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)3 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)3 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)3 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)2 RunnerAndConfigurationSettingsImpl (com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl)2 Module (com.intellij.openapi.module.Module)2 Project (com.intellij.openapi.project.Project)2 NotNull (org.jetbrains.annotations.NotNull)2 MakeBeforeRunTaskProvider (com.android.tools.idea.gradle.run.MakeBeforeRunTaskProvider)1 AndroidJUnitConfigurationType (com.android.tools.idea.testartifacts.junit.AndroidJUnitConfigurationType)1 BeforeRunTask (com.intellij.execution.BeforeRunTask)1 BeforeRunTaskProvider (com.intellij.execution.BeforeRunTaskProvider)1 UnknownConfigurationType (com.intellij.execution.configurations.UnknownConfigurationType)1 EditConfigurationsDialog (com.intellij.execution.impl.EditConfigurationsDialog)1 ExecutionManagerImpl (com.intellij.execution.impl.ExecutionManagerImpl)1 ExecutionEnvironmentBuilder (com.intellij.execution.runners.ExecutionEnvironmentBuilder)1 ProgramRunner (com.intellij.execution.runners.ProgramRunner)1 AppPropertiesComponentImpl (com.intellij.ide.util.AppPropertiesComponentImpl)1