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 122394 Details for
Bug 260831
Targetplatfrom materializer doesn't materialize platform specific bundles
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]
patch p1
clipboard.txt (text/plain), 5.65 KB, created by
Markus Kuppe
on 2009-01-13 05:47:32 EST
(
hide
)
Description:
patch p1
Filename:
MIME Type:
Creator:
Markus Kuppe
Created:
2009-01-13 05:47:32 EST
Size:
5.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.buckminster.core >Index: src/java/org/eclipse/buckminster/core/materializer/TargetPlatformMaterializer.java >=================================================================== >--- src/java/org/eclipse/buckminster/core/materializer/TargetPlatformMaterializer.java (revision 9863) >+++ src/java/org/eclipse/buckminster/core/materializer/TargetPlatformMaterializer.java (working copy) >@@ -10,6 +10,8 @@ > import java.io.File; > import java.io.FileNotFoundException; > import java.io.IOException; >+import java.lang.reflect.Field; >+import java.lang.reflect.Modifier; > import java.net.URL; > > import org.eclipse.buckminster.core.CorePlugin; >@@ -72,6 +74,48 @@ > return installSite.getSite(); > } > >+ /** >+ * @param aFeature >+ * The feature to convert into a new IFeature instance that treats platform specific bundles as regular >+ * ones. Thus installs even non matching bundles. >+ * @param context >+ * @return >+ * @throws CoreException >+ */ >+ private IFeature convertFeature(IFeature aFeature, MaterializationContext context) throws CoreException >+ { >+ // A shallow copy should be sufficient >+ IFeature piFeature = new PlatformIgnoringFeature(context); >+ try >+ { >+ Class<?> clazz = aFeature.getClass(); >+ while(clazz != null) >+ { >+ Field[] fields = clazz.getDeclaredFields(); >+ for(int i = 0; i < fields.length; i++) >+ { >+ Field field = fields[i]; >+ if(!(Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())) >+ || field.isEnumConstant()) >+ { >+ field.setAccessible(true); >+ field.set(piFeature, field.get(aFeature)); >+ } >+ } >+ clazz = clazz.getSuperclass(); >+ } >+ } >+ catch(IllegalArgumentException e) >+ { >+ throw BuckminsterException.wrap(e); >+ } >+ catch(IllegalAccessException e) >+ { >+ throw BuckminsterException.wrap(e); >+ } >+ return piFeature; >+ } >+ > @Override > public IPath getDefaultInstallRoot(MaterializationContext context, Resolution resolution) throws CoreException > { >@@ -86,12 +130,6 @@ > } > > @Override >- public String getMaterializerRootDir() >- { >- return "downloads"; //$NON-NLS-1$ >- } >- >- @Override > protected ISite getDestinationSite(MaterializationContext context, IPath destination, IProgressMonitor monitor) > throws CoreException > { >@@ -146,6 +184,12 @@ > } > > @Override >+ public String getMaterializerRootDir() >+ { >+ return "downloads"; //$NON-NLS-1$ >+ } >+ >+ @Override > protected void installFeatures(MaterializationContext context, ISite destinationSite, ISite fromSite, > ISiteFeatureReference[] featureRefs, IProgressMonitor monitor) throws CoreException > { >@@ -171,7 +215,8 @@ > for(ISiteFeatureReference featureRef : featureRefs) > { > IFeature feature = featureRef.getFeature(MonitorUtils.subMonitor(monitor, 50)); >- destinationSite.install(feature, null, MonitorUtils.subMonitor(monitor, 50)); >+ IFeature platformIngoringFeature = convertFeature(feature, context); >+ destinationSite.install(platformIngoringFeature, null, MonitorUtils.subMonitor(monitor, 50)); > } > } > finally >Index: src/java/org/eclipse/buckminster/core/materializer/PlatformIgnoringFeature.java >=================================================================== >--- src/java/org/eclipse/buckminster/core/materializer/PlatformIgnoringFeature.java (revision 0) >+++ src/java/org/eclipse/buckminster/core/materializer/PlatformIgnoringFeature.java (revision 0) >@@ -0,0 +1,64 @@ >+/******************************************************************* >+ * Copyright (c) 2009, Versant GmbH. >+ * The code, documentation and other materials contained herein >+ * are the sole and exclusive property of Versant GmbH. and may >+ * not be disclosed, used, modified, copied or distributed without >+ * prior written consent or license from Versant GmbH. >+ ******************************************************************/ >+ >+package org.eclipse.buckminster.core.materializer; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.core.runtime.PluginVersionIdentifier; >+import org.eclipse.update.core.Feature; >+import org.eclipse.update.core.IFeature; >+import org.eclipse.update.core.IPluginEntry; >+import org.eclipse.update.core.VersionedIdentifier; >+ >+/** >+ * @author Markus Alexander Kuppe <buckminster-dev_eclipse.org at lemmster dot de> >+ * >+ * An {@link IFeature} that ignores platform specific information. Thus installs even non matching platform >+ * specific bundles. >+ */ >+public class PlatformIgnoringFeature extends Feature >+{ >+ >+ private MaterializationContext context; >+ >+ public PlatformIgnoringFeature(MaterializationContext aContext) >+ { >+ context = aContext; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.update.core.Feature#getPluginEntries() >+ */ >+ @Override >+ public IPluginEntry[] getPluginEntries() >+ { >+ IPluginEntry[] pluginEntries = getRawPluginEntries(); >+ >+ // normally this could simply return pluginEntries, but because of https://bugs.eclipse.org/213437 it filters >+ List<IPluginEntry> result = new ArrayList<IPluginEntry>(); >+ for(int i = 0; i < pluginEntries.length; i++) >+ { >+ IPluginEntry iPluginEntry = pluginEntries[i]; >+ VersionedIdentifier versionedIdentifier = iPluginEntry.getVersionedIdentifier(); >+ String identifier = versionedIdentifier.getIdentifier(); >+ PluginVersionIdentifier version = versionedIdentifier.getVersion(); >+ if((identifier.startsWith("org.eclipse.swt.") || identifier.startsWith("org.eclipse.equinox.launcher.")) >+ && (version.getMajorComponent() == 0 && version.getMinorComponent() == 0 && version >+ .getServiceComponent() == 0)) >+ { >+ continue; >+ } >+ result.add(iPluginEntry); >+ } >+ return result.toArray(new IPluginEntry[result.size()]); >+ } >+}
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:
thomas
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 260831
: 122394 |
122395
|
122801
|
122802