KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > core > AntObject


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.ant.internal.core;
12
13
14 import java.net.URL JavaDoc;
15
16 import org.eclipse.ant.core.IAntClasspathEntry;
17
18 public abstract class AntObject {
19
20     protected String JavaDoc fClassName;
21     protected URL JavaDoc fLibrary;
22     protected IAntClasspathEntry fLibraryEntry;
23     protected String JavaDoc fName;
24     private String JavaDoc fPluginLabel;
25     private boolean eclipseRuntime= true;
26     private String JavaDoc fURI= null;
27     
28     /**
29      * Gets the className.
30      * @return Returns a String
31      */

32     public String JavaDoc getClassName() {
33         return fClassName;
34     }
35     /**
36      * Sets the className.
37      * @param className The className to set
38      */

39     public void setClassName(String JavaDoc className) {
40         fClassName = className;
41     }
42     /**
43      * Gets the library.
44      * @return Returns a URL
45      * @deprecated use #getLibraryEntry()
46      */

47     public URL JavaDoc getLibrary() {
48         if (fLibrary != null) {
49             return fLibrary;
50         }
51         return fLibraryEntry.getEntryURL();
52     }
53     /**
54      * Sets the library.
55      * @param library The library to set
56      * @deprecated use #setLibraryEntry(IAntClasspathEntry)
57      */

58     public void setLibrary(URL JavaDoc library) {
59         fLibrary = library;
60     }
61     
62     /**
63      * Gets the library classpath entry.
64      * @return Returns a classpath entry for the library of this Ant object
65      */

66     public IAntClasspathEntry getLibraryEntry() {
67         if (fLibraryEntry != null) {
68             return fLibraryEntry;
69         }
70         fLibraryEntry= new AntClasspathEntry(fLibrary);
71         return fLibraryEntry;
72     }
73     /**
74      * Sets the library classpath entry.
75      * @param libraryEntry The library entry to set
76      */

77     public void setLibraryEntry(IAntClasspathEntry libraryEntry) {
78         fLibraryEntry = libraryEntry;
79     }
80     
81     /* (non-Javadoc)
82      * @see java.lang.Object#toString()
83      */

84     public String JavaDoc toString() {
85         if (fURI == null || fURI.equals("") || fURI.equals("antlib:org.apache.tools.ant")) { //$NON-NLS-1$//$NON-NLS-2$
86
return fName;
87         }
88         return fURI + ':' + fName;
89     }
90     /**
91      * Returns whether this Ant object has been created because of an extension
92      * point definition.
93      * @return boolean
94      */

95     public boolean isDefault() {
96         return fPluginLabel != null;
97     }
98
99     /**
100      * Sets that this Ant object has been created by the appropriate extension
101      * point.
102      * @param isDefault Whether this Ant object has been created because of an
103      * extension point definition.
104      * @deprecated Since 3.0 Set the plugin label to indicate a default object
105      */

106     public void setIsDefault(boolean isDefault) {
107         if (!isDefault) {
108             fPluginLabel= null;
109         }
110     }
111     
112     /**
113      * Sets the label of the plugin that contributed this Ant object via an extension
114      * point.
115      *
116      * @param pluginLabel The label of the plugin
117      * @since 3.0
118      */

119     public void setPluginLabel(String JavaDoc pluginLabel) {
120         fPluginLabel = pluginLabel;
121     }
122
123     /**
124      * Returns the label of the plugin that contributed this Ant object via an extension
125      * point.
126      *
127      * @return pluginLabel The label of the plugin
128      * @since 3.0
129      */

130     public String JavaDoc getPluginLabel() {
131         return fPluginLabel;
132     }
133     
134     /**
135      * Returns whether this Ant object requires the Eclipse runtime to be
136      * relevant. Defaults value is <code>true</code>
137      *
138      * @return whether this Ant object requires the Eclipse runtime
139      * @since 3.0
140      */

141     public boolean isEclipseRuntimeRequired() {
142         return eclipseRuntime;
143     }
144     
145     public void setEclipseRuntimeRequired(boolean eclipseRuntime) {
146         this.eclipseRuntime= eclipseRuntime;
147     }
148     
149     /**
150      * Returns the URI namespace that this Ant object should live in.
151      * Default value is <code>null</code>
152      *
153      * @return The URI that this Ant object should live in
154      * @since 3.2
155      */

156     public String JavaDoc getURI() {
157         return fURI;
158     }
159     
160     public void setURI(String JavaDoc uri) {
161         fURI= uri;
162     }
163 }
164
Popular Tags