1 11 package org.eclipse.pde.internal.build.packager; 12 13 import java.util.*; 14 import org.eclipse.core.runtime.CoreException; 15 import org.eclipse.pde.internal.build.*; 16 import org.eclipse.pde.internal.build.builder.FeatureBuildScriptGenerator; 17 import org.eclipse.update.core.IFeature; 18 import org.eclipse.update.core.IIncludedFeatureReference; 19 import org.eclipse.update.core.model.IncludedFeatureReferenceModel; 20 21 public class ElementCollector extends FeatureBuildScriptGenerator { 22 public ElementCollector(String featureId, AssemblyInformation assemblageInformation) throws CoreException { 23 super(featureId, null, assemblageInformation); 24 } 25 26 protected void generateIncludedFeatureBuildFile() throws CoreException { 27 IIncludedFeatureReference[] referencedFeatures = feature.getIncludedFeatureReferences(); 28 for (int i = 0; i < referencedFeatures.length; i++) { 29 String featureId = ((IncludedFeatureReferenceModel) referencedFeatures[i]).getFeatureIdentifier(); 30 FeatureBuildScriptGenerator generator = new ElementCollector(featureId, assemblyData); 31 generator.setGenerateIncludedFeatures(true); 32 generator.setAnalyseChildren(true); 33 generator.setSourceFeatureGeneration(false); 34 generator.setBinaryFeatureGeneration(true); 35 generator.setScriptGeneration(false); 36 generator.setPluginPath(pluginPath); 37 generator.setBuildSiteFactory(siteFactory); 38 generator.setDevEntries(devEntries); 39 generator.setCompiledElements(getCompiledElements()); 40 generator.setBuildingOSGi(isBuildingOSGi()); 41 generator.includePlatformIndependent(isPlatformIndependentIncluded()); 42 generator.setIgnoreMissingPropertiesFile(isIgnoreMissingPropertiesFile()); 43 try { 44 generator.generate(); 45 } catch (CoreException exception) { 46 if (exception.getStatus().getCode() != EXCEPTION_FEATURE_MISSING || (exception.getStatus().getCode() == EXCEPTION_FEATURE_MISSING && !referencedFeatures[i].isOptional())) 48 throw exception; 49 } 50 } 51 } 52 53 protected void collectElementToAssemble(IFeature featureToCollect) { 54 if (assemblyData == null) 55 return; 56 List correctConfigs = selectConfigs(featureToCollect); 57 for (Iterator iter = correctConfigs.iterator(); iter.hasNext();) { 59 Config config = (Config) iter.next(); 60 assemblyData.addFeature(config, feature); 61 } 62 } 63 64 } 65 | Popular Tags |