FileDocCategorySizeDatePackage
Description.javaAPI DocApache Ant 1.704215Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.types

Description

public class Description extends DataType
Description is used to provide a project-wide description element (that is, a description that applies to a buildfile as a whole). If present, the <description> element is printed out before the target descriptions. Description has no attributes, only text. There can only be one project description per project. A second description element will overwrite the first.
ant.datatype
ignore="true"

Fields Summary
Constructors Summary
Methods Summary
public voidaddText(java.lang.String text)
Adds descriptive text to the project.

param
text the descriptive text


        ProjectHelper ph = ProjectHelper.getProjectHelper();
        if (!(ph instanceof ProjectHelperImpl)) {
            // New behavior for delayed task creation. Description
            // will be evaluated in Project.getDescription()
            return;
        }
        String currentDescription = getProject().getDescription();
        if (currentDescription == null) {
            getProject().setDescription(text);
        } else {
            getProject().setDescription(currentDescription + text);
        }
    
private static voidconcatDescriptions(org.apache.tools.ant.Project project, org.apache.tools.ant.Target t, java.lang.StringBuffer description)

        if (t == null) {
            return;
        }
        Vector tasks = findElementInTarget(project, t, "description");
        if (tasks == null) {
            return;
        }
        for (int i = 0; i < tasks.size(); i++) {
            Task task = (Task) tasks.elementAt(i);
            if (!(task instanceof UnknownElement)) {
                continue;
            }
            UnknownElement ue = ((UnknownElement) task);
            String descComp = ue.getWrapper().getText().toString();
            if (descComp != null) {
                description.append(project.replaceProperties(descComp));
            }
        }
    
private static java.util.VectorfindElementInTarget(org.apache.tools.ant.Project project, org.apache.tools.ant.Target t, java.lang.String name)

        Task[] tasks = t.getTasks();
        Vector elems = new Vector();
        for (int i = 0; i < tasks.length; i++) {
            if (name.equals(tasks[i].getTaskName())) {
                elems.addElement(tasks[i]);
            }
        }
        return elems;
    
public static java.lang.StringgetDescription(org.apache.tools.ant.Project project)
Return the descriptions from all the targets of a project.

param
project the project to get the descriptions for.
return
a string containing the concatenated descriptions of the targets.

        Vector targets = (Vector) project.getReference("ant.targets");
        if (targets == null) {
            return null;
        }
        StringBuffer description = new StringBuffer();
        for (int i = 0; i < targets.size(); i++) {
            Target t = (Target) targets.elementAt(i);
            concatDescriptions(project, t, description);
        }
        return description.toString();