prantl.ant.eclipse
Class EclipseTask

java.lang.Object
  extended by Task
      extended by prantl.ant.eclipse.EclipseTask

public class EclipseTask
extends Task

Generates project configuration files for Eclipse. Writes files .project and .classpath for the Eclipse IDE using the settings from the Ant script. The configuration for the task is stored in an object of the class EclipseElement and the actual output is delegated into an implementation of the interface EclipseOutput.

Since:
Ant-Eclipse 1.0
Author:
Ferdinand Prantl <prantl@users.sourceforge.net>
See Also:
EclipseElement

Constructor Summary
  EclipseTask()
          Creates a new instance of the task.
protected EclipseTask(prantl.ant.eclipse.EclipseOutput object)
          Creates a new instance of the task.
 
Method Summary
 ClassPathElement createClassPath()
          Adds a definition of the classpath element.
 ProjectElement createProject()
          Adds a definition of the project element.
 SettingsElement createSettings()
          Adds a definition of the settings element.
 void execute()
          Generates the output files.
 void setDestDir(java.io.File dir)
          Sets the destination directory to place generated files into.
 void setErrorProperty(java.lang.String name)
          Property to set to "true" if there is an error in the generation of the project files.
 void setFailOnError(boolean value)
          If true, stop the build process if the generation of the project files fails.
 void setMode(EclipseElement.Mode value)
          High-level project creation mode controlling defaults for the generated files and changing behavior according to the specified project type, which usually responds to the chosen development toolkit.
 void setUpdateAlways(boolean flag)
          Sets if the generated files are to be written always or only if the Ant build script has been changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EclipseTask

public EclipseTask()
Creates a new instance of the task. Default constructor, to be called by ant in the productive environment.

Since:
Ant-Eclipse 1.0

EclipseTask

protected EclipseTask(prantl.ant.eclipse.EclipseOutput object)
Creates a new instance of the task. Testing constructor, to be called in unit tests only.

Parameters:
object - An object that the output is delegated into.
Throws:
java.lang.NullPointerException - If the parameter object is null.
Since:
Ant-Eclipse 1.0
Method Detail

setFailOnError

public void setFailOnError(boolean value)
If true, stop the build process if the generation of the project files fails.

Parameters:
value - True if it should halt, otherwise false.
Since:
Ant-Eclipse 1.0

setErrorProperty

public void setErrorProperty(java.lang.String name)
Property to set to "true" if there is an error in the generation of the project files.

Parameters:
name - A name of the property to set in case of an error.
Since:
Ant-Eclipse 1.0

setMode

public void setMode(EclipseElement.Mode value)
High-level project creation mode controlling defaults for the generated files and changing behavior according to the specified project type, which usually responds to the chosen development toolkit.

Parameters:
value - A project creation mode.
Since:
Ant-Eclipse 1.0

setUpdateAlways

public void setUpdateAlways(boolean flag)
Sets if the generated files are to be written always or only if the Ant build script has been changed. The latter is default.

Parameters:
flag - True if the files should always be overwritten, otherwise false.
Since:
Ant-Eclipse 1.0

setDestDir

public void setDestDir(java.io.File dir)
Sets the destination directory to place generated files into.

Parameters:
dir - A directory to place output files into.
Since:
Ant-Eclipse 1.0

createSettings

public SettingsElement createSettings()
Adds a definition of the settings element. Files in the directory .settings will be generated according to settings in this object. Only one settings element is allowed.

Returns:
A definition of the settings element.
Throws:
BuildException - If another settings element has been defined.
Since:
Ant-Eclipse 1.0

createProject

public ProjectElement createProject()
Adds a definition of the project element. The file .project will be generated according to settings in this object. Only one project element is allowed.

Returns:
A definition of the project element.
Throws:
BuildException - If another project element has been defined.
Since:
Ant-Eclipse 1.0

createClassPath

public ClassPathElement createClassPath()
Adds a definition of the classpath element. The file .classpath will be generated according to settings in this object. Only one classpath element is allowed.

Returns:
A definition of the classpath element.
Throws:
BuildException - If another classpath element has been defined.
Since:
Ant-Eclipse 1.0

execute

public void execute()
             throws BuildException
Generates the output files. Eventually existing files will be overwritten only if the timestamp of the ant project file is newer as the timestamp of a particular file.

Throws:
BuildException - In case of misconfiguration or errors.
Since:
Ant-Eclipse 1.0