You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by me...@apache.org on 2001/01/12 20:02:42 UTC

cvs commit: jakarta-ant/src/antidote/org/apache/tools/ant/gui/event NewElementEvent.java NewTargetEvent.java NewProjectEvent.java

metasim     01/01/12 11:02:42

  Modified:    src/antidote/org/apache/tools/ant/gui/event
                        NewProjectEvent.java
  Added:       src/antidote/org/apache/tools/ant/gui/event
                        NewElementEvent.java NewTargetEvent.java
  Log:
  Added ability to add new targets.
  
  Revision  Changes    Path
  1.7       +16 -2     jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/NewProjectEvent.java
  
  Index: NewProjectEvent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/NewProjectEvent.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- NewProjectEvent.java	2001/01/10 20:46:56	1.6
  +++ NewProjectEvent.java	2001/01/12 19:02:40	1.7
  @@ -64,10 +64,11 @@
    * assumes that any new project added to the project manager
    * is then selected.
    * 
  - * @version $Revision: 1.6 $ 
  + * @version $Revision: 1.7 $ 
    * @author Simeon Fitch 
    */
  -public class NewProjectEvent extends ProjectSelectedEvent {
  +public class NewProjectEvent extends ProjectSelectedEvent 
  +    implements NewElementEvent {
   
   	/** 
   	 * Standard ctor.
  @@ -77,5 +78,18 @@
       public NewProjectEvent(
           AppContext context, ACSProjectElement project) {
           super(context, project);
  +        if(project == null) {
  +            throw new IllegalArgumentException("A new project can't be null.");
  +        }
       }
  +
  +    /** 
  +     * Get the newly added project.
  +     * 
  +     * @return New project.
  +     */
  +    public ACSElement getNewElement() {
  +        return getSelectedProject();
  +    }
  +
   }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/NewElementEvent.java
  
  Index: NewElementEvent.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Ant", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.gui.event;
  import org.apache.tools.ant.gui.acs.ACSElement;
  /**
   * Tag interface for indicating that an event is related to creating new
   * build definition elements.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public interface NewElementEvent {
      /** 
       * Get the element that has been added.
       * 
       * @return New element.
       */
      ACSElement getNewElement();
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/NewTargetEvent.java
  
  Index: NewTargetEvent.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999, 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Ant", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.tools.ant.gui.event;
  import org.apache.tools.ant.gui.acs.ACSElement;
  import org.apache.tools.ant.gui.acs.ACSTargetElement;
  import org.apache.tools.ant.gui.core.AppContext;
  
  /**
   * Event fired when a new target is created.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class NewTargetEvent extends TargetSelectionEvent 
      implements NewElementEvent {
  
  	/** 
  	 * Standard ctor.
  	 * 
  	 * @param context application context.
       * @param target the new target.
  	 */
      public NewTargetEvent(AppContext context, 
                            ACSTargetElement target) {
          super(context, new ACSElement[] { target });
          if(target == null) {
              throw new IllegalArgumentException("A new target can't be null.");
          }
      }
  
      /** 
       * Get the newly added target.
       * 
       * @return New target.
       */
      public ACSElement getNewElement() {
          return getSelectedTargets()[0];
      }
  }