Package org.eclipse.ant.core
Class AntCorePreferences
- java.lang.Object
-
- org.eclipse.ant.core.AntCorePreferences
-
- All Implemented Interfaces:
EventListener
,Preferences.IPropertyChangeListener
public class AntCorePreferences extends Object implements Preferences.IPropertyChangeListener
Represents the Ant Core plug-in's preferences providing utilities for extracting, changing and updating the underlying preferences. Clients may not instantiate or subclass this class.- Since:
- 2.1
- Restriction:
- This class is not intended to be subclassed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AntCorePreferences(List<IConfigurationElement> defaultTasks, List<IConfigurationElement> defaultExtraClasspath, List<IConfigurationElement> defaultTypes, boolean headless)
protected
AntCorePreferences(List<IConfigurationElement> defaultTasks, List<IConfigurationElement> defaultExtraClasspath, List<IConfigurationElement> defaultTypes, List<IConfigurationElement> defaultProperties, boolean headless)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addPluginClassLoader(Bundle bundle)
protected void
computeDefaultExtraClasspathEntries(List<IConfigurationElement> entries)
protected List<Task>
computeDefaultTasks(List<IConfigurationElement> tasks)
Returns the complete list of pre-configuredTask
sprotected List<Type>
computeDefaultTypes(List<IConfigurationElement> types)
Returns the complete listing of pre-configuredType
sprotected Property[]
extractProperties(Preferences prefs, String[] properties)
protected Task[]
extractTasks(Preferences prefs, String[] tasks)
protected Type[]
extractTypes(Preferences prefs, String[] types)
IAntClasspathEntry[]
getAdditionalClasspathEntries()
Returns the set of classpath entries that the user has added to the Ant runtime classpath.String
getAntHome()
Returns the string that defines the Ant home set by the user or the location of the Eclipse Ant plug-in if Ant home has not been specifically set by the user.IAntClasspathEntry[]
getAntHomeClasspathEntries()
Returns the set of classpath entries that compose the libraries added to the Ant runtime classpath from the Ant home location.URL[]
getAntURLs()
Deprecated.use getAntHomeClasspathEntries and getToolsJarEntryprotected String[]
getArrayFromString(String list)
IAntClasspathEntry[]
getContributedClasspathEntries()
Returns all contributed classpath entries via theextraClasspathEntries
extension point.Property[]
getCustomProperties()
Returns the custom user properties specified for Ant builds.String[]
getCustomPropertyFiles()
Returns the custom property files specified for Ant builds.String[]
getCustomPropertyFiles(boolean performStringSubstition)
Returns the custom property files specified for Ant builds performing any required string substitution if indicated.Task[]
getCustomTasks()
Returns the user defined custom tasksType[]
getCustomTypes()
Returns the user defined custom typesURL[]
getCustomURLs()
Deprecated.String
getDefaultAntHome()
Returns the absolute path of the default ant.home to use for the build.IAntClasspathEntry[]
getDefaultAntHomeEntries()
Returns the array of classpath entries that is the default set of entries defining the Ant classpath.URL[]
getDefaultAntURLs()
Deprecated.usegetDefaultAntHomeEntries()
insteadList<Property>
getDefaultProperties()
Returns the default properties defined via the properties extension pointList<Task>
getDefaultTasks()
Returns the default tasks defined via the task extension pointList<Type>
getDefaultTypes()
Returns the default types defined via the type extension pointURL[]
getExtraClasspathURLs()
Returns the list of URLs added to the classpath by the extra classpath entries extension point.protected ClassLoader[]
getPluginClassLoaders()
List<Property>
getProperties()
Returns the default and custom properties.List<Property>
getRemoteAntProperties()
Returns the default and custom properties that are relevant when there is no Eclipse runtime context (Ant build in a separate VM).URL[]
getRemoteAntURLs()
Returns the list of URLs to added to the classpath for an Ant build that is occurring without the Eclipse runtime.URL[]
getRemoteExtraClasspathURLs()
Returns the list of URLs added to the classpath by the extra classpath entries extension point for an Ant build that is occurring without the Eclipse runtime.List<Task>
getRemoteTasks()
Returns the default and custom tasks that are relevant when there is no Eclipse runtime context (an Ant build in a separate VM).List<Type>
getRemoteTypes()
Returns the default and custom types that are relevant when there is no Eclipse runtime context (an Ant build in a separate VM).List<Task>
getTasks()
Returns the default and custom tasks.IAntClasspathEntry
getToolsJarEntry()
Returns theIAntClasspathEntry
for the tools.jar associated with the System property "java.home" location.IAntClasspathEntry
getToolsJarEntry(IPath javaHomePath)
Returns the IAntClasspathEntry for the tools.jar associated with the path supplied.URL
getToolsJarURL()
Deprecated.use getToolsJarEntry()List<Type>
getTypes()
Returns the default and custom types.URL[]
getURLs()
Returns the entire set of URLs that define the Ant runtime classpath.void
propertyChange(Preferences.PropertyChangeEvent event)
When a preference changes, update the in-memory cache of the preference.void
setAdditionalClasspathEntries(IAntClasspathEntry[] entries)
Sets the set of classpath entries that the user has added to the Ant runtime classpath.void
setAntHome(String antHome)
Sets the string that defines the Ant home set by the user.void
setAntHomeClasspathEntries(IAntClasspathEntry[] entries)
Sets the set of classpath entries that compose the libraries added to the Ant runtime classpath from the Ant home location.void
setAntURLs(URL[] urls)
Deprecated.use setAntHomeEntires(IAntClasspathEntry[])void
setCustomProperties(Property[] properties)
Sets the custom user properties specified for Ant builds.void
setCustomPropertyFiles(String[] paths)
Sets the custom property files specified for Ant builds.void
setCustomTasks(Task[] tasks)
Sets the user defined custom tasks.void
setCustomTypes(Type[] types)
Sets the user defined custom types.void
setCustomURLs(URL[] urls)
Deprecated.use setAdditionalEntries(IAntClasspathEntry)[]protected void
updateAdditionalEntries(Preferences prefs)
protected void
updateAntHomeEntries(Preferences prefs)
void
updatePluginPreferences()
Updates the underlying plug-in preferences to the current state.protected void
updateProperties(Preferences prefs)
protected void
updatePropertyFiles(Preferences prefs)
protected void
updateTasks(Preferences prefs)
protected void
updateTypes(Preferences prefs)
-
-
-
Constructor Detail
-
AntCorePreferences
protected AntCorePreferences(List<IConfigurationElement> defaultTasks, List<IConfigurationElement> defaultExtraClasspath, List<IConfigurationElement> defaultTypes, boolean headless)
-
AntCorePreferences
protected AntCorePreferences(List<IConfigurationElement> defaultTasks, List<IConfigurationElement> defaultExtraClasspath, List<IConfigurationElement> defaultTypes, List<IConfigurationElement> defaultProperties, boolean headless)
-
-
Method Detail
-
propertyChange
public void propertyChange(Preferences.PropertyChangeEvent event)
When a preference changes, update the in-memory cache of the preference.- Specified by:
propertyChange
in interfacePreferences.IPropertyChangeListener
- Parameters:
event
- The property change event that has occurred.- See Also:
Preferences.IPropertyChangeListener.propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
-
getDefaultAntHome
public String getDefaultAntHome()
Returns the absolute path of the default ant.home to use for the build. The default is the org.apache.ant plug-in folder provided with Eclipse.- Returns:
- String absolute path of the default ant.home
- Since:
- 3.0
-
extractTasks
protected Task[] extractTasks(Preferences prefs, String[] tasks)
-
extractTypes
protected Type[] extractTypes(Preferences prefs, String[] types)
-
extractProperties
protected Property[] extractProperties(Preferences prefs, String[] properties)
-
getDefaultAntURLs
@Deprecated public URL[] getDefaultAntURLs()
Deprecated.usegetDefaultAntHomeEntries()
insteadReturns the array of URLs that is the default set of URLs defining the Ant classpath. Ant running through the command line tries to find tools.jar to help the user. Try emulating the same behavior here.- Returns:
- the default set of URLs defining the Ant classpath
-
getDefaultAntHomeEntries
public IAntClasspathEntry[] getDefaultAntHomeEntries()
Returns the array of classpath entries that is the default set of entries defining the Ant classpath.- Returns:
- the default set of classpath entries defining the Ant classpath
-
getAntURLs
@Deprecated public URL[] getAntURLs()
Deprecated.use getAntHomeClasspathEntries and getToolsJarEntryReturns the array of URLs that is the set of URLs defining the Ant classpath.- Returns:
- the set of URLs defining the Ant classpath
-
computeDefaultTasks
protected List<Task> computeDefaultTasks(List<IConfigurationElement> tasks)
Returns the complete list of pre-configuredTask
s- Parameters:
tasks
- theIConfigurationElement
handles for contributedTask
s- Returns:
- the list of
Task
s
-
computeDefaultTypes
protected List<Type> computeDefaultTypes(List<IConfigurationElement> types)
Returns the complete listing of pre-configuredType
s- Parameters:
types
- the list ofIConfigurationElement
handles to contributedType
s- Returns:
- the list of
Type
s
-
computeDefaultExtraClasspathEntries
protected void computeDefaultExtraClasspathEntries(List<IConfigurationElement> entries)
-
getToolsJarEntry
public IAntClasspathEntry getToolsJarEntry(IPath javaHomePath)
Returns the IAntClasspathEntry for the tools.jar associated with the path supplied. May returnnull
if no tools.jar is found (e.g. the path points to a JRE install).- Parameters:
javaHomePath
- path for Java home- Returns:
- IAntClasspathEntry tools.jar IAntClasspathEntry or
null
- Since:
- 3.0
-
getToolsJarURL
@Deprecated public URL getToolsJarURL()
Deprecated.use getToolsJarEntry()Returns the URL for the tools.jar associated with the System property "java.home" location. If "java.home" has no associated tools.jar (such as a JRE install), the environment variable "JAVA_HOME" is resolved to check for a tools.jar. May returnnull
if no tools.jar is found.- Returns:
- URL tools.jar URL or
null
-
getToolsJarEntry
public IAntClasspathEntry getToolsJarEntry()
Returns theIAntClasspathEntry
for the tools.jar associated with the System property "java.home" location. If "java.home" has no associated tools.jar (such as a JRE install), the environment variable "JAVA_HOME" is resolved to check for a tools.jar. May returnnull
if no tools.jar is found.- Returns:
- IAntClasspathEntry tools.jar IAntClasspathEntry or
null
-
addPluginClassLoader
protected void addPluginClassLoader(Bundle bundle)
-
getExtraClasspathURLs
public URL[] getExtraClasspathURLs()
Returns the list of URLs added to the classpath by the extra classpath entries extension point.- Returns:
- the list of extra classpath URLs
-
getRemoteExtraClasspathURLs
public URL[] getRemoteExtraClasspathURLs()
Returns the list of URLs added to the classpath by the extra classpath entries extension point for an Ant build that is occurring without the Eclipse runtime.- Returns:
- the list of extra classpath URLs
- Since:
- 3.0
-
getURLs
public URL[] getURLs()
Returns the entire set of URLs that define the Ant runtime classpath. Includes the Ant URLs, the additional URLs and extra classpath URLs.- Returns:
- the entire runtime classpath of URLs
-
getPluginClassLoaders
protected ClassLoader[] getPluginClassLoaders()
-
getTasks
public List<Task> getTasks()
Returns the default and custom tasks.- Returns:
- the list of default and custom tasks.
-
getRemoteTasks
public List<Task> getRemoteTasks()
Returns the default and custom tasks that are relevant when there is no Eclipse runtime context (an Ant build in a separate VM).- Returns:
- the list of default and custom tasks.
-
getCustomTasks
public Task[] getCustomTasks()
Returns the user defined custom tasks- Returns:
- the user defined tasks
-
getCustomTypes
public Type[] getCustomTypes()
Returns the user defined custom types- Returns:
- the user defined types
-
getCustomProperties
public Property[] getCustomProperties()
Returns the custom user properties specified for Ant builds.- Returns:
- the properties defined for Ant builds.
-
getProperties
public List<Property> getProperties()
Returns the default and custom properties.- Returns:
- the list of default and custom properties.
- Since:
- 3.0
-
getRemoteAntProperties
public List<Property> getRemoteAntProperties()
Returns the default and custom properties that are relevant when there is no Eclipse runtime context (Ant build in a separate VM).- Returns:
- the list of default and custom properties.
- Since:
- 3.0
-
getCustomPropertyFiles
public String[] getCustomPropertyFiles(boolean performStringSubstition)
Returns the custom property files specified for Ant builds performing any required string substitution if indicated.- Parameters:
performStringSubstition
- whether or not to perform the string substitution on the property file strings- Returns:
- the property files defined for Ant builds.
- Since:
- 3.0
-
getCustomPropertyFiles
public String[] getCustomPropertyFiles()
Returns the custom property files specified for Ant builds.- Returns:
- the property files defined for Ant builds.
-
getCustomURLs
@Deprecated public URL[] getCustomURLs()
Deprecated.Returns the custom URLs specified for the Ant classpath- Returns:
- the URLs defining the Ant classpath
-
setCustomTasks
public void setCustomTasks(Task[] tasks)
Sets the user defined custom tasks. To commit the changes, updatePluginPreferences must be called.- Parameters:
tasks
- The custom tasks.
-
setCustomTypes
public void setCustomTypes(Type[] types)
Sets the user defined custom types. To commit the changes, updatePluginPreferences must be called.- Parameters:
types
- The custom types
-
setCustomURLs
@Deprecated public void setCustomURLs(URL[] urls)
Deprecated.use setAdditionalEntries(IAntClasspathEntry)[]Sets the custom URLs specified for the Ant classpath. To commit the changes, updatePluginPreferences must be called.- Parameters:
urls
- the URLs defining the Ant classpath
-
setAntURLs
@Deprecated public void setAntURLs(URL[] urls)
Deprecated.use setAntHomeEntires(IAntClasspathEntry[])Sets the Ant URLs specified for the Ant classpath. To commit the changes, updatePluginPreferences must be called.- Parameters:
urls
- the URLs defining the Ant classpath
-
setCustomPropertyFiles
public void setCustomPropertyFiles(String[] paths)
Sets the custom property files specified for Ant builds. To commit the changes, updatePluginPreferences must be called.- Parameters:
paths
- the absolute paths defining the property files to use.
-
setCustomProperties
public void setCustomProperties(Property[] properties)
Sets the custom user properties specified for Ant builds. To commit the changes, updatePluginPreferences must be called.- Parameters:
properties
- the properties defining the Ant properties
-
getTypes
public List<Type> getTypes()
Returns the default and custom types.- Returns:
- all of the defined types
-
getRemoteTypes
public List<Type> getRemoteTypes()
Returns the default and custom types that are relevant when there is no Eclipse runtime context (an Ant build in a separate VM).- Returns:
- the list of default and custom types.
-
getDefaultTypes
public List<Type> getDefaultTypes()
Returns the default types defined via the type extension point- Returns:
- all of the default types
-
getDefaultTasks
public List<Task> getDefaultTasks()
Returns the default tasks defined via the task extension point- Returns:
- all of the default tasks
-
getDefaultProperties
public List<Property> getDefaultProperties()
Returns the default properties defined via the properties extension point- Returns:
- all of the default properties
- Since:
- 3.0
-
updatePluginPreferences
public void updatePluginPreferences()
Updates the underlying plug-in preferences to the current state.
-
updateTasks
protected void updateTasks(Preferences prefs)
-
updateTypes
protected void updateTypes(Preferences prefs)
-
updateProperties
protected void updateProperties(Preferences prefs)
-
updateAdditionalEntries
protected void updateAdditionalEntries(Preferences prefs)
-
updateAntHomeEntries
protected void updateAntHomeEntries(Preferences prefs)
-
updatePropertyFiles
protected void updatePropertyFiles(Preferences prefs)
-
setAntHome
public void setAntHome(String antHome)
Sets the string that defines the Ant home set by the user. May be set tonull
.- Parameters:
antHome
- the fully qualified path to Ant home
-
getAntHome
public String getAntHome()
Returns the string that defines the Ant home set by the user or the location of the Eclipse Ant plug-in if Ant home has not been specifically set by the user. Can returnnull
- Returns:
- the fully qualified path to Ant home
-
getAntHomeClasspathEntries
public IAntClasspathEntry[] getAntHomeClasspathEntries()
Returns the set of classpath entries that compose the libraries added to the Ant runtime classpath from the Ant home location.- Returns:
- the set of ant home classpath entries
- Since:
- 3.0
-
getAdditionalClasspathEntries
public IAntClasspathEntry[] getAdditionalClasspathEntries()
Returns the set of classpath entries that the user has added to the Ant runtime classpath.- Returns:
- the set of user classpath entries
- Since:
- 3.0
-
setAntHomeClasspathEntries
public void setAntHomeClasspathEntries(IAntClasspathEntry[] entries)
Sets the set of classpath entries that compose the libraries added to the Ant runtime classpath from the Ant home location.- Parameters:
entries
- the set of ant home classpath entries- Since:
- 3.0
-
setAdditionalClasspathEntries
public void setAdditionalClasspathEntries(IAntClasspathEntry[] entries)
Sets the set of classpath entries that the user has added to the Ant runtime classpath.- Parameters:
entries
- the set of user classpath entries- Since:
- 3.0
-
getRemoteAntURLs
public URL[] getRemoteAntURLs()
Returns the list of URLs to added to the classpath for an Ant build that is occurring without the Eclipse runtime.- Returns:
- the list of classpath entries
- Since:
- 3.0
-
getContributedClasspathEntries
public IAntClasspathEntry[] getContributedClasspathEntries()
Returns all contributed classpath entries via theextraClasspathEntries
extension point.- Returns:
- all contributed classpath entries via the
extraClasspathEntries
extension point - Since:
- 3.0
-
-