Search in sources :

Example 1 with UnknownRunConfiguration

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

the class ProjectRunConfigurationManager method loadState.

@Override
public void loadState(Element state) {
    if (myUnloadedElements != null) {
        myUnloadedElements.clear();
    }
    Set<String> existing = new THashSet<>();
    for (Iterator<Element> iterator = state.getChildren().iterator(); iterator.hasNext(); ) {
        Element child = iterator.next();
        RunnerAndConfigurationSettings configuration = myManager.loadConfiguration(child, true);
        if (configuration != null) {
            existing.add(configuration.getUniqueID());
        } else if (child.getName().equals(RunManagerImpl.CONFIGURATION)) {
            if (myUnloadedElements == null) {
                myUnloadedElements = new SmartList<>();
            }
            iterator.remove();
            myUnloadedElements.add(child);
        }
    }
    myManager.removeNotExistingSharedConfigurations(existing);
    if (myManager.getSelectedConfiguration() == null) {
        final List<RunConfiguration> allConfigurations = myManager.getAllConfigurationsList();
        for (final RunConfiguration configuration : allConfigurations) {
            final RunnerAndConfigurationSettings settings = myManager.getSettings(allConfigurations.get(0));
            if (!(configuration instanceof UnknownRunConfiguration)) {
                myManager.setSelectedConfiguration(settings);
                break;
            }
        }
    }
    // IDEA-60004: configs may never be sorted before write, so call it manually after shared configs read
    myManager.setOrdered(false);
    myManager.getSortedConfigurations();
}
Also used : UnknownRunConfiguration(com.intellij.execution.configurations.UnknownRunConfiguration) UnknownRunConfiguration(com.intellij.execution.configurations.UnknownRunConfiguration) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) Element(org.jdom.Element) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) SmartList(com.intellij.util.SmartList) THashSet(gnu.trove.THashSet)

Aggregations

RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)1 UnknownRunConfiguration (com.intellij.execution.configurations.UnknownRunConfiguration)1 SmartList (com.intellij.util.SmartList)1 THashSet (gnu.trove.THashSet)1 Element (org.jdom.Element)1