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.core.plugin.IMatchRules; 18 import org.eclipse.pde.core.plugin.IPluginModelBase; 19 import org.eclipse.pde.internal.core.PDECore; 20 import org.eclipse.pde.internal.core.PluginModelManager; 21 import org.eclipse.pde.internal.ui.build.FeatureExportInfo; 22 import org.eclipse.pde.internal.ui.build.PluginExportJob; 23 24 public class PluginExportTask extends BaseExportTask { 25 protected IPluginModelBase[] fPlugins = new IPluginModelBase[0]; 26 27 30 protected Job getExportJob() { 31 FeatureExportInfo info = new FeatureExportInfo(); 32 info.toDirectory = fToDirectory; 33 info.useJarFormat = fUseJarFormat; 34 info.exportSource = fExportSource; 35 info.destinationDirectory = fDestination; 36 info.zipFileName = fZipFilename; 37 info.items = fPlugins; 38 info.javacSource = fJavacSource; 39 info.javacTarget = fJavacTarget; 40 return new PluginExportJob(info); 41 } 42 43 public void setPlugins(String plugins) { 44 StringTokenizer tok = new StringTokenizer (plugins, ","); PluginModelManager manager = PDECore.getDefault().getModelManager(); 46 ArrayList models = new ArrayList (); 47 while (tok.hasMoreTokens()) { 48 String id = tok.nextToken().trim(); 49 IPluginModelBase model = manager.findPlugin(id, null, IMatchRules.NONE); 50 if (model != null && model.getUnderlyingResource() != null) 51 models.add(model); 52 } 53 fPlugins = (IPluginModelBase[])models.toArray(new IPluginModelBase[models.size()]); 54 } 55 56 } 57 | Popular Tags |