1 11 package org.eclipse.pde.internal.ui.ant; 12 13 import java.util.ArrayList ; 14 import java.util.StringTokenizer ; 15 16 import org.eclipse.core.runtime.jobs.Job; 17 import org.eclipse.pde.internal.core.PDECore; 18 import org.eclipse.pde.internal.core.WorkspaceModelManager; 19 import org.eclipse.pde.internal.core.ifeature.IFeatureModel; 20 import org.eclipse.pde.internal.ui.build.FeatureExportInfo; 21 import org.eclipse.pde.internal.ui.build.FeatureExportJob; 22 23 public class FeatureExportTask extends BaseExportTask { 24 private IFeatureModel[] fFeatures = new IFeatureModel[0]; 25 26 29 protected Job getExportJob() { 30 FeatureExportInfo info = new FeatureExportInfo(); 31 info.toDirectory = fToDirectory; 32 info.useJarFormat = fUseJarFormat; 33 info.exportSource = fExportSource; 34 info.destinationDirectory = fDestination; 35 info.zipFileName = fZipFilename; 36 info.items = fFeatures; 37 info.javacSource = fJavacSource; 38 info.javacTarget = fJavacTarget; 39 return new FeatureExportJob(info); 40 } 41 42 public void setFeatures(String features) { 43 StringTokenizer tok = new StringTokenizer (features, ","); ArrayList list = new ArrayList (); 45 while (tok.hasMoreTokens()) { 46 list.add(tok.nextToken().trim()); 47 } 48 49 WorkspaceModelManager manager = PDECore.getDefault().getWorkspaceModelManager(); 50 ArrayList featureList = new ArrayList (); 51 IFeatureModel[] models = manager.getFeatureModels(); 52 for (int i = 0; i < models.length; i++) { 53 String id = models[i].getFeature().getId(); 54 if (list.contains(id)) 55 featureList.add(models[i]); 56 } 57 fFeatures = (IFeatureModel[])featureList.toArray(new IFeatureModel[featureList.size()]); 58 } 59 } 60 | Popular Tags |