diff options
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()]); |