Search in sources :

Example 71 with RunnerAndConfigurationSettings

use of com.intellij.execution.RunnerAndConfigurationSettings 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 72 with RunnerAndConfigurationSettings

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

the class BaseRCSettingsConfigurable method isModified.

@Override
public boolean isModified() {
    try {
        RunnerAndConfigurationSettings original = getSettings();
        RunnerAndConfigurationSettings snapshot = getEditor().getSnapshot();
        final RunManagerImpl runManager = RunManagerImpl.getInstanceImpl(original.getConfiguration().getProject());
        if (runManager.findExistingConfigurationId(original) == null)
            return true;
        if (!super.isModified())
            return false;
        if (!original.isTemplate() && runManager.findExistingConfigurationId(original) == null) {
            return true;
        }
        if (isSnapshotSpecificallyModified(runManager, original, snapshot)) {
            return true;
        }
        if (!runManager.getBeforeRunTasks(original.getConfiguration()).equals(runManager.getBeforeRunTasks(snapshot.getConfiguration()))) {
            return true;
        }
        if (original instanceof JDOMExternalizable && snapshot instanceof JDOMExternalizable) {
            applySnapshotToComparison(original, snapshot);
            Element originalElement = new Element("config");
            Element snapshotElement = new Element("config");
            ((JDOMExternalizable) original).writeExternal(originalElement);
            ((JDOMExternalizable) snapshot).writeExternal(snapshotElement);
            patchElementsIfNeed(originalElement, snapshotElement);
            boolean result = !JDOMUtil.areElementsEqual(originalElement, snapshotElement, true);
            if (!result) {
                super.setModified(false);
            }
            return result;
        }
    } catch (ConfigurationException e) {
    //ignore
    }
    return super.isModified();
}
Also used : ConfigurationException(com.intellij.openapi.options.ConfigurationException) JDOMExternalizable(com.intellij.openapi.util.JDOMExternalizable) Element(org.jdom.Element) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings)

Example 73 with RunnerAndConfigurationSettings

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

the class AbstractRunConfigurationTypeUsagesCollector method getProjectUsages.

@NotNull
@Override
public final Set<UsageDescriptor> getProjectUsages(@NotNull final Project project) {
    final Set<String> runConfigurationTypes = new HashSet<>();
    UIUtil.invokeAndWaitIfNeeded(new Runnable() {

        @Override
        public void run() {
            if (project.isDisposed())
                return;
            final RunManager runManager = RunManager.getInstance(project);
            for (RunnerAndConfigurationSettings settings : runManager.getAllSettings()) {
                RunConfiguration runConfiguration = settings.getConfiguration();
                if (runConfiguration != null && isApplicable(runManager, settings)) {
                    final ConfigurationFactory configurationFactory = runConfiguration.getFactory();
                    final ConfigurationType configurationType = configurationFactory.getType();
                    final StringBuilder keyBuilder = new StringBuilder();
                    keyBuilder.append(configurationType.getId());
                    if (configurationType.getConfigurationFactories().length > 1) {
                        keyBuilder.append(".").append(configurationFactory.getName());
                    }
                    runConfigurationTypes.add(keyBuilder.toString());
                }
            }
        }
    });
    return ContainerUtil.map2Set(runConfigurationTypes, runConfigurationType -> new UsageDescriptor(runConfigurationType, 1));
}
Also used : ConfigurationType(com.intellij.execution.configurations.ConfigurationType) RunConfiguration(com.intellij.execution.configurations.RunConfiguration) ConfigurationFactory(com.intellij.execution.configurations.ConfigurationFactory) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) UsageDescriptor(com.intellij.internal.statistic.beans.UsageDescriptor) RunManager(com.intellij.execution.RunManager) HashSet(com.intellij.util.containers.HashSet) NotNull(org.jetbrains.annotations.NotNull)

Example 74 with RunnerAndConfigurationSettings

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

the class ConfigurationTypeDashboardGroupingRule method getGroup.

@Nullable
@Override
public DashboardGroup getGroup(AbstractTreeNode<?> node) {
    if (node instanceof DashboardRunConfigurationNode) {
        RunnerAndConfigurationSettings configurationSettings = ((DashboardRunConfigurationNode) node).getConfigurationSettings();
        ConfigurationType type = configurationSettings.getType();
        if (type != null) {
            return new DashboardGroupImpl<>(type, type.getDisplayName(), type.getIcon());
        }
    }
    return null;
}
Also used : ConfigurationType(com.intellij.execution.configurations.ConfigurationType) DashboardRunConfigurationNode(com.intellij.execution.dashboard.DashboardRunConfigurationNode) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) Nullable(org.jetbrains.annotations.Nullable)

Example 75 with RunnerAndConfigurationSettings

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

the class FolderDashboardGroupingRule method getGroup.

@Nullable
@Override
public DashboardGroup getGroup(AbstractTreeNode<?> node) {
    if (node instanceof DashboardRunConfigurationNode) {
        RunnerAndConfigurationSettings configurationSettings = ((DashboardRunConfigurationNode) node).getConfigurationSettings();
        String folderName = configurationSettings.getFolderName();
        if (folderName != null) {
            return new DashboardGroupImpl<>(folderName, folderName, AllIcons.Nodes.Folder);
        }
    }
    return null;
}
Also used : DashboardRunConfigurationNode(com.intellij.execution.dashboard.DashboardRunConfigurationNode) RunnerAndConfigurationSettings(com.intellij.execution.RunnerAndConfigurationSettings) Nullable(org.jetbrains.annotations.Nullable)

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