Search in sources :

Example 26 with RunnerAndConfigurationSettings

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

the class ConfigurationContext method findExisting.

/**
   * Finds an existing run configuration matching the context.
   *
   * @return an existing configuration, or null if none was found.
   */
@Nullable
public RunnerAndConfigurationSettings findExisting() {
    if (myExistingConfiguration != null)
        return myExistingConfiguration.get();
    myExistingConfiguration = new Ref<>();
    if (myLocation == null) {
        return null;
    }
    final PsiElement psiElement = myLocation.getPsiElement();
    if (!psiElement.isValid()) {
        return null;
    }
    final List<RuntimeConfigurationProducer> producers = findPreferredProducers();
    if (myRuntimeConfiguration != null) {
        if (producers != null) {
            for (RuntimeConfigurationProducer producer : producers) {
                final RunnerAndConfigurationSettings configuration = producer.findExistingConfiguration(myLocation, this);
                if (configuration != null && configuration.getConfiguration() == myRuntimeConfiguration) {
                    myExistingConfiguration.set(configuration);
                }
            }
        }
        for (RunConfigurationProducer producer : RunConfigurationProducer.getProducers(getProject())) {
            RunnerAndConfigurationSettings configuration = producer.findExistingConfiguration(this);
            if (configuration != null && configuration.getConfiguration() == myRuntimeConfiguration) {
                myExistingConfiguration.set(configuration);
            }
        }
    }
    if (producers != null) {
        for (RuntimeConfigurationProducer producer : producers) {
            final RunnerAndConfigurationSettings configuration = producer.findExistingConfiguration(myLocation, this);
            if (configuration != null) {
                myExistingConfiguration.set(configuration);
            }
        }
    }
    for (RunConfigurationProducer producer : RunConfigurationProducer.getProducers(getProject())) {
        RunnerAndConfigurationSettings configuration = producer.findExistingConfiguration(this);
        if (configuration != null) {
            myExistingConfiguration.set(configuration);
        }
    }
    return myExistingConfiguration.get();
}
Also used : RuntimeConfigurationProducer(com.intellij.execution.junit.RuntimeConfigurationProducer) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) PsiElement(com.intellij.psi.PsiElement) Nullable(org.jetbrains.annotations.Nullable)

Example 27 with RunnerAndConfigurationSettings

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

the class ConfigurationSettingsEditorWrapper method getSnapshot.

@Override
public RunnerAndConfigurationSettings getSnapshot() throws ConfigurationException {
    RunnerAndConfigurationSettings result = myEditor.getSnapshot();
    doApply(result);
    return result;
}
Also used : RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings)

Example 28 with RunnerAndConfigurationSettings

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

the class ProjectStartupTaskManager method verifyState.

private void verifyState() {
    if (!myShared.isEmpty()) {
        final Collection<RunnerAndConfigurationSettings> sharedConfigurations = getSharedConfigurations();
        final List<RunnerAndConfigurationSettings> canNotBeShared = new ArrayList<>();
        final Iterator<RunnerAndConfigurationSettings> iterator = sharedConfigurations.iterator();
        while (iterator.hasNext()) {
            final RunnerAndConfigurationSettings configuration = iterator.next();
            if (!myRunManager.isConfigurationShared(configuration)) {
                iterator.remove();
                canNotBeShared.add(configuration);
            }
        }
        if (!canNotBeShared.isEmpty()) {
            canNotBeShared.addAll(getLocalConfigurations());
            setStartupConfigurations(sharedConfigurations, canNotBeShared);
        }
    }
}
Also used : RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings)

Example 29 with RunnerAndConfigurationSettings

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

the class ProjectStartupTasksTableModel method reValidateConfigurations.

public void reValidateConfigurations(final Processor<RunnerAndConfigurationSettings> existenceChecker) {
    final Iterator<RunnerAndConfigurationSettings> iterator = myAllConfigurations.iterator();
    while (iterator.hasNext()) {
        final RunnerAndConfigurationSettings settings = iterator.next();
        if (!existenceChecker.process(settings)) {
            iterator.remove();
            mySharedConfigurations.remove(settings);
        }
    }
}
Also used : RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings)

Example 30 with RunnerAndConfigurationSettings

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

the class ProjectStartupTasksTableModel method removeRow.

@Override
public void removeRow(int idx) {
    final RunnerAndConfigurationSettings settings = myAllConfigurations.remove(idx);
    if (settings != null) {
        mySharedConfigurations.remove(settings);
        fireTableDataChanged();
    }
}
Also used : RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings)

Aggregations

RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)104 Project (com.intellij.openapi.project.Project)24 RunConfiguration (com.intellij.execution.configurations.RunConfiguration)16 RunManagerEx (com.intellij.execution.RunManagerEx)14 Nullable (org.jetbrains.annotations.Nullable)14 RunManager (com.intellij.execution.RunManager)12 VirtualFile (com.intellij.openapi.vfs.VirtualFile)11 Module (com.intellij.openapi.module.Module)10 NotNull (org.jetbrains.annotations.NotNull)9 ConfigurationFactory (com.intellij.execution.configurations.ConfigurationFactory)7 ConfigurationType (com.intellij.execution.configurations.ConfigurationType)7 ExternalSystemRunConfiguration (com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunConfiguration)7 ExternalSystemTaskExecutionSettings (com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings)6 Executor (com.intellij.execution.Executor)4 RunManagerImpl (com.intellij.execution.impl.RunManagerImpl)4 AbstractExternalSystemTaskConfigurationType (com.intellij.openapi.externalSystem.service.execution.AbstractExternalSystemTaskConfigurationType)4 ExternalSystemNode (com.intellij.openapi.externalSystem.view.ExternalSystemNode)4 RunConfigurationNode (com.intellij.openapi.externalSystem.view.RunConfigurationNode)4 PsiElement (com.intellij.psi.PsiElement)4 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)3