Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2020-10-15 10:02:49 +0000
committerAndrey Loskutov2020-10-15 10:02:49 +0000
commitcd77bfa5687daef828939599532f98239c55a46f (patch)
treeb58768dd36f9e703bf9ac749ab88dd5d053b3aa3
parent282c53b234648e0ca5c1e4a1619fad9b732de1a2 (diff)
downloadrt.equinox.p2-I20201025-1800.tar.gz
rt.equinox.p2-I20201025-1800.tar.xz
rt.equinox.p2-I20201025-1800.zip
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>
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/IUDetail.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java29
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()]);

Back to the top