ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meta...@apache.org
Subject cvs commit: jakarta-ant/src/antidote/org/apache/tools/ant/gui/acs ACSProjectElement.java ElementTreeSelectionModel.java
Date Mon, 08 Jan 2001 19:43:15 GMT
metasim     01/01/08 11:43:15

  Modified:    src/antidote/org/apache/tools/ant/gui/acs
                        ACSProjectElement.java
                        ElementTreeSelectionModel.java
  Log:
  Added *internal* support multiple projects, and generalized the selection
  state mechanism.
  
  Revision  Changes    Path
  1.7       +17 -2     jakarta-ant/src/antidote/org/apache/tools/ant/gui/acs/ACSProjectElement.java
  
  Index: ACSProjectElement.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/acs/ACSProjectElement.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ACSProjectElement.java	2001/01/04 21:11:07	1.6
  +++ ACSProjectElement.java	2001/01/08 19:43:13	1.7
  @@ -55,11 +55,12 @@
   
   import com.sun.xml.tree.ElementNode;
   import java.net.URL;
  +import java.io.File;
   
   /**
    * Class representing a project element in the build file.
    * 
  - * @version $Revision: 1.6 $ 
  + * @version $Revision: 1.7 $ 
    * @author Simeon Fitch 
    */
   public class ACSProjectElement extends ACSNamedElement {
  @@ -148,5 +149,19 @@
           firePropertyChange(LOCATION, old, _location);
       }
   
  -
  +    /** 
  +     * Set the loction where the project is persisted.
  +     * 
  +     * @param location Location of project as a file.
  +     */
  +    public void setLocation(File location) {
  +        try {
  +            setLocation(new URL("file", null, location.getAbsolutePath()));
  +        }
  +        catch(java.net.MalformedURLException ex) {
  +            // No reason why this should happen.
  +            // xxx Log me.
  +            ex.printStackTrace();
  +        }
  +    }
   }
  
  
  
  1.3       +6 -26     jakarta-ant/src/antidote/org/apache/tools/ant/gui/acs/ElementTreeSelectionModel.java
  
  Index: ElementTreeSelectionModel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/acs/ElementTreeSelectionModel.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ElementTreeSelectionModel.java	2001/01/03 14:18:17	1.2
  +++ ElementTreeSelectionModel.java	2001/01/08 19:43:13	1.3
  @@ -62,7 +62,7 @@
   /**
    * Selection model for the currently selected targets.
    * 
  - * @version $Revision: 1.2 $ 
  + * @version $Revision: 1.3 $ 
    * @author Simeon Fitch 
    */
   public class ElementTreeSelectionModel extends DefaultTreeSelectionModel {
  @@ -76,7 +76,9 @@
   
   	/** 
   	 * Convenience method for providing the set of currently selected
  -     * elements.
  +     * elements. NB: It returns all of the nodes in the selection path, 
  +     * so the root node will be a selected element whenever a child is 
  +     * selected.
   	 * 
        * @return the currently selected elements.
   	 */
  @@ -84,40 +86,18 @@
           TreePath[] path = getSelectionPaths();
           List values = new LinkedList();
           for(int i = 0; path != null && i < path.length; i++) {
  -            Object val = path[i].getLastPathComponent();
  -            if(val instanceof ACSElement) {
  -                values.add(val);
  -            }
  -        }
  -
  -        ACSElement[] retval = new ACSElement[values.size()];
  -        values.toArray(retval);
  -        return retval;
  -    }
  -
  -	/** 
  -	 * Get the set of selected tagets. A target is included if one of its
  -     * child nodes is selected.
  -	 * 
  -     * @return the currently selected targets, and indirectly selected targets.
  -	 */
  -    public ACSTargetElement[] getSelectedTargets() {
  -        TreePath[] path = getSelectionPaths();
  -        List values = new LinkedList();
  -        for(int i = 0; path != null && i < path.length; i++) {
               TreePath curr = path[i];
               for(int j = 0; j < curr.getPathCount(); j++) {
                   Object item = curr.getPathComponent(j);
  -                if(item instanceof ACSTargetElement) {
  +                if(item instanceof ACSElement) {
                       values.add(item);
                   }
               }
           }
   
  -        ACSTargetElement[] retval = new ACSTargetElement[values.size()];
  +        ACSElement[] retval = new ACSElement[values.size()];
           values.toArray(retval);
           return retval;
  -
       }
   
   }
  
  
  

Mime
View raw message