| author | Curtis Windatt | 2013-01-21 04:31:23 (EST) |
|---|---|---|
| committer | Dani Megert | 2013-01-21 04:31:23 (EST) |
| commit | 94f040209db5a615925a905ee41c164fb7a13fbb (patch) (side-by-side diff) | |
| tree | 3d7896e8803c0e3da1af9b2c3f2233ded440a4f4 | |
| parent | 26588774a55819b1dcfca02e88f9c98c7b010bc4 (diff) | |
| download | eclipse.pde.ui-94f040209db5a615925a905ee41c164fb7a13fbb.zip eclipse.pde.ui-94f040209db5a615925a905ee41c164fb7a13fbb.tar.gz eclipse.pde.ui-94f040209db5a615925a905ee41c164fb7a13fbb.tar.bz2 | |
Fixed bug 398308: Samples cannot be loaded from the welcome pagev20130121-093123M20130125-1200M20130125-1000M20130124-1700M20130124-1500M20130123-1500M20130123-1200M20130123-1000
3 files changed, 26 insertions, 11 deletions
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java index 3d7b12e..f86b29c 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -1513,6 +1513,8 @@ public class PDEUIMessages extends NLS { public static String ShowSampleAction_title; public static String ShowSampleAction_msgDesc; public static String ShowSampleAction_msgTitle; + + public static String ShowSampleAction_NoSamplesFound; public static String DependencyExtent_singular; public static String DependencyExtent_plural; public static String DetailsBlock_horizontal; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties index 73a79e5..54395c8 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2012 IBM Corporation and others. +# Copyright (c) 2000, 2013 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at @@ -1782,6 +1782,7 @@ ShowSampleAction_title=Eclipse Samples ShowSampleAction_msgDesc=The samples are currently not installed. Do you want to download samples from Eclipse.org? ShowSampleAction_installing=Installing sample plug-ins ShowSampleAction_msgTitle=Samples +ShowSampleAction_NoSamplesFound=The samples could not be accessed at {0} SelfHostingPropertyPage_label=By default, all output folders are put on the plug-in's classpath when running a runtime Eclipse application. SecondaryBundlesSection_title=Automated Management of Dependencies SelfHostingPropertyPage_viewerLabel=Deselect the folders to be excluded: diff --git a/ui/org.eclipse.pde.ui/src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java b/ui/org.eclipse.pde.ui/src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java index dec79eb..a0c5e6d 100644 --- a/ui/org.eclipse.pde.ui/src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java +++ b/ui/org.eclipse.pde.ui/src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,18 +14,17 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.net.URI; import java.net.URISyntaxException; -import java.util.Collection; -import java.util.Properties; +import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.provisional.configurator.Configurator; import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProfileRegistry; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.operations.InstallOperation; import org.eclipse.equinox.p2.operations.ProvisioningJob; -import org.eclipse.equinox.p2.query.IQuery; -import org.eclipse.equinox.p2.query.QueryUtil; +import org.eclipse.equinox.p2.query.*; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.p2.ui.ProvisioningUI; import org.eclipse.jface.action.Action; @@ -33,6 +32,7 @@ import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.osgi.util.NLS; import org.eclipse.pde.internal.ui.*; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; @@ -44,8 +44,7 @@ import org.osgi.framework.ServiceReference; public class ShowSampleAction extends Action implements IIntroAction { private static final String SAMPLE_FEATURE_ID = "org.eclipse.sdk.samples"; //$NON-NLS-1$ - private static final String SAMPLE_FEATURE_VERSION = "3.3.0"; //$NON-NLS-1$ - private static final String UPDATE_SITE = "http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/pde-ui-home/samples/"; //$NON-NLS-1$ + private static final String UPDATE_SITE = "http://www.eclipse.org/pde/samples/site.xml"; //$NON-NLS-1$ private String sampleId; private ProvisioningUI provUI; @@ -162,7 +161,7 @@ public class ShowSampleAction extends Action implements IIntroAction { } IQuery getSampleFeatureQuery() { - return QueryUtil.createIUQuery(SAMPLE_FEATURE_ID, org.eclipse.equinox.p2.metadata.Version.parseVersion(SAMPLE_FEATURE_VERSION)); + return QueryUtil.createIUQuery(SAMPLE_FEATURE_ID); } /** @@ -210,7 +209,20 @@ public class ShowSampleAction extends Action implements IIntroAction { */ protected Collection findSampleIUs(URI location, SubMonitor monitor) throws ProvisionException { IMetadataRepository repository = provUI.loadMetadataRepository(location, false, monitor.newChild(5)); - return repository.query(getSampleFeatureQuery(), monitor.newChild(5)).toUnmodifiableSet(); + IQueryResult allSamples = repository.query(getSampleFeatureQuery(), monitor.newChild(5)); + if (allSamples.isEmpty()) { + throw new ProvisionException(NLS.bind(PDEUIMessages.ShowSampleAction_NoSamplesFound, location.toString())); + } + IInstallableUnit toInstall = null; + for (Iterator iterator = allSamples.iterator(); iterator.hasNext();) { + IInstallableUnit current = (IInstallableUnit) iterator.next(); + if (toInstall == null || toInstall.getVersion().compareTo(current.getVersion()) < 0) { + toInstall = current; + } + } + Collection result = new ArrayList(1); + result.add(toInstall); + return result; } /** |

