1 | /*
|
---|
2 | Launch4j (http://launch4j.sourceforge.net/)
|
---|
3 | Cross-platform Java application wrapper for creating Windows native executables.
|
---|
4 |
|
---|
5 | Copyright (C) 2004, 2006 Grzegorz Kowal
|
---|
6 |
|
---|
7 | This program is free software; you can redistribute it and/or modify
|
---|
8 | it under the terms of the GNU General Public License as published by
|
---|
9 | the Free Software Foundation; either version 2 of the License, or
|
---|
10 | (at your option) any later version.
|
---|
11 |
|
---|
12 | This program is distributed in the hope that it will be useful,
|
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | GNU General Public License for more details.
|
---|
16 |
|
---|
17 | You should have received a copy of the GNU General Public License
|
---|
18 | along with this program; if not, write to the Free Software
|
---|
19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*
|
---|
23 | * Created on May 24, 2005
|
---|
24 | */
|
---|
25 | package net.sf.launch4j.ant;
|
---|
26 |
|
---|
27 | import java.io.File;
|
---|
28 |
|
---|
29 | import org.apache.tools.ant.BuildException;
|
---|
30 |
|
---|
31 | import net.sf.launch4j.config.Config;
|
---|
32 | import net.sf.launch4j.config.Jre;
|
---|
33 | import net.sf.launch4j.config.Splash;
|
---|
34 | import net.sf.launch4j.config.VersionInfo;
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * @author Copyright (C) 2005 Grzegorz Kowal
|
---|
38 | */
|
---|
39 | public class AntConfig extends Config {
|
---|
40 |
|
---|
41 | public void setJarPath(String path) {
|
---|
42 | setJar(new File(path));
|
---|
43 | }
|
---|
44 |
|
---|
45 | public void addJre(Jre jre) {
|
---|
46 | checkNull(getJre(), "jre"); //$NON-NLS-1$
|
---|
47 | setJre(jre);
|
---|
48 | }
|
---|
49 |
|
---|
50 | public void addSplash(Splash splash) {
|
---|
51 | checkNull(getSplash(), "splash"); //$NON-NLS-1$
|
---|
52 | setSplash(splash);
|
---|
53 | }
|
---|
54 |
|
---|
55 | public void addVersionInfo(VersionInfo versionInfo) {
|
---|
56 | checkNull(getVersionInfo(), "versionInfo"); //$NON-NLS-1$
|
---|
57 | setVersionInfo(versionInfo);
|
---|
58 | }
|
---|
59 |
|
---|
60 | private void checkNull(Object o, String name) {
|
---|
61 | if (o != null) {
|
---|
62 | throw new BuildException(
|
---|
63 | Messages.getString("AntConfig.duplicate.element") //$NON-NLS-1$
|
---|
64 | + ": " //$NON-NLS-1$
|
---|
65 | + name);
|
---|
66 | }
|
---|
67 | }
|
---|
68 | }
|
---|