Eclipse Platform
Release 3.0

org.eclipse.ant.core
Class AntCorePreferences

java.lang.Object
  extended byorg.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.

Since:
2.1

Constructor Summary
protected AntCorePreferences(List defaultTasks, List defaultExtraClasspath, List defaultTypes, boolean headless)
           
protected AntCorePreferences(List defaultTasks, List defaultExtraClasspath, List defaultTypes, List defaultProperties, boolean headless)
           
 
Method Summary
protected  void addPluginClassLoader(ClassLoader loader)
           
protected  void computeDefaultExtraClasspathEntries(List entries)
           
protected  List computeDefaultTasks(List tasks)
           
protected  List computeDefaultTypes(List types)
           
protected  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 plugin 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 getToolsJarEntry
protected  String[] getArrayFromString(String list)
           
 IAntClasspathEntry[] getContributedClasspathEntries()
          Returns all contributed classpath entries via the extraClasspathEntries 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 substition if indicated.
 Task[] getCustomTasks()
          Returns the user defined custom tasks
 Type[] getCustomTypes()
          Returns the user defined custom types
 URL[] 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.  
 List getDefaultProperties()
          Returns the default properties defined via the properties extension point
 List getDefaultTasks()
          Returns the default tasks defined via the task extension point
 List getDefaultTypes()
          Returns the default types defined via the type extension point
 URL[] getExtraClasspathURLs()
          Returns the list of urls added to the classpath by the extra classpath entries extension point.
protected  ClassLoader[] getPluginClassLoaders()
           
 List getProperties()
          Returns the default and custom properties.
 List getRemoteAntProperties()
          Returns the default and custom properties that are relavent 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 occuring 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 occuring without the Eclipse runtime.
 List getRemoteTasks()
          Returns the default and custom tasks that are relavent when there is no Eclipse runtime context (an Ant build in a separate VM).
 List getRemoteTypes()
          Returns the default and custom types that are relavent when there is no Eclipse runtime context (an Ant build in a separate VM).
 List getTasks()
          Returns the default and custom tasks.
 IAntClasspathEntry getToolsJarEntry()
          Returns the IAntClasspathEntry 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 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 plugin 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntCorePreferences

protected AntCorePreferences(List defaultTasks,
                             List defaultExtraClasspath,
                             List defaultTypes,
                             boolean headless)

AntCorePreferences

protected AntCorePreferences(List defaultTasks,
                             List defaultExtraClasspath,
                             List defaultTypes,
                             List 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 interface Preferences.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 plugin 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

public URL[] getDefaultAntURLs()
Deprecated.  

Returns 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 behaviour 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

public URL[] getAntURLs()
Deprecated. use getAntHomeClasspathEntries and getToolsJarEntry

Returns 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 computeDefaultTasks(List tasks)

computeDefaultTypes

protected List computeDefaultTypes(List types)

computeDefaultExtraClasspathEntries

protected void computeDefaultExtraClasspathEntries(List entries)

getToolsJarEntry

public IAntClasspathEntry getToolsJarEntry(IPath javaHomePath)
Returns the IAntClasspathEntry for the tools.jar associated with the path supplied. May return null 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

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 return null if no tools.jar is found.

Returns:
URL tools.jar URL or null

getToolsJarEntry

public IAntClasspathEntry getToolsJarEntry()
Returns the IAntClasspathEntry 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 return null if no tools.jar is found.

Returns:
IAntClasspathEntry tools.jar IAntClasspathEntry or null

addPluginClassLoader

protected void addPluginClassLoader(ClassLoader loader)

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 occuring 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 getTasks()
Returns the default and custom tasks.

Returns:
the list of default and custom tasks.

getRemoteTasks

public List getRemoteTasks()
Returns the default and custom tasks that are relavent 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 getProperties()
Returns the default and custom properties.

Returns:
the list of default and custom properties.
Since:
3.0

getRemoteAntProperties

public List getRemoteAntProperties()
Returns the default and custom properties that are relavent 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 substition if indicated.

Parameters:
performStringSubstition - whether or not to perform the string subsitution 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

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 -

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

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

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 getTypes()
Returns the default and custom types.

Returns:
all of the defined types

getRemoteTypes

public List getRemoteTypes()
Returns the default and custom types that are relavent 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 getDefaultTypes()
Returns the default types defined via the type extension point

Returns:
all of the default types

getDefaultTasks

public List getDefaultTasks()
Returns the default tasks defined via the task extension point

Returns:
all of the default tasks

getDefaultProperties

public List getDefaultProperties()
Returns the default properties defined via the properties extension point

Returns:
all of the default properties
Since:
3.0

getArrayFromString

protected String[] getArrayFromString(String list)

updatePluginPreferences

public void updatePluginPreferences()
Updates the underlying plugin 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 to null.

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 plugin if Ant home has not been specifically set by the user. Can return null

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 occuring without the Eclipse runtime.

Returns:
the list of classpath entries
Since:
3.0

getContributedClasspathEntries

public IAntClasspathEntry[] getContributedClasspathEntries()
Returns all contributed classpath entries via the extraClasspathEntries extension point.

Returns:
all contributed classpath entries via the extraClasspathEntries extension point
Since:
3.0

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.