ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickda...@apache.org
Subject cvs commit: jakarta-ant/src/antidote/org/apache/tools/ant/gui/acs ACSDtdDefinedElement.java
Date Mon, 16 Apr 2001 01:49:40 GMT
nickdavis    01/04/15 18:49:40

  Modified:    src/antidote/org/apache/tools/ant/gui/acs
                        ACSDtdDefinedElement.java
  Log:
  modified getDisplayName to display common attribute information
  (eg "mkdir: ${build.dir}")
  
  Revision  Changes    Path
  1.5       +39 -1     jakarta-ant/src/antidote/org/apache/tools/ant/gui/acs/ACSDtdDefinedElement.java
  
  Index: ACSDtdDefinedElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/acs/ACSDtdDefinedElement.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ACSDtdDefinedElement.java	2001/04/11 20:43:21	1.4
  +++ ACSDtdDefinedElement.java	2001/04/16 01:49:39	1.5
  @@ -61,7 +61,7 @@
   /**
    * Element defined by the DTD.
    *
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    * @author Nick Davis<a href="mailto:nick_home_account@yahoo.com">nick_home_account@yahoo.com</a>
    */
   public class ACSDtdDefinedElement extends ACSTreeNodeElement
  @@ -97,6 +97,44 @@
           return getTagName();
       }
   
  +	/** 
  +	 * Get the display name of this.
  +	 * 
  +	 * @return Display name.
  +	 */
  +    public String getDisplayName() {
  +        String name = getTagName();
  +
  +        // Is there only one attribute?
  +        if (getAttributes().getLength() == 1) {
  +            Node onlyNode = getAttributes().item(0);
  +
  +            // Display the only attribute
  +            name += ": " + onlyNode.getNodeValue();
  +        } else {
  +            
  +            // Display one of these attributes
  +            // if they are present.
  +            final String[] DISPLAY_ATTRIBUTES =
  +            {
  +                "name",
  +                "id",
  +                "property"
  +            };
  +
  +            for(int i = 0; i < DISPLAY_ATTRIBUTES.length; i++) {
  +                Node testNode =
  +                    getAttributes().getNamedItem(DISPLAY_ATTRIBUTES[i]);
  +                if (testNode != null) {
  +                    name += ": " + testNode.getNodeValue();
  +                    break;
  +                }
  +            }
  +        }
  +        
  +        return name;
  +    }
  +    
           /** 
            * Set the task type.
            * 
  
  
  

Mime
View raw message