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.core.plugin.IPluginModelBase; 18 import org.eclipse.pde.core.plugin.PluginRegistry; 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.exports.PluginExportOperation; 22 23 public class PluginExportTask extends BaseExportTask { 24 protected IPluginModelBase[] fPlugins = new IPluginModelBase[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 = fPlugins; 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 PluginExportOperation(info); 42 } 43 44 public void setPlugins(String plugins) { 45 StringTokenizer tok = new StringTokenizer (plugins, ","); ArrayList models = new ArrayList (); 47 while (tok.hasMoreTokens()) { 48 String id = tok.nextToken().trim(); 49 IPluginModelBase model = PluginRegistry.findModel(id); 50 if (model != null) 51 models.add(model); 52 } 53 fPlugins = (IPluginModelBase[])models.toArray(new IPluginModelBase[models.size()]); 54 } 55 56 } 57 | Popular Tags |