|
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 |