Eclipse Platform
2.1

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.

Since:
2.1

Field Summary
protected  URL[] antURLs
           
protected  Property[] customProperties
           
protected  String[] customPropertyFiles
           
protected  Task[] customTasks
           
protected  Type[] customTypes
           
protected  URL[] customURLs
           
protected  URL[] defaultAntURLs
           
protected  List defaultTasks
           
protected  List defaultTypes
           
protected  List extraClasspathURLs
           
protected  List pluginClassLoaders
           
 
Constructor Summary
protected AntCorePreferences(List defaultTasks, List defaultExtraClasspath, List defaultTypes, boolean headless)
           
 
Method Summary
protected  void addLibraries(IPluginDescriptor source, List destination)
           
protected  void addPluginClassLoader(ClassLoader loader)
           
protected  void computeDefaultExtraClasspathEntries(List entries)
          Computes the extra classpath entries defined plugins and fragments.
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)
           
protected  URL[] extractURLs(String[] urls)
           
 String getAntHome()
          Returns the string that defines the Ant home set by the user.
 URL[] getAntURLs()
          Returns the array of URLs that is the set of URLs defining the Ant classpath.
protected  String[] getArrayFromString(String list)
          Convert a list of tokens into an array using "," as the tokenizer.
 Property[] getCustomProperties()
          Returns the custom user properties specified for Ant builds.
 String[] getCustomPropertyFiles()
          Returns the custom property files specified for Ant builds.
 Task[] getCustomTasks()
          Returns the user defined custom tasks
 Type[] getCustomTypes()
          Returns the user defined custom types
 URL[] getCustomURLs()
          Returns the custom URLs specified for the Ant classpath
 URL[] getDefaultAntURLs()
          Returns the array of URLs that is the default set of URLs defining the Ant classpath.
 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 getTasks()
          Returns the default and custom tasks.
 URL getToolsJarURL()
          Returns the URL for the tools.jar associated with the "java.home" location.
 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 setAntHome(String antHome)
          Sets the string that defines the Ant home set by the user.
 void setAntURLs(URL[] urls)
          Sets the Ant URLs specified for the Ant classpath.
 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)
          Sets the custom URLs specified for the Ant classpath.
protected  void updateAntURLs(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)
           
protected  void updateURLs(Preferences prefs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultTasks

protected List defaultTasks

defaultTypes

protected List defaultTypes

extraClasspathURLs

protected List extraClasspathURLs

defaultAntURLs

protected URL[] defaultAntURLs

customTasks

protected Task[] customTasks

customTypes

protected Type[] customTypes

antURLs

protected URL[] antURLs

customURLs

protected URL[] customURLs

customProperties

protected Property[] customProperties

customPropertyFiles

protected String[] customPropertyFiles

pluginClassLoaders

protected List pluginClassLoaders
Constructor Detail

AntCorePreferences

protected AntCorePreferences(List defaultTasks,
                             List defaultExtraClasspath,
                             List defaultTypes,
                             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
See Also:
Preferences.IPropertyChangeListener.propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)

extractTasks

protected Task[] extractTasks(Preferences prefs,
                              String[] tasks)

extractTypes

protected Type[] extractTypes(Preferences prefs,
                              String[] types)

extractProperties

protected Property[] extractProperties(Preferences prefs,
                                       String[] properties)

extractURLs

protected URL[] extractURLs(String[] urls)

getDefaultAntURLs

public URL[] getDefaultAntURLs()
Returns the array of URLs that is the default set of URLs defining the Ant classpath. The Xerces JARs are included when the plugin classloader for org.eclipse.ant.core is set as one of the plugin classloaders of the AntClassLoader. 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

getAntURLs

public URL[] getAntURLs()
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)
Computes the extra classpath entries defined plugins and fragments.

getToolsJarURL

public URL getToolsJarURL()
Returns the URL for the tools.jar associated with the "java.home" location. May return null if no tools.jar is found (e.g. "java.home" points to a JRE install).
Returns:
URL tools.jar URL or null

addLibraries

protected void addLibraries(IPluginDescriptor source,
                            List destination)

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

getURLs

public URL[] getURLs()
Returns the entire set of URLs that define the Ant runtime classpath. Includes the Ant URLs, the custom 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.

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.

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()
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
Parameters:
tasks -  

setCustomTypes

public void setCustomTypes(Type[] types)
Sets the user defined custom types
Parameters:
tasks -  

setCustomURLs

public void setCustomURLs(URL[] urls)
Sets the custom URLs specified for the Ant classpath. To commit the changes, updatePluginPreferences must be called.
Parameters:
the - urls defining the Ant classpath

setAntURLs

public void setAntURLs(URL[] urls)
Sets the Ant URLs specified for the Ant classpath. To commit the changes, updatePluginPreferences must be called.
Parameters:
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:
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:
the - properties defining the Ant properties

getTypes

public List getTypes()
Returns the default and custom types.
Returns:
all of the defined 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

getArrayFromString

protected String[] getArrayFromString(String list)
Convert a list of tokens into an array using "," as the tokenizer.

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)

updateURLs

protected void updateURLs(Preferences prefs)

updateAntURLs

protected void updateAntURLs(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:
the - fully qualified path to Ant home

getAntHome

public String getAntHome()
Returns the string that defines the Ant home set by the user. May be null if Ant home has not been set.
Returns:
the fully qualified path to Ant home

Eclipse Platform
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.