use of com.intellij.facet.frameworks.beans.Artifact 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;
}
use of com.intellij.facet.frameworks.beans.Artifact in project intellij-community by JetBrains.
the class VersionsComponent method createComboBox.
private JComboBox createComboBox(String ri) {
final JComboBox comboBox = new JComboBox();
List<Artifact> versions = getSupportedVersions(ri);
comboBox.setModel(new CollectionComboBoxModel(versions, null));
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
updateCurrentVersion(comboBox);
}
});
return comboBox;
}
use of com.intellij.facet.frameworks.beans.Artifact in project intellij-community by JetBrains.
the class VersionsComponent method createRadioButton.
private JRadioButton createRadioButton(final String ri) {
final JRadioButton radioButton = new JRadioButton(ri);
radioButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
for (Pair<JRadioButton, JComboBox> pair : myButtons.values()) {
if (pair.getFirst().equals(radioButton)) {
JComboBox comboBox = pair.second;
comboBox.setEnabled(true);
Artifact currentVersion = getCurrentVersion(ri);
if (currentVersion != null) {
comboBox.setSelectedItem(currentVersion);
} else {
if (comboBox.getSelectedIndex() < 0) {
comboBox.setSelectedItem(getAppropriateVersion(getSupportedVersions(ri)));
} else {
// activate already selected
updateCurrentVersion(comboBox);
}
}
} else {
pair.second.setEnabled(false);
}
}
}
});
return radioButton;
}
use of com.intellij.facet.frameworks.beans.Artifact in project intellij-community by JetBrains.
the class VersionsComponent method addSingletonReferenceImplementationUI.
private void addSingletonReferenceImplementationUI(@NotNull final String ri) {
JComboBox comboBox = createComboBox(ri);
addToPanel(new JLabel(ri), comboBox);
Artifact version = getCurrentVersion(ri);
if (version != null) {
comboBox.setSelectedItem(version);
}
}
use of com.intellij.facet.frameworks.beans.Artifact in project intellij-community by JetBrains.
the class VersionsComponent method updateCurrentVersion.
private void updateCurrentVersion(JComboBox comboBox) {
final Artifact versionInfo = getSelectedVersion(comboBox);
if (versionInfo != null) {
myCurrentVersion = versionInfo;
myValidator.setDescription(getFacetLibrariesValidatorDescription(versionInfo));
myValidator.setRequiredLibraries(getRequiredLibraries(versionInfo));
}
}
Aggregations