Browse Source

Allow TaskContainers to have nested elements which take precedence

over tasks


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274056 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 22 years ago
parent
commit
11f76e5f8d
2 changed files with 17 additions and 6 deletions
  1. +13
    -1
      src/main/org/apache/tools/ant/IntrospectionHelper.java
  2. +4
    -5
      src/main/org/apache/tools/ant/UnknownElement.java

+ 13
- 1
src/main/org/apache/tools/ant/IntrospectionHelper.java View File

@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -563,6 +563,18 @@ public class IntrospectionHelper implements BuildListener {
}
}

/**
* Indicate if this element supports a nested element of the
* given name.
*
* @param elementName the name of the nested element being checked
*
* @return true if the given nested element is supported
*/
public boolean supportsNestedElement(String elementName) {
return nestedCreators.containsKey(elementName);
}
/**
* Stores a named nested element using a storage method determined
* by the initial introspection. If no appropriate storage method


+ 4
- 5
src/main/org/apache/tools/ant/UnknownElement.java View File

@@ -269,10 +269,8 @@ public class UnknownElement extends Task {
UnknownElement child = (UnknownElement) children.elementAt(i);
Object realChild = null;

if (parent instanceof TaskContainer) {
//ProjectComponentHelper helper=ProjectComponentHelper.getProjectComponentHelper();
//realChild = helper.createProjectComponent( child, getProject(), null,
// child.getTag());
if (!ih.supportsNestedElement(child.getTag())
&& parent instanceof TaskContainer) {
realChild = makeTask(child, childWrapper, false);

if (realChild == null) {
@@ -296,7 +294,8 @@ public class UnknownElement extends Task {
}

childWrapper.setProxy(realChild);
if (parent instanceof TaskContainer) {
if (parent instanceof TaskContainer
&& realChild instanceof Task) {
((Task) realChild).setRuntimeConfigurableWrapper(childWrapper);
}



Loading…
Cancel
Save