1 11 package org.eclipse.pde.internal.core.ant; 12 13 import java.io.File ; 14 import java.util.ArrayList ; 15 import java.util.StringTokenizer ; 16 17 import org.eclipse.pde.internal.core.FeatureModelManager; 18 import org.eclipse.pde.internal.core.PDECore; 19 import org.eclipse.pde.internal.core.exports.FeatureExportInfo; 20 import org.eclipse.pde.internal.core.exports.FeatureExportOperation; 21 import org.eclipse.pde.internal.core.ifeature.IFeatureModel; 22 23 public class FeatureExportTask extends BaseExportTask { 24 private IFeatureModel[] fFeatures = new IFeatureModel[0]; 25 26 protected FeatureExportOperation getExportOperation() { 27 FeatureExportInfo info = new FeatureExportInfo(); 28 info.toDirectory = fToDirectory; 29 info.useJarFormat = fUseJarFormat; 30 info.exportSource = fExportSource; 31 info.zipFileName = fZipFilename; 32 info.items = fFeatures; 33 info.qualifier = fQualifier; 34 if (!new File (fDestination).isAbsolute()) { 36 File home = new File (getLocation().getFileName()).getParentFile(); 37 info.destinationDirectory = new File (home, fDestination).toString(); 38 } 39 else 40 info.destinationDirectory = fDestination; 41 return new FeatureExportOperation(info); 42 } 43 44 public void setFeatures(String features) { 45 StringTokenizer tok = new StringTokenizer (features, ","); FeatureModelManager manager = PDECore.getDefault().getFeatureModelManager(); 47 ArrayList list = new ArrayList (); 48 while (tok.hasMoreTokens()) { 49 String id = tok.nextToken().trim(); 50 IFeatureModel model = manager.findFeatureModel(id); 51 if (model != null) 52 list.add(model); 53 } 54 55 fFeatures = (IFeatureModel[])list.toArray(new IFeatureModel[list.size()]); 56 } 57 } 58 | Popular Tags |