Browse Source

Changes by Bill Burton to collect tasks into categories rather than package space. Very cool, thanks!

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271596 13f79535-47bb-0310-9956-ffa450edef68
master
Erik Hatcher 23 years ago
parent
commit
434fa8175a
3 changed files with 34 additions and 8 deletions
  1. +1
    -7
      proposal/xdocs/src/org/apache/tools/ant/xdoclet/AntSubTask.java
  2. +31
    -0
      proposal/xdocs/src/org/apache/tools/ant/xdoclet/AntTagsHandler.java
  3. +2
    -1
      proposal/xdocs/templates/task_xdoc.template

+ 1
- 7
proposal/xdocs/src/org/apache/tools/ant/xdoclet/AntSubTask.java View File

@@ -83,11 +83,6 @@ public class AntSubTask extends TemplateSubTask {
* - and only throw BuildException if at all
*/
protected boolean matchesGenerationRules(ClassDoc clazz) throws XDocletException {

if (clazz.isAbstract()) {
return false;
}

return isAntTask(clazz);;
}

@@ -124,8 +119,7 @@ public class AntSubTask extends TemplateSubTask {
String dir = getDestDir().getAbsolutePath();

if (filename.indexOf("{0}") != -1) {
PackageDoc pak = clazz.containingPackage();
dir = PackageTagsHandler.packageNameAsPathFor(pak);
dir = AntTagsHandler.getCategoryName(clazz);
String taskName = AntTagsHandler.getTaskName(clazz);
filename = MessageFormat.format(getDestinationFile(), new Object[]{taskName});
}


+ 31
- 0
proposal/xdocs/src/org/apache/tools/ant/xdoclet/AntTagsHandler.java View File

@@ -81,6 +81,9 @@ import java.util.Properties;
*/
public class AntTagsHandler extends XDocletTagSupport {

/** Default category for tasks without a category attribute. */
public static final String DEFAULT_CATEGORY = "other";

/**
* @todo add check for execute method
*/
@@ -163,6 +166,7 @@ public class AntTagsHandler extends XDocletTagSupport {
* Provides the Ant task name.
*
* @see getTaskName
* @doc:tag type="content"
*/
public String taskName() throws XDocletException {
return getTaskName(getCurrentClass());
@@ -197,6 +201,33 @@ public class AntTagsHandler extends XDocletTagSupport {
}


/**
* Provides the Ant category name.
*
* @see getCategoryName
*/
public String categoryName() throws XDocletException {
return getCategoryName(getCurrentClass());
}

/**
* Provides the Ant category name as the Value of the category attribute,
* <code>@ant:task&nbsp;category="..."</code>. This attribute is mandatory.
*/
public static final String getCategoryName(ClassDoc clazz) throws XDocletException {
String tagValue = getTagValue(clazz, "ant:task", "category", -1,
null, null, null, null,
null, false, XDocletTagSupport.FOR_CLASS, true);
if (tagValue != null) {
tagValue = tagValue.toLowerCase();
}
else {
tagValue = DEFAULT_CATEGORY;
}
return tagValue;
}


/**
* Returns true if the method corresponds to an Ant task attribute using
* the rules from IntrospectionHelper


+ 2
- 1
proposal/xdocs/templates/task_xdoc.template View File

@@ -1,6 +1,7 @@
<XDtTagDef:tagDef namespace="Ant" handler="org.apache.tools.ant.xdoclet.AntTagsHandler"/>

<task name="<XDtAnt:taskName/>" classname="<XDtClass:fullClassName/>">
<task name="<XDtAnt:taskName/>" category="<XDtAnt:categoryName/>"
classname="<XDtClass:fullClassName/>">

<short-description><![CDATA[<XDtClass:firstSentenceDescription/>]]></short-description>
<long-description>


Loading…
Cancel
Save