add an overloading for getting plugins for the current build

This commit is contained in:
Sergey Ignatov
2015-09-17 18:15:57 +03:00
parent 6017746ee1
commit 0f888a6f03
5 changed files with 15 additions and 9 deletions

View File

@@ -194,7 +194,7 @@ public class PluginHostsConfigurable extends BaseConfigurable implements Configu
public void run(@NotNull ProgressIndicator indicator) {
String host = correctRepositoryRule(getTextField().getText());
try {
result = RepositoryHelper.loadPlugins(host, null, indicator).size();
result = RepositoryHelper.loadPlugins(host, indicator).size();
}
catch (Exception e) {
error = e;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@ public class PluginInstaller {
Map<PluginId, IdeaPluginDescriptor> allPlugins = ContainerUtil.newHashMap();
for (String host : hosts) {
try {
List<IdeaPluginDescriptor> descriptors = RepositoryHelper.loadPlugins(host, null, indicator);
List<IdeaPluginDescriptor> descriptors = RepositoryHelper.loadPlugins(host, indicator);
for (IdeaPluginDescriptor descriptor : descriptors) {
allPlugins.put(descriptor.getPluginId(), descriptor);
}

View File

@@ -339,7 +339,7 @@ public abstract class PluginManagerMain implements Disposable {
for (String host : hosts) {
try {
if (host == null || acceptHost(host)) {
List<IdeaPluginDescriptor> plugins = RepositoryHelper.loadPlugins(host, null, indicator);
List<IdeaPluginDescriptor> plugins = RepositoryHelper.loadPlugins(host, indicator);
for (IdeaPluginDescriptor plugin : plugins) {
if (unique.add(plugin.getPluginId())) {
list.add(plugin);

View File

@@ -81,7 +81,7 @@ public class RepositoryHelper {
List<IdeaPluginDescriptor> result = new ArrayList<IdeaPluginDescriptor>();
Set<String> addedPluginIds = new HashSet<String>();
for (String host : getPluginHosts()) {
List<IdeaPluginDescriptor> plugins = loadPlugins(host, null, indicator);
List<IdeaPluginDescriptor> plugins = loadPlugins(host, indicator);
for (IdeaPluginDescriptor plugin : plugins) {
if (addedPluginIds.add(plugin.getPluginId().getIdString())) {
result.add(plugin);
@@ -96,16 +96,22 @@ public class RepositoryHelper {
*/
@NotNull
public static List<IdeaPluginDescriptor> loadPlugins(@Nullable ProgressIndicator indicator) throws IOException {
return loadPlugins(null, null, indicator);
return loadPlugins(null, indicator);
}
@NotNull
public static List<IdeaPluginDescriptor> loadPlugins(@Nullable String repositoryUrl, @Nullable ProgressIndicator indicator) throws IOException {
boolean forceHttps = repositoryUrl == null && IdeaApplication.isLoaded() && UpdateSettings.getInstance().canUseSecureConnection();
return loadPlugins(repositoryUrl, null, forceHttps, indicator);
}
/**
* Loads list of plugins, compatible with a given build, from a given plugin repository (main repository if null).
*/
@NotNull
public static List<IdeaPluginDescriptor> loadPlugins(@Nullable String repositoryUrl,
@Nullable BuildNumber buildnumber,
@Nullable final ProgressIndicator indicator) throws IOException {
@Nullable ProgressIndicator indicator) throws IOException {
boolean forceHttps = repositoryUrl == null && IdeaApplication.isLoaded() && UpdateSettings.getInstance().canUseSecureConnection();
return loadPlugins(repositoryUrl, buildnumber, forceHttps, indicator);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -114,6 +114,6 @@ public class RepositoryHelperTest {
private List<IdeaPluginDescriptor> loadPlugins(String data) throws IOException {
FileUtil.writeToFile(myTempFile, data);
String url = myTempFile.toURI().toURL().toString();
return RepositoryHelper.loadPlugins(url, null, null);
return RepositoryHelper.loadPlugins(url, null);
}
}