Search in sources :

Example 1 with ArtifactItem

use of com.intellij.facet.frameworks.beans.ArtifactItem in project intellij-community by JetBrains.

the class FileSetVersionsFetcherBase method fetchVersions.

@NotNull
@Override
public List<FS> fetchVersions() {
    ApplicationManagerEx.getApplicationEx().assertTimeConsuming();
    final Artifact[] versions;
    if (myGroupId != null) {
        versions = LibrariesDownloadAssistant.getVersions(myGroupId, myLocalUrls);
    } else {
        versions = LibrariesDownloadAssistant.getVersions(myLocalUrls);
    }
    final List<FS> result = new ArrayList<>();
    for (Artifact version : versions) {
        final ArtifactItem[] items = version.getItems();
        final List<F> files = new ArrayList<>();
        for (ArtifactItem item : items) {
            String url = item.getUrl();
            final String prefix = version.getUrlPrefix();
            if (url == null) {
                if (prefix != null) {
                    url = prefix + item.getName();
                }
            } else {
                url = prependPrefix(url, prefix);
            }
            assert url != null;
            files.add(createFileDescription(item, url, prefix));
        }
        result.add(createVersion(version, files));
    }
    Collections.sort(result, VERSIONS_COMPARATOR);
    return result;
}
Also used : ArtifactItem(com.intellij.facet.frameworks.beans.ArtifactItem) ArrayList(java.util.ArrayList) Artifact(com.intellij.facet.frameworks.beans.Artifact) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Artifact (com.intellij.facet.frameworks.beans.Artifact)1 ArtifactItem (com.intellij.facet.frameworks.beans.ArtifactItem)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1