diff options
| author | Ed Merks | 2015-04-06 09:24:11 +0000 |
|---|---|---|
| committer | Ed Merks | 2015-04-06 09:24:11 +0000 |
| commit | 403924c09f686755ceb61f1d3b327644db63e208 (patch) | |
| tree | c335c15943dad41f2f2d30b9165f2dec56d61acd | |
| parent | 8df3a61eb4077bb262facf8c6aee7d7be490da22 (diff) | |
| download | org.eclipse.oomph-403924c09f686755ceb61f1d3b327644db63e208.tar.gz org.eclipse.oomph-403924c09f686755ceb61f1d3b327644db63e208.tar.xz org.eclipse.oomph-403924c09f686755ceb61f1d3b327644db63e208.zip | |
[460925] Ensure that bad product versions can't be used on Mac.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=460925
3 files changed, 36 insertions, 11 deletions
diff --git a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleProductPage.java b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleProductPage.java index fc8451f17..9edd18c00 100644 --- a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleProductPage.java +++ b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleProductPage.java @@ -227,7 +227,8 @@ public class SimpleProductPage extends SimpleInstallerPage implements FilterHand ProductCatalog productCatalog = (ProductCatalog)scope; for (Product product : productCatalog.getProducts()) { - if (noFilter || isFiltered(product.getName(), filter) || isFiltered(product.getLabel(), filter) || isFiltered(product.getDescription(), filter)) + if (!ProductPage.getValidProductVersions(product).isEmpty() + && (noFilter || isFiltered(product.getName(), filter) || isFiltered(product.getLabel(), filter) || isFiltered(product.getDescription(), filter))) { renderProduct(builder, product, zebra, downloadImageURI); zebra = !zebra; diff --git a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java index 179dc7121..31a2fba3c 100644 --- a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java +++ b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java @@ -540,7 +540,7 @@ public class SimpleVariablePage extends SimpleInstallerPage int i = 0; int selection = 0; - for (ProductVersion productVersion : product.getVersions()) + for (ProductVersion productVersion : ProductPage.getValidProductVersions(product)) { String label = productVersion.getLabel(); if (label == null) @@ -548,11 +548,6 @@ public class SimpleVariablePage extends SimpleInstallerPage label = productVersion.getName(); } - if (OS.INSTANCE.isMac() && !label.contains("Mars")) - { - continue; - } - if (defaultProductVersion == null) { defaultProductVersion = productVersion; @@ -1073,7 +1068,7 @@ public class SimpleVariablePage extends SimpleInstallerPage /** * @author Eike Stepper */ - private final class SimplePrompter extends HashMap<String, String>implements SetupPrompter + private final class SimplePrompter extends HashMap<String, String> implements SetupPrompter { private static final long serialVersionUID = 1L; diff --git a/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProductPage.java b/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProductPage.java index 8c469dec9..6bf52166e 100644 --- a/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProductPage.java +++ b/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProductPage.java @@ -53,6 +53,7 @@ import org.eclipse.oomph.util.StringUtil; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.EMap; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.resource.ResourceSet; @@ -95,6 +96,7 @@ import org.eclipse.ui.dialogs.PatternFilter; import java.io.File; import java.util.ArrayList; import java.util.Collection; +import java.util.List; /** * @author Eike Stepper @@ -190,7 +192,7 @@ public class ProductPage extends SetupWizardPage @Override public Object[] getElements(Object object) { - return ((Product)object).getVersions().toArray(); + return getValidProductVersions((Product)object).toArray(); } }); @@ -599,6 +601,10 @@ public class ProductPage extends SetupWizardPage { versionComboViewer.setSelection(new StructuredSelection(version)); } + else + { + error = "The selected product has no versions that can be installed on this platform."; + } } descriptionBrowser.setEnabled(productSelected); @@ -766,12 +772,13 @@ public class ProductPage extends SetupWizardPage public static ProductVersion getDefaultProductVersion(CatalogManager catalogManager, Product product) { ProductVersion version = catalogManager.getSelection().getDefaultProductVersions().get(product); - if (version == null) + List<ProductVersion> validProductVersions = getValidProductVersions(product); + if (!validProductVersions.contains(version)) { ProductVersion firstReleasedProductVersion = null; ProductVersion latestProductVersion = null; ProductVersion latestReleasedProductVersion = null; - for (ProductVersion productVersion : product.getVersions()) + for (ProductVersion productVersion : validProductVersions) { String versionName = productVersion.getName(); if ("latest.released".equals(versionName)) @@ -842,6 +849,28 @@ public class ProductPage extends SetupWizardPage return string; } + public static List<ProductVersion> getValidProductVersions(Product product) + { + EList<ProductVersion> versions = product.getVersions(); + if (OS.INSTANCE.isMac()) + { + // Filter out the older releases because the latest p2, with it's layout changes for the Mac, can't install a correct image from older repositories. + List<ProductVersion> filteredProductVersions = new ArrayList<ProductVersion>(); + for (ProductVersion version : versions) + { + String label = version.getLabel(); + if (label == null || !label.contains("Luna") && !label.contains("Kepler") && !label.contains("Juno")) + { + filteredProductVersions.add(version); + } + } + + return filteredProductVersions; + } + + return versions; + } + public static String getProductImageURI(Product product) { String imageURI = null; |
