diff options
author | Andrey Loskutov | 2020-10-15 10:02:49 +0000 |
---|---|---|
committer | Andrey Loskutov | 2020-10-15 10:02:49 +0000 |
commit | cd77bfa5687daef828939599532f98239c55a46f (patch) | |
tree | b58768dd36f9e703bf9ac749ab88dd5d053b3aa3 | |
parent | 282c53b234648e0ca5c1e4a1619fad9b732de1a2 (diff) | |
download | rt.equinox.p2-Y20201021-1200.tar.gz rt.equinox.p2-Y20201021-1200.tar.xz rt.equinox.p2-Y20201021-1200.zip |
Bug 567899 - P2 import software "install latest versions" not workingY20201102-1200Y20201101-1200Y20201031-1200Y20201030-1200Y20201029-1200Y20201028-1200Y20201027-1200Y20201026-1200Y20201025-1200Y20201024-1200Y20201023-1200Y20201021-1200Y20201020-1200Y20201019-1200Y20201018-1200Y20201017-1200Y20201016-1200Y20201015-1200I20201103-0030I20201102-1910I20201101-1800I20201031-1800I20201030-1800I20201029-1800I20201028-1800I20201028-0800I20201028-0610I20201028-0130I20201028-0020I20201027-2350I20201027-1800I20201026-1850I20201026-0840I20201026-0650I20201025-1800I20201025-0040I20201024-1800I20201023-1800I20201023-0250I20201021-1800I20201021-0200I20201020-1800I20201020-0240I20201019-1800I20201018-1800I20201017-1800I20201016-1800I20201016-0000I20201015-1800
Fixed selection algorithm to install "latest" versions if asked to do
so, and install "oldest" versions otherwise.
Change-Id: I929b5d5f458810acd62df2d8982a89d49aa494b3
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2 files changed, 33 insertions, 12 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/IUDetail.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/IUDetail.java index 0a547d078..50087fd61 100644 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/IUDetail.java +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/IUDetail.java @@ -59,4 +59,20 @@ public class IUDetail implements IAdaptable { public int hashCode() { return iu.hashCode(); } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + if (iu != null) { + sb.append("iu="); //$NON-NLS-1$ + sb.append(iu); + sb.append(", "); //$NON-NLS-1$ + } + if (referredRepo != null) { + sb.append("referredRepo="); //$NON-NLS-1$ + sb.append(referredRepo); + } + sb.append("]"); //$NON-NLS-1$ + return sb.toString(); + } } diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java index 56ff67ec3..63084646a 100644 --- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java +++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java @@ -328,27 +328,32 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage public Object[] getCheckedIUElements() { Object[] checked = viewer.getCheckedElements(); List<IUDetail> checkedFeatures = new ArrayList<>(checked.length); + boolean useLatest = installLatest.getSelection(); for (Object checked1 : checked) { IUDetail feature = (IUDetail) checked1; IUDetail[] existingFeatures = newProposedFeature.get(feature); - if (existingFeatures == null) + if (existingFeatures == null) { checkedFeatures.add(feature); - else { + } else { IUDetail matchPolicy = null; for (IUDetail f : existingFeatures) { - if (matchPolicy == null) - matchPolicy = f; - // here use exact match - else if (matchPolicy.getIU().getVersion().compareTo(f.getIU().getVersion()) < 0) { - if (installLatest.getSelection()) - matchPolicy = f; - else - continue; - } else + if (matchPolicy == null) { matchPolicy = f; + } else { + if (matchPolicy.getIU().getVersion().compareTo(f.getIU().getVersion()) < 0) { + if (useLatest) { + matchPolicy = f; + } + } else { + if (!useLatest) { + matchPolicy = f; + } + } + } } - if (matchPolicy != null) + if (matchPolicy != null) { checkedFeatures.add(matchPolicy); + } } } return checkedFeatures.toArray(new IUDetail[checkedFeatures.size()]); |