diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java | 29 |
1 files changed, 17 insertions, 12 deletions
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()]); |