Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 260831 | Differences between
and this patch

Collapse All | Expand All

(-)src/java/org/eclipse/buckminster/core/materializer/TargetPlatformMaterializer.java (-7 / +52 lines)
Lines 10-15 Link Here
10
import java.io.File;
10
import java.io.File;
11
import java.io.FileNotFoundException;
11
import java.io.FileNotFoundException;
12
import java.io.IOException;
12
import java.io.IOException;
13
import java.lang.reflect.Field;
14
import java.lang.reflect.Modifier;
13
import java.net.URL;
15
import java.net.URL;
14
16
15
import org.eclipse.buckminster.core.CorePlugin;
17
import org.eclipse.buckminster.core.CorePlugin;
Lines 72-77 Link Here
72
		return installSite.getSite();
74
		return installSite.getSite();
73
	}
75
	}
74
76
77
	/**
78
	 * @param aFeature
79
	 *            The feature to convert into a new IFeature instance that treats platform specific bundles as regular
80
	 *            ones. Thus installs even non matching bundles.
81
	 * @param context
82
	 * @return
83
	 * @throws CoreException
84
	 */
85
	private IFeature convertFeature(IFeature aFeature, MaterializationContext context) throws CoreException
86
	{
87
		// A shallow copy should be sufficient
88
		IFeature piFeature = new PlatformIgnoringFeature(context);
89
		try
90
		{
91
			Class<?> clazz = aFeature.getClass();
92
			while(clazz != null)
93
			{
94
				Field[] fields = clazz.getDeclaredFields();
95
				for(int i = 0; i < fields.length; i++)
96
				{
97
					Field field = fields[i];
98
					if(!(Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()))
99
							|| field.isEnumConstant())
100
					{
101
						field.setAccessible(true);
102
						field.set(piFeature, field.get(aFeature));
103
					}
104
				}
105
				clazz = clazz.getSuperclass();
106
			}
107
		}
108
		catch(IllegalArgumentException e)
109
		{
110
			throw BuckminsterException.wrap(e);
111
		}
112
		catch(IllegalAccessException e)
113
		{
114
			throw BuckminsterException.wrap(e);
115
		}
116
		return piFeature;
117
	}
118
75
	@Override
119
	@Override
76
	public IPath getDefaultInstallRoot(MaterializationContext context, Resolution resolution) throws CoreException
120
	public IPath getDefaultInstallRoot(MaterializationContext context, Resolution resolution) throws CoreException
77
	{
121
	{
Lines 86-97 Link Here
86
	}
130
	}
87
131
88
	@Override
132
	@Override
89
	public String getMaterializerRootDir()
90
	{
91
		return "downloads"; //$NON-NLS-1$
92
	}
93
94
	@Override
95
	protected ISite getDestinationSite(MaterializationContext context, IPath destination, IProgressMonitor monitor)
133
	protected ISite getDestinationSite(MaterializationContext context, IPath destination, IProgressMonitor monitor)
96
			throws CoreException
134
			throws CoreException
97
	{
135
	{
Lines 146-151 Link Here
146
	}
184
	}
147
185
148
	@Override
186
	@Override
187
	public String getMaterializerRootDir()
188
	{
189
		return "downloads"; //$NON-NLS-1$
190
	}
191
192
	@Override
149
	protected void installFeatures(MaterializationContext context, ISite destinationSite, ISite fromSite,
193
	protected void installFeatures(MaterializationContext context, ISite destinationSite, ISite fromSite,
150
			ISiteFeatureReference[] featureRefs, IProgressMonitor monitor) throws CoreException
194
			ISiteFeatureReference[] featureRefs, IProgressMonitor monitor) throws CoreException
151
	{
195
	{
Lines 171-177 Link Here
171
			for(ISiteFeatureReference featureRef : featureRefs)
215
			for(ISiteFeatureReference featureRef : featureRefs)
172
			{
216
			{
173
				IFeature feature = featureRef.getFeature(MonitorUtils.subMonitor(monitor, 50));
217
				IFeature feature = featureRef.getFeature(MonitorUtils.subMonitor(monitor, 50));
174
				destinationSite.install(feature, null, MonitorUtils.subMonitor(monitor, 50));
218
				IFeature platformIngoringFeature = convertFeature(feature, context);
219
				destinationSite.install(platformIngoringFeature, null, MonitorUtils.subMonitor(monitor, 50));
175
			}
220
			}
176
		}
221
		}
177
		finally
222
		finally
(-)src/java/org/eclipse/buckminster/core/materializer/PlatformIgnoringFeature.java (+64 lines)
Line 0 Link Here
1
/*******************************************************************
2
 * Copyright (c) 2009, Versant GmbH.
3
 * The code, documentation and other materials contained herein
4
 * are the sole and exclusive property of Versant GmbH. and may
5
 * not be disclosed, used, modified, copied or distributed without
6
 * prior written consent or license from Versant GmbH.
7
 ******************************************************************/
8
9
package org.eclipse.buckminster.core.materializer;
10
11
import java.util.ArrayList;
12
import java.util.List;
13
14
import org.eclipse.core.runtime.PluginVersionIdentifier;
15
import org.eclipse.update.core.Feature;
16
import org.eclipse.update.core.IFeature;
17
import org.eclipse.update.core.IPluginEntry;
18
import org.eclipse.update.core.VersionedIdentifier;
19
20
/**
21
 * @author Markus Alexander Kuppe <buckminster-dev_eclipse.org at lemmster dot de>
22
 * 
23
 *         An {@link IFeature} that ignores platform specific information. Thus installs even non matching platform
24
 *         specific bundles.
25
 */
26
public class PlatformIgnoringFeature extends Feature
27
{
28
29
	private MaterializationContext context;
30
31
	public PlatformIgnoringFeature(MaterializationContext aContext)
32
	{
33
		context = aContext;
34
	}
35
36
	/*
37
	 * (non-Javadoc)
38
	 * 
39
	 * @see org.eclipse.update.core.Feature#getPluginEntries()
40
	 */
41
	@Override
42
	public IPluginEntry[] getPluginEntries()
43
	{
44
		IPluginEntry[] pluginEntries = getRawPluginEntries();
45
46
		// normally this could simply return pluginEntries, but because of https://bugs.eclipse.org/213437 it filters
47
		List<IPluginEntry> result = new ArrayList<IPluginEntry>();
48
		for(int i = 0; i < pluginEntries.length; i++)
49
		{
50
			IPluginEntry iPluginEntry = pluginEntries[i];
51
			VersionedIdentifier versionedIdentifier = iPluginEntry.getVersionedIdentifier();
52
			String identifier = versionedIdentifier.getIdentifier();
53
			PluginVersionIdentifier version = versionedIdentifier.getVersion();
54
			if((identifier.startsWith("org.eclipse.swt.") || identifier.startsWith("org.eclipse.equinox.launcher."))
55
					&& (version.getMajorComponent() == 0 && version.getMinorComponent() == 0 && version
56
							.getServiceComponent() == 0))
57
			{
58
				continue;
59
			}
60
			result.add(iPluginEntry);
61
		}
62
		return result.toArray(new IPluginEntry[result.size()]);
63
	}
64
}

Return to bug 260831