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 67325 Details for
Bug 114779
PDE UI doesnt allow plug-in exporting unless target platform environment matches the plug-in platform filter
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]
refactored patch for first problem
bug114779-2.txt (text/plain), 7.88 KB, created by
Brian Bauman
on 2007-05-15 17:30:12 EDT
(
hide
)
Description:
refactored patch for first problem
Filename:
MIME Type:
Creator:
Brian Bauman
Created:
2007-05-15 17:30:12 EDT
Size:
7.88 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.core >Index: src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java,v >retrieving revision 1.6 >diff -u -r1.6 FeatureExportOperation.java >--- src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java 6 Feb 2007 03:11:48 -0000 1.6 >+++ src/org/eclipse/pde/internal/core/exports/FeatureExportOperation.java 15 May 2007 21:28:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006 IBM Corporation and others. >+ * Copyright (c) 2006, 2007 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 >@@ -74,7 +74,6 @@ > import org.eclipse.pde.internal.core.ifeature.IFeatureModel; > import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin; > import org.eclipse.pde.internal.core.util.CoreUtility; >-import org.osgi.framework.BundleContext; > import org.osgi.framework.InvalidSyntaxException; > import org.w3c.dom.DOMException; > import org.w3c.dom.Document; >@@ -93,7 +92,7 @@ > > protected HashMap fAntBuildProperties; > >- private State fStateCopy; >+ protected State fStateCopy; > > protected static String FEATURE_POST_PROCESSING = "features.postProcessingSteps.properties"; //$NON-NLS-1$ > protected static String PLUGIN_POST_PROCESSING = "plugins.postProcessingSteps.properties"; //$NON-NLS-1$ >@@ -480,9 +479,7 @@ > return main; > } > if (fStateCopy == null) { >- fStateCopy = main.getFactory().createState(main); >- fStateCopy.setResolver(Platform.getPlatformAdmin().getResolver()); >- fStateCopy.setPlatformProperties(main.getPlatformProperties()); >+ copyState(main); > } > > Dictionary[] dictionaries = fStateCopy.getPlatformProperties(); >@@ -496,6 +493,12 @@ > return fStateCopy; > } > >+ protected void copyState(State state) { >+ fStateCopy = state.getFactory().createState(state); >+ fStateCopy.setResolver(Platform.getPlatformAdmin().getResolver()); >+ fStateCopy.setPlatformProperties(state.getPlatformProperties()); >+ } >+ > private String getDevProperties() { > if (fDevProperties == null) { > fDevProperties = ClasspathHelper.getDevEntriesProperties(fBuildTempLocation + "/dev.properties", false); //$NON-NLS-1$ >@@ -629,8 +632,7 @@ > environment.put("osgi.ws", config[1]); //$NON-NLS-1$ > environment.put("osgi.arch", config[2]); //$NON-NLS-1$ > environment.put("osgi.nl", config[3]); //$NON-NLS-1$ >- >- BundleContext context = PDECore.getDefault().getBundleContext(); >+ > for (int i = 0; i < fInfo.items.length; i++) { > if (fInfo.items[i] instanceof IFeatureModel) { > IFeature feature = ((IFeatureModel) fInfo.items[i]).getFeature(); >@@ -649,17 +651,13 @@ > } > if (bundle == null) > continue; >- try { >- String filterSpec = bundle.getPlatformFilter(); >- if (filterSpec == null|| context.createFilter(filterSpec).match(environment)) { >- Element plugin = doc.createElement("plugin"); //$NON-NLS-1$ >- plugin.setAttribute("id", bundle.getSymbolicName()); //$NON-NLS-1$ >- plugin.setAttribute("version", bundle.getVersion().toString()); //$NON-NLS-1$ >- setAdditionalAttributes(plugin, bundle); >- root.appendChild(plugin); >- } >- } catch (InvalidSyntaxException e) { >- } >+ if (shouldAddPlugin(bundle, environment)) { >+ Element plugin = doc.createElement("plugin"); //$NON-NLS-1$ >+ plugin.setAttribute("id", bundle.getSymbolicName()); //$NON-NLS-1$ >+ plugin.setAttribute("version", bundle.getVersion().toString()); //$NON-NLS-1$ >+ setAdditionalAttributes(plugin, bundle); >+ root.appendChild(plugin); >+ } > } > } > XMLPrintHandler.writeFile(doc, new File(file, "feature.xml")); //$NON-NLS-1$ >@@ -680,5 +678,12 @@ > fHasErrors = true; > } > >- >+ protected boolean shouldAddPlugin(BundleDescription bundle, Dictionary environment) { >+ String filterSpec = bundle.getPlatformFilter(); >+ try { >+ return (filterSpec == null|| PDECore.getDefault().getBundleContext().createFilter(filterSpec).match(environment)); >+ } catch (InvalidSyntaxException e) { >+ } >+ return false; >+ } > } >Index: src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java,v >retrieving revision 1.1 >diff -u -r1.1 PluginExportOperation.java >--- src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java 29 Mar 2006 07:49:44 -0000 1.1 >+++ src/org/eclipse/pde/internal/core/exports/PluginExportOperation.java 15 May 2007 21:28:07 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006 IBM Corporation and others. >+ * Copyright (c) 2006, 2007 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 >@@ -11,7 +11,12 @@ > package org.eclipse.pde.internal.core.exports; > > import java.io.File; >+import java.util.Dictionary; > >+import org.eclipse.osgi.service.resolver.BundleDescription; >+import org.eclipse.osgi.service.resolver.State; >+import org.eclipse.pde.core.plugin.TargetPlatform; >+import org.eclipse.pde.internal.core.TargetPlatformHelper; > > public class PluginExportOperation extends FeatureBasedExportOperation { > >@@ -23,4 +28,34 @@ > createPostProcessingFile(new File(fFeatureLocation, PLUGIN_POST_PROCESSING)); > } > >+ protected State getState(String os, String ws, String arch) { >+ // the way plug-in export works, the os, ws and arch should ALWAYS equal the target settings. >+ if (os.equals(TargetPlatform.getOS()) >+ && ws.equals(TargetPlatform.getWS()) >+ && arch.equals(TargetPlatform.getOSArch()) >+ && fStateCopy != null) >+ return fStateCopy; >+ return super.getState(os, ws, arch); >+ } >+ >+ protected boolean shouldAddPlugin(BundleDescription bundle, >+ Dictionary environment) { >+ // if there is an environment conflict >+ boolean conflict = !super.shouldAddPlugin(bundle, environment); >+ if (conflict) { >+ // make a copy of the state if we haven't already >+ if (fStateCopy == null) >+ copyState(TargetPlatformHelper.getState()); >+ // replace the current BundleDescription with a copy who does not have the platform filter. This will allow the plug-in to be resolved >+ BundleDescription desc = fStateCopy.removeBundle(bundle.getBundleId()); >+ BundleDescription newDesc = fStateCopy.getFactory().createBundleDescription(desc.getBundleId(), desc.getSymbolicName(), >+ desc.getVersion(), desc.getLocation(), desc.getRequiredBundles(), desc.getHost(), desc.getImportPackages(), >+ desc.getExportPackages(), desc.isSingleton(), desc.attachFragments(), desc.dynamicFragments(), null, >+ desc.getExecutionEnvironments(), desc.getGenericRequires(), desc.getGenericCapabilities()); >+ fStateCopy.addBundle(newDesc); >+ } >+ // always include plug-ins, even ones with environment conflicts >+ return true; >+ } >+ > }
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
Flags:
baumanbr
:
review?
Actions:
View
|
Diff
Attachments on
bug 114779
:
30330
|
67310
| 67325