KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.apache.tools.ant.*;
14 import org.eclipse.core.runtime.jobs.*;
15
16 public abstract class BaseExportTask extends Task {
17     
18     protected String JavaDoc fDestination;
19     protected String JavaDoc fZipFilename;
20     protected boolean fToDirectory;
21     protected boolean fUseJarFormat;
22     protected boolean fExportSource;
23     protected String JavaDoc fJavacTarget;
24     protected String JavaDoc fJavacSource;
25
26     public BaseExportTask() {
27     }
28     
29     /* (non-Javadoc)
30      * @see org.apache.tools.ant.Task#execute()
31      */

32     public void execute() throws BuildException {
33         if (fDestination == null)
34             throw new BuildException("No destination is specified"); //$NON-NLS-1$
35

36         if (!fToDirectory && fZipFilename == null)
37             throw new BuildException("No zip file is specified"); //$NON-NLS-1$
38

39         getExportJob().schedule(2000);
40     }
41     
42     public void setExportType(String JavaDoc type) {
43         fToDirectory = !"zip".equals(type); //$NON-NLS-1$
44
}
45     
46     public void setUseJARFormat(String JavaDoc useJarFormat) {
47         fUseJarFormat = "true".equals(useJarFormat); //$NON-NLS-1$
48
}
49     
50     public void setExportSource(String JavaDoc doExportSource) {
51         fExportSource = "true".equals(doExportSource); //$NON-NLS-1$
52
}
53     
54     public void setDestination(String JavaDoc destination) {
55         fDestination = destination;
56     }
57     
58     public void setFilename(String JavaDoc filename) {
59         fZipFilename = filename;
60     }
61     
62     public void setTarget(String JavaDoc target) {
63         fJavacTarget = target;
64     }
65     
66     public void setSource(String JavaDoc source) {
67         fJavacSource = source;
68     }
69     
70     protected abstract Job getExportJob();
71 }
72
Popular Tags