Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 163589 Details for
Bug 210529
[update] Error installing examples with p2-provisioned SDK
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Draft fix
patch.txt (text/plain), 5.84 KB, created by
John Arthorne
on 2010-03-31 17:44:27 EDT
(
hide
)
Description:
Draft fix
Filename:
MIME Type:
Creator:
John Arthorne
Created:
2010-03-31 17:44:27 EDT
Size:
5.84 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.ui >Index: src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java,v >retrieving revision 1.10 >diff -u -r1.10 ShowSampleAction.java >--- src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java 27 May 2009 20:38:23 -0000 1.10 >+++ src_samples/org/eclipse/pde/internal/ui/samples/ShowSampleAction.java 31 Mar 2010 21:43:28 -0000 >@@ -11,14 +11,26 @@ > package org.eclipse.pde.internal.ui.samples; > > import java.lang.reflect.InvocationTargetException; >+import java.net.URI; >+import java.net.URISyntaxException; >+import java.util.Collection; > import java.util.Properties; > import org.eclipse.core.runtime.*; >+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.operations.InstallOperation; >+import org.eclipse.equinox.p2.operations.ProvisioningJob; >+import org.eclipse.equinox.p2.query.*; >+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; >+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; >+import org.eclipse.equinox.p2.ui.ProvisioningUI; > import org.eclipse.jface.action.Action; > 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.pde.internal.core.util.VersionUtil; > import org.eclipse.pde.internal.ui.PDEPlugin; > import org.eclipse.pde.internal.ui.PDEUIMessages; > import org.eclipse.swt.widgets.Shell; >@@ -26,10 +38,6 @@ > import org.eclipse.ui.WorkbenchException; > import org.eclipse.ui.intro.IIntroSite; > import org.eclipse.ui.intro.config.*; >-import org.eclipse.update.configurator.ConfiguratorUtils; >-import org.eclipse.update.configurator.IPlatformConfiguration; >-import org.eclipse.update.standalone.InstallCommand; >-import org.osgi.framework.Version; > > public class ShowSampleAction extends Action implements IIntroAction { > private static final String SAMPLE_FEATURE_ID = "org.eclipse.sdk.samples"; //$NON-NLS-1$ >@@ -120,28 +128,34 @@ > } > > private boolean checkFeature() { >- IPlatformConfiguration config = ConfiguratorUtils.getCurrentPlatformConfiguration(); >- IPlatformConfiguration.IFeatureEntry[] features = config.getConfiguredFeatureEntries(); >- Version sampleVersion = new Version(SAMPLE_FEATURE_VERSION); >- for (int i = 0; i < features.length; i++) { >- String id = features[i].getFeatureIdentifier(); >- if (SAMPLE_FEATURE_ID.equals(id)) { >- String version = features[i].getFeatureVersion(); >- Version fversion = Version.parseVersion(version); >- if (VersionUtil.isCompatibleWith(fversion, sampleVersion)) >- return true; >- } >- } >- return false; >+ IProvisioningAgent agent = getProvisioningAgent(); >+ IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); >+ IProfile profile = registry.getProfile(IProfileRegistry.SELF); >+ return profile.query(getSampleFeatureQuery(), null).isEmpty(); >+ } >+ >+ IQuery getSampleFeatureQuery() { >+ return QueryUtil.createIUQuery(SAMPLE_FEATURE_ID, org.eclipse.equinox.p2.metadata.Version.parseVersion(SAMPLE_FEATURE_VERSION)); > } > > private boolean downloadFeature() { > IRunnableWithProgress op = new IRunnableWithProgress() { >- public void run(IProgressMonitor monitor) throws InvocationTargetException { >+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { > try { >- InstallCommand command = new InstallCommand(SAMPLE_FEATURE_ID, SAMPLE_FEATURE_VERSION, UPDATE_SITE, null, "false"); //$NON-NLS-1$ >- command.run(monitor); >- command.applyChangesNow(); >+ SubMonitor sub = SubMonitor.convert(monitor, 100); >+ InstallOperation operation = createInstallOperation(sub.newChild(10)); >+ operation.resolveModal(sub.newChild(20)); >+ IStatus status = operation.getResolutionResult(); >+ if (status.getSeverity() == IStatus.CANCEL) { >+ throw new InterruptedException(); >+ } else if (!(status.isOK() || status.getSeverity() == IStatus.INFO)) { >+ throw new CoreException(status); >+ } >+ ProvisioningJob job = operation.getProvisioningJob(null); >+ status = job.runModal(sub.newChild(70)); >+ if (!(status.isOK() || status.getSeverity() == IStatus.INFO)) { >+ throw new CoreException(status); >+ } > } catch (Exception e) { > throw new InvocationTargetException(e); > } >@@ -157,4 +171,24 @@ > } > return true; > } >+ >+ protected Collection findSampleIUs(IProvisioningAgent agent, URI location, SubMonitor monitor) throws ProvisionException { >+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME); >+ IMetadataRepository repository = manager.loadRepository(location, monitor.newChild(5)); >+ IQueryResult result = repository.query(getSampleFeatureQuery(), monitor.newChild(5)); >+ return result.toUnmodifiableSet(); >+ } >+ >+ protected IProvisioningAgent getProvisioningAgent() { >+ return null; >+ } >+ >+ InstallOperation createInstallOperation(SubMonitor monitor) throws URISyntaxException, ProvisionException { >+ IProvisioningAgent agent = getProvisioningAgent(); >+ URI repositoryLocation = new URI(UPDATE_SITE); >+ Collection sampleIUs = findSampleIUs(agent, repositoryLocation, monitor); >+ URI[] repos = new URI[] {repositoryLocation}; >+ InstallOperation operation = ProvisioningUI.getDefaultUI().getInstallOperation(sampleIUs, repos); >+ return operation; >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 210529
:
126210
|
163589
|
163590
|
163666