KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > ant > PluginExportTask


1 /*******************************************************************************
2  * Copyright (c) 2003, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.ant;
12
13 import java.util.ArrayList JavaDoc;
14 import java.util.StringTokenizer JavaDoc;
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     /* (non-Javadoc)
28      * @see org.eclipse.pde.internal.ui.ant.BaseExportTask#getExportJob()
29      */

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 JavaDoc plugins) {
44         StringTokenizer JavaDoc tok = new StringTokenizer JavaDoc(plugins, ","); //$NON-NLS-1$
45
PluginModelManager manager = PDECore.getDefault().getModelManager();
46         ArrayList JavaDoc models = new ArrayList JavaDoc();
47         while (tok.hasMoreTokens()) {
48             String JavaDoc 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