use of com.intellij.execution.impl.ConfigurationFromContextWrapper in project intellij-community by JetBrains.
the class PreferredProducerFind method getConfigurationsFromContext.
@Nullable
public static List<ConfigurationFromContext> getConfigurationsFromContext(final Location location, final ConfigurationContext context, final boolean strict) {
if (location == null) {
return null;
}
final ArrayList<ConfigurationFromContext> configurationsFromContext = new ArrayList<>();
for (RuntimeConfigurationProducer producer : findAllProducers(location, context)) {
configurationsFromContext.add(new ConfigurationFromContextWrapper(producer));
}
for (RunConfigurationProducer producer : RunConfigurationProducer.getProducers(context.getProject())) {
ConfigurationFromContext fromContext = producer.findOrCreateConfigurationFromContext(context);
if (fromContext != null) {
configurationsFromContext.add(fromContext);
}
}
if (configurationsFromContext.isEmpty())
return null;
Collections.sort(configurationsFromContext, ConfigurationFromContext.COMPARATOR);
if (strict) {
final ConfigurationFromContext first = configurationsFromContext.get(0);
for (Iterator<ConfigurationFromContext> it = configurationsFromContext.iterator(); it.hasNext(); ) {
ConfigurationFromContext producer = it.next();
if (producer != first && ConfigurationFromContext.COMPARATOR.compare(producer, first) > 0) {
it.remove();
}
}
}
return configurationsFromContext;
}
Aggregations