ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meta...@locus.apache.org
Subject cvs commit: jakarta-ant/src/antidote/org/apache/tools/ant/gui/resources action.properties
Date Fri, 24 Nov 2000 17:09:24 GMT
metasim     00/11/24 09:09:23

  Modified:    src/antidote TODO build.xml
               src/antidote/org/apache/tools/ant/gui ActionManager.java
                        AntAction.java AppContext.java EventResponder.java
                        Main.java
               src/antidote/org/apache/tools/ant/gui/command AboutCmd.java
                        BuildCmd.java ChangeLookAndFeelCmd.java
                        CloseCmd.java Command.java DisplayErrorCmd.java
                        EmacsNotifyCmd.java ExitCmd.java LoadFileCmd.java
                        NoOpCmd.java OpenCmd.java SaveAsCmd.java
                        SaveCmd.java
               src/antidote/org/apache/tools/ant/gui/event AntEvent.java
                        ErrorEvent.java OpenRequestEvent.java
               src/antidote/org/apache/tools/ant/gui/resources
                        action.properties
  Added:       src/antidote/org/apache/tools/ant/gui/command
                        AbstractCommand.java
  Log:
  Rewrote command handling infrastructure, allowing for dynamic mapping
  between actions and commands rather than the original hard-coded
  mapping. Associations specified in the actions.properties file under
  the "<actionID>.command" property.
  
  Revision  Changes    Path
  1.5       +6 -0      jakarta-ant/src/antidote/TODO
  
  Index: TODO
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/TODO,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TODO	2000/11/16 19:40:30	1.4
  +++ TODO	2000/11/24 17:09:10	1.5
  @@ -1,4 +1,10 @@
   TODO List:
  +    * Implement some for of refid hyperlinking functionality.
  +
  +    * Provide some sort of class path debugging support.
  +
  +    * Eat own dog food more.
  +
       * Dispatch tree node change events when the properties editor changes a 
         node value. This will make sure that the node gets displayed correctly in
         the project navigator.
  
  
  
  1.8       +1 -0      jakarta-ant/src/antidote/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/build.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- build.xml	2000/11/19 04:22:49	1.7
  +++ build.xml	2000/11/24 17:09:11	1.8
  @@ -24,6 +24,7 @@
     <property name="ant.dist.dir" value="../../../dist/ant"/>
   
     <path id="classpath">
  +    <pathelement location="${lib.dir}/ant.jar"/>
     </path>
     <property name="packages" value="org.apache.tools.ant.gui.*"/>
     <property name="manifest" value="etc/manifest"/>
  
  
  
  1.6       +81 -3     jakarta-ant/src/antidote/org/apache/tools/ant/gui/ActionManager.java
  
  Index: ActionManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/ActionManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ActionManager.java	2000/11/16 18:32:23	1.5
  +++ ActionManager.java	2000/11/24 17:09:12	1.6
  @@ -1,5 +1,52 @@
   /*
    * The Apache Software License, Version 1.1
  + * 
  + *    Copyright (C) 2000 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, 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  acknowledgment:  "This product includes  software
  + *    developed  by the  Apache Software Foundation  (http://www.apache.org/)."
  + *    Alternately, this  acknowledgment may  appear in the software itself,  if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "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 name,  without prior written permission  of the
  + *    Apache Software Foundation.
  + * 
  + * 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 (INCLU-
  + * DING, 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/>.
  + *
  + */
  +
  +/*
  + * The Apache Software License, Version 1.1
    *
    * Copyright (c) 1999, 2000 The Apache Software Foundation.  All rights
    * reserved.
  @@ -54,6 +101,7 @@
   package org.apache.tools.ant.gui;
   
   import org.apache.tools.ant.gui.event.*;
  +import org.apache.tools.ant.gui.command.Command;
   import javax.swing.*;
   import java.util.*;
   
  @@ -61,7 +109,7 @@
    * Manager of antidote actions. Receives its configuration from the action
    * ResourceBundle.
    * 
  - * @version $Revision: 1.5 $ 
  + * @version $Revision: 1.6 $ 
    * @author Simeon Fitch 
    */
   public class ActionManager {
  @@ -106,9 +154,7 @@
               // For each action we need to add the reverse event trigger
               // lookup.
               _mapper.addAction(action);
  -
           }
  -
       }
   
   	/** 
  @@ -212,6 +258,38 @@
           return retval;
       }
   
  +	/** 
  +	 * Get the command assocaited with the Action with the given id.
  +	 * 
  +	 * @param actionID Id of action to get command for.
  +	 * @return Command associated with action, or null if none available.
  +	 */
  +    public Command getActionCommand(String actionID, AppContext context) {
  +        Command retval = null;
  +        AntAction action = (AntAction) _actions.get(actionID);
  +        if(action != null) {
  +            Class clazz = action.getCommandClass();
  +            if(clazz != null) {
  +                try {
  +                    retval = (Command) clazz.newInstance();
  +                    retval.setContext(context);
  +                }
  +                catch(Exception ex) {
  +                    // XXX log me.
  +                    ex.printStackTrace();
  +                }
  +            }
  +        }
  +        return retval;
  +    }
  +
  +
  +	/** 
  +	 * Add tool tip, Mnemonic, etc.
  +	 * 
  +	 * @param button Button to work on. 
  +	 * @param action Associated action.
  +	 */
       private void addNiceStuff(AbstractButton button, AntAction action) {
           // Set the action command so that it is consitent
           // no matter what language the display is in.
  
  
  
  1.3       +25 -1     jakarta-ant/src/antidote/org/apache/tools/ant/gui/AntAction.java
  
  Index: AntAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/AntAction.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AntAction.java	2000/11/16 18:32:23	1.2
  +++ AntAction.java	2000/11/24 17:09:12	1.3
  @@ -64,7 +64,7 @@
   /**
    * Class representing an action in the Antidote application. 
    * 
  - * @version $Revision: 1.2 $ 
  + * @version $Revision: 1.3 $ 
    * @author Simeon Fitch 
    */
   public class AntAction extends AbstractAction {
  @@ -76,6 +76,7 @@
       public static final String ENABLE_ON = "enableOn";
       public static final String DISABLE_ON = "disableOn";
       public static final String TOGGLE = "toggle";
  +    public static final String COMMAND = "command";
   
       /** Property resources. */
       private  ResourceBundle _resources =  null;
  @@ -127,6 +128,19 @@
               _toggle = Boolean.valueOf(toggle).booleanValue();
           }
   
  +        // See if there is a command associated with the action.
  +        String command = getString(COMMAND);
  +        if(command != null) {
  +            try {
  +                Class cmd = Class.forName(command);
  +                putValue(COMMAND, cmd);
  +            }
  +            catch(Exception ex) {
  +                // XXX log me.
  +                ex.printStackTrace();
  +            }
  +        }
  +
           // Add an icon if any (which means it'll show up on the tool bar).
           String iconName = getString("icon");
           if(iconName != null) {
  @@ -288,6 +302,16 @@
   	 */
       public boolean isToggle() {
           return _toggle;
  +    }
  +
  +
  +	/** 
  +	 * Get the assciated command class.
  +	 * 
  +	 * @return Command class.
  +	 */
  +    public Class getCommandClass() {
  +        return (Class) getValue(COMMAND);
       }
   
       /** 
  
  
  
  1.3       +11 -1     jakarta-ant/src/antidote/org/apache/tools/ant/gui/AppContext.java
  
  Index: AppContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/AppContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AppContext.java	2000/11/16 18:32:23	1.2
  +++ AppContext.java	2000/11/24 17:09:12	1.3
  @@ -61,7 +61,7 @@
    * A container for the state information for the application. Provides
    * a centeralized place to gain access to resources and data.
    * 
  - * @version $Revision: 1.2 $ 
  + * @version $Revision: 1.3 $ 
    * @author Simeon Fitch 
    */
   public class AppContext {
  @@ -152,6 +152,16 @@
   	 */
       public void removeBuildListener(BuildListener l) {
           _buildListeners.remove(l);
  +    }
  +
  +	/** 
  +	 * Determine if the given BuildListener is registered.
  +	 * 
  +	 * @param l Listener to test for.
  +	 * @return True if listener has been added, false if unknown.
  +	 */
  +    public boolean isRegisteredBuildListener(BuildListener l) {
  +        return _buildListeners.contains(l);
       }
   
   	/** 
  
  
  
  1.7       +9 -36     jakarta-ant/src/antidote/org/apache/tools/ant/gui/EventResponder.java
  
  Index: EventResponder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/EventResponder.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- EventResponder.java	2000/11/16 19:40:48	1.6
  +++ EventResponder.java	2000/11/24 17:09:12	1.7
  @@ -63,7 +63,7 @@
    * The purpose of this class is to watch for events that require some sort
    * of action, like opening a file.
    * 
  - * @version $Revision: 1.6 $ 
  + * @version $Revision: 1.7 $ 
    * @author Simeon Fitch 
    */
   class EventResponder {
  @@ -114,44 +114,17 @@
           public boolean eventPosted(EventObject event) {
               String command = ((ActionEvent)event).getActionCommand();
   
  -            // XXX turn this switch structure into a command
  -            // lookup using an initialized hash table.
  -            if(command.equals(OpenCmd.ACTION_NAME)) {
  -                new OpenCmd(_context).execute();
  +            Command cmd = 
  +                _context.getActions().getActionCommand(command, _context);
  +            if(cmd != null) {
  +                cmd.run();
  +                return false;
               }
  -            else if(command.equals(SaveCmd.ACTION_NAME)) {
  -                new SaveCmd(_context).execute();
  -            }
  -            else if(command.equals(SaveAsCmd.ACTION_NAME)) {
  -                new SaveAsCmd(_context).execute();
  -            }
  -            else if(command.equals(BuildCmd.ACTION_NAME)) {
  -                new BuildCmd(_context).execute();
  -            }
  -            else if(command.equals(CloseCmd.ACTION_NAME)) {
  -                new CloseCmd(_context).execute();
  -            }
  -            else if(command.equals(ExitCmd.ACTION_NAME)) {
  -                new ExitCmd(_context).execute();
  -            }
  -            else if(command.equals(AboutCmd.ACTION_NAME)) {
  -                new AboutCmd(_context).execute();
  -            }
  -            else if(command.equals(ChangeLookAndFeelCmd.ACTION_NAME)) {
  -                new ChangeLookAndFeelCmd(_context).execute();
  -            }
  -            else if(command.equals(ChangeLookAndFeelCmd.ACTION_NAME)) {
  -                new ChangeLookAndFeelCmd(_context).execute();
  -            }
  -            else if(command.equals(EmacsNotifyCmd.ACTION_NAME)) {
  -                AbstractButton source = (AbstractButton) event.getSource();
  -                new EmacsNotifyCmd(_context, source.isSelected()).execute();
  -            }
               else {
   				// XXX log me.
                   System.err.println("Unhandled action: " + command);
  +                return true;
               }
  -            return true;
           }
       }
   
  @@ -186,8 +159,8 @@
           public boolean eventPosted(EventObject event) {
               AntEvent e = (AntEvent) event;
               Command cmd = e.createDefaultCmd();
  -            cmd.execute();
  -            return true;
  +            cmd.run();
  +            return cmd instanceof NoOpCmd;
           }
       }
   
  
  
  
  1.6       +5 -3      jakarta-ant/src/antidote/org/apache/tools/ant/gui/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/Main.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Main.java	2000/11/16 22:38:38	1.5
  +++ Main.java	2000/11/24 17:09:13	1.6
  @@ -60,7 +60,7 @@
   /**
    * Launch point for the Antidote GUI. Configurs it as an application.
    * 
  - * @version $Revision: 1.5 $ 
  + * @version $Revision: 1.6 $ 
    * @author Simeon Fitch 
    */
   public class Main {
  @@ -96,11 +96,13 @@
   
               f.setVisible(true);
   
  -
               // XXX this will change once full command line argument parsing
               // is supported.
               if(args.length > 0) {
  -                new LoadFileCmd(context, new File(args[0])).execute();
  +                LoadFileCmd load = new LoadFileCmd();
  +                load.setFile(new File(args[0]));
  +                load.setContext(context);
  +                load.run();
               }
           }
           catch(Exception ex) {
  
  
  
  1.2       +6 -11     jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/AboutCmd.java
  
  Index: AboutCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/AboutCmd.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AboutCmd.java	2000/11/03 12:04:26	1.1
  +++ AboutCmd.java	2000/11/24 17:09:15	1.2
  @@ -61,28 +61,23 @@
   /**
    * Handler for the About command.
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
  -public class AboutCmd implements Command {
  -    /** Name of the about command. */
  -    public static final String ACTION_NAME = "about";
  -	/** Application context. */
  -	private AppContext _context = null;
  +public class AboutCmd extends AbstractCommand {
  +
   	/** 
   	 * Standard constructor. 
   	 * 
  -	 * @param window 
   	 */
  -    public AboutCmd(AppContext context) {
  -        _context = context;
  +    public AboutCmd() {
       }
   
   	/** 
   	 * Show the about box.
   	 * 
   	 */
  -    public void execute() {
  -		new About(_context);
  +    public void run() {
  +		new About(getContext());
       }
   }
  
  
  
  1.3       +7 -13     jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/BuildCmd.java
  
  Index: BuildCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/BuildCmd.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BuildCmd.java	2000/11/09 23:14:17	1.2
  +++ BuildCmd.java	2000/11/24 17:09:15	1.3
  @@ -59,37 +59,31 @@
   /**
    * Starts an Ant build.
    * 
  - * @version $Revision: 1.2 $ 
  + * @version $Revision: 1.3 $ 
    * @author Simeon Fitch 
    */
  -public class BuildCmd implements Command {
  -    /** Name of the action the command maps to. */
  -    public static final String ACTION_NAME = "startBuild";
  +public class BuildCmd extends AbstractCommand {
   
  -    /** The application context */
  -    private AppContext _context = null;
  -
   	/** 
   	 * Standard ctor.
   	 * 
  -	 * @param context Application context. 
   	 */
  -    public BuildCmd(AppContext context) {
  -        _context = context;
  +    public BuildCmd() {
       }
   
   	/** 
   	 * Start the Ant build.
   	 * 
   	 */
  -    public void execute() {
  -        ProjectProxy project = _context.getProject();
  +    public void run() {
  +        ProjectProxy project = getContext().getProject();
           if(project != null) {
               try {
                   project.build();
               }
               catch(Throwable ex) {
  -                _context.getEventBus().postEvent(new ErrorEvent(_context, ex));
  +                getContext().getEventBus().postEvent(
  +                    new ErrorEvent(getContext(), ex));
               }
           }
       }
  
  
  
  1.2       +5 -12     jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/ChangeLookAndFeelCmd.java
  
  Index: ChangeLookAndFeelCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/ChangeLookAndFeelCmd.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ChangeLookAndFeelCmd.java	2000/11/12 19:58:53	1.1
  +++ ChangeLookAndFeelCmd.java	2000/11/24 17:09:15	1.2
  @@ -58,30 +58,23 @@
   /**
    * ChangeLookAndFeel command.
    *
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    * @author Erik Meade
  + * @author Simeon Fitch
    */
  -public class ChangeLookAndFeelCmd implements Command {
  -    /** Name of the action the command maps to. */
  -    public static final String ACTION_NAME = "changeLookAndFeel";
  -
  -    /** The application context */
  -    private AppContext _context = null;
  -
  +public class ChangeLookAndFeelCmd extends AbstractCommand {
   	/**
   	 * Standard ctor.
   	 *
  -	 * @param context Application context.
   	 */
  -    public ChangeLookAndFeelCmd(AppContext context) {
  -        _context = context;
  +    public ChangeLookAndFeelCmd() {
       }
   
   	/**
   	 * Successfully do nothing.
   	 *
   	 */
  -    public void execute() {
  -		new ChangeLookAndFeel(_context);
  +    public void run() {
  +		new ChangeLookAndFeel(getContext());
   	}
   }
  
  
  
  1.3       +7 -13     jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/CloseCmd.java
  
  Index: CloseCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/CloseCmd.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CloseCmd.java	2000/11/14 21:50:08	1.2
  +++ CloseCmd.java	2000/11/24 17:09:15	1.3
  @@ -59,31 +59,25 @@
   /**
    * Handler for the close command.
    * 
  - * @version $Revision: 1.2 $ 
  + * @version $Revision: 1.3 $ 
    * @author Simeon Fitch 
    */
  -public class CloseCmd implements Command {
  -    /** Name of the exit command. */
  -    public static final String ACTION_NAME = "close";
  +public class CloseCmd extends AbstractCommand {
   
  -    /** Application context. */
  -    private AppContext _context = null;
  -
   	/** 
   	 * Standard constructor. 
   	 * 
  -	 * @param window 
   	 */
  -    public CloseCmd(AppContext context) {
  -        _context = context;
  +    public CloseCmd() {
       }
   
   	/** 
   	 * Send a close event to the parent window. 
   	 * 
   	 */
  -    public void execute() {
  -        _context.setProject(null);
  -        _context.getEventBus().postEvent(new ProjectClosedEvent(_context));
  +    public void run() {
  +        getContext().setProject(null);
  +        getContext().getEventBus().postEvent(
  +            new ProjectClosedEvent(getContext()));
       }
   }
  
  
  
  1.2       +19 -4     jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/Command.java
  
  Index: Command.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/Command.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Command.java	2000/11/03 12:04:28	1.1
  +++ Command.java	2000/11/24 17:09:15	1.2
  @@ -52,13 +52,28 @@
    * <http://www.apache.org/>.
    */
   package org.apache.tools.ant.gui.command;
  +import org.apache.tools.ant.gui.AppContext;
   
  +
  +
   /**
  - * Interface for commands.  Details TBD
  + * Interface for commands.  Implementation needs to have a default ctor. 
  + * Details TBD
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
  -public interface Command {
  -    public void execute();
  +public interface Command extends Runnable {
  +	/** 
  +	 * Set the application context.
  +	 * 
  +	 * @param context Application context.
  +	 */
  +    public void setContext(AppContext context);
  +
  +	/** 
  +	 * Run the command. From interface Runnable.
  +	 * 
  +	 */
  +    public void run();
   }
  
  
  
  1.3       +37 -16    jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/DisplayErrorCmd.java
  
  Index: DisplayErrorCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/DisplayErrorCmd.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DisplayErrorCmd.java	2000/11/21 01:06:15	1.2
  +++ DisplayErrorCmd.java	2000/11/24 17:09:16	1.3
  @@ -62,28 +62,31 @@
   /**
    * Command for displaying an arbitrary error message to the user.
    *
  - * @version $Revision: 1.2 $ 
  + * @version $Revision: 1.3 $ 
    * @author Simeon H.K. Fitch 
    */
  -public class DisplayErrorCmd implements Command {
  -    /** The application context */
  -    private AppContext _context = null;
  +public class DisplayErrorCmd extends AbstractCommand {
       /** Text description of error. */
       private String _message = null;
       /** Throwable associated with the error. */
       private Throwable _ex = null;
   
   	/** 
  +	 * Default ctor.
  +	 * 
  +	 */
  +    public DisplayErrorCmd() {
  +    }
  +
  +	/** 
   	 * Standard constuctor.
   	 * 
  -	 * @param context Application context.
   	 * @param message Error message.
   	 * @param ex Throwable assocated with error.
   	 */
  -    public DisplayErrorCmd(AppContext context, String message, Throwable ex) {
  -        _context = context;
  -        _message = message;
  -        _ex = ex;
  +    public DisplayErrorCmd(String message, Throwable ex) {
  +        setMessage(message);
  +        setThrowable(_ex);
       }
   
   	/** 
  @@ -92,20 +95,38 @@
   	 * @param context Application context.
   	 * @param message Error message.
   	 */
  -    public DisplayErrorCmd(AppContext context, String message) {
  -        this(context, message, null);
  +    public DisplayErrorCmd(String message) {
  +        this(message, null);
  +    }
  +
  +	/** 
  +	 * Set the error message.
  +	 * 
  +	 * @param message Error message.
  +	 */
  +    public void setMessage(String message) {
  +        _message = message;
  +    }
  +
  +	/** 
  +	 * Set the throwable associated with the error.
  +	 * 
  +	 * @param ex Throwable associated with the error.
  +	 */
  +    public void setThrowable(Throwable ex) {
  +        _ex = ex;
       }
   
   	/** 
   	 * Display the error.
   	 * 
   	 */
  -    public void execute() {
  -        // XXX change this so that exceptions can be optionally shown.
  -        String title = _context.getResources().getString(getClass(), "title"); 
  +    public void run() {
  +        String title = getContext().getResources().
  +            getString(getClass(), "title"); 
   
           JOptionPane.showMessageDialog(
  -            _context.getParentFrame(), new MsgPanel(),
  +            getContext().getParentFrame(), new MsgPanel(),
               title, JOptionPane.ERROR_MESSAGE);
       }
   
  @@ -116,7 +137,7 @@
               add(new JLabel(_message));
               if(_ex != null) {
                   add(new JLabel(_ex.getMessage()));
  -                JButton b = new JButton(_context.getResources().
  +                JButton b = new JButton(getContext().getResources().
                                           getString(DisplayErrorCmd.class, 
                                                     "expand"));
                   b.addActionListener(this);
  
  
  
  1.2       +6 -17     jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/EmacsNotifyCmd.java
  
  Index: EmacsNotifyCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/EmacsNotifyCmd.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EmacsNotifyCmd.java	2000/11/16 19:40:55	1.1
  +++ EmacsNotifyCmd.java	2000/11/24 17:09:16	1.2
  @@ -59,42 +59,31 @@
    * Toggle on or off the sending of error events to emacs so that 
    * it can display the source of the error.
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
  -public class EmacsNotifyCmd implements Command {
  -    /** Action command. */
  -    public static final String ACTION_NAME = "notifyEmacs";
  -
  +public class EmacsNotifyCmd extends AbstractCommand {
       /** A global notifier can be used as it stores no state. */
       private static EmacsNotifier _notifier = new EmacsNotifier();
  -    /** Application context. */
  -    private AppContext _context = null;
  -    /** State notification should be in. */
  -    private boolean _notify = false;
   
   	/** 
   	 * Standard ctor.
   	 * 
  -	 * @param context Application context.
        * @param state True if notifying on, false for notifying off.
   	 */
  -    public EmacsNotifyCmd(AppContext context, boolean state) {
  -        _context = context;
  -        _notify = state;
  +    public EmacsNotifyCmd() {
       }
   
   	/** 
   	 * Turn on or off the notifying of emacs.
   	 * 
   	 */
  -    public void execute() {
  -        if(_notify) {
  -            _context.addBuildListener(_notifier);
  +    public void run() {
  +        if(getContext().isRegisteredBuildListener(_notifier)) {
  +            getContext().removeBuildListener(_notifier);
           }
           else {
  -            _context.removeBuildListener(_notifier);
  +            getContext().addBuildListener(_notifier);
           }
  -        
       }
   }
  
  
  
  1.2       +5 -13     jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/ExitCmd.java
  
  Index: ExitCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/ExitCmd.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExitCmd.java	2000/11/03 12:04:29	1.1
  +++ ExitCmd.java	2000/11/24 17:09:16	1.2
  @@ -62,31 +62,23 @@
   /**
    * Handler for an exit command .
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
  -public class ExitCmd implements Command {
  -    /** Name of the exit command. */
  -    public static final String ACTION_NAME = "exit";
  -
  -    /** Window to send close event to. */
  -    private Window _window = null;
  -
  +public class ExitCmd extends AbstractCommand {
   	/** 
   	 * Standard constructor. 
   	 * 
  -	 * @param context Application context.
   	 */
  -    public ExitCmd(AppContext context) {
  -        _window = context.getParentFrame();
  +    public ExitCmd() {
       }
   
   	/** 
   	 * Send a close event to the parent window. 
   	 * 
   	 */
  -    public void execute() {
  +    public void run() {
           // Manually send a window close event to the window.
  -		WindowUtils.sendCloseEvent(_window);
  +		WindowUtils.sendCloseEvent(getContext().getParentFrame());
       }
   }
  
  
  
  1.4       +20 -17    jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/LoadFileCmd.java
  
  Index: LoadFileCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/LoadFileCmd.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LoadFileCmd.java	2000/11/21 01:06:15	1.3
  +++ LoadFileCmd.java	2000/11/24 17:09:17	1.4
  @@ -61,23 +61,26 @@
   /**
    * Command for reading in a build file and initializing the data model.
    * 
  - * @version $Revision: 1.3 $ 
  + * @version $Revision: 1.4 $ 
    * @author Simeon Fitch 
    */
  -public class LoadFileCmd implements Command {
  -    /** The application context */
  -    private AppContext _context = null;
  +public class LoadFileCmd extends  AbstractCommand {
       /** The file to load. */
       private File _file = null;
   
   	/** 
   	 * Standard ctor.
   	 * 
  -	 * @param context Application context.
  -	 * @param file The file to load.
   	 */
  -    public LoadFileCmd(AppContext context, File file) {
  -        _context = context;
  +    public LoadFileCmd() {
  +    }
  +
  +	/** 
  +	 * Set the file to load.
  +	 * 
  +	 * @param file File to load.
  +	 */
  +    public void setFile(File file) {
           _file = file;
       }
   
  @@ -85,26 +88,26 @@
   	 * Open the file and load it.
   	 * 
   	 */
  -    public void execute() {
  +    public void run() {
           if(!_file.exists()) {
  -            String message = _context.getResources().getMessage(
  +            String message = getContext().getResources().getMessage(
                   getClass(), "noFile", new Object[] { _file.toString() });
   
  -            _context.getEventBus().
  -                postEvent(new ErrorEvent(_context, message));
  +            getContext().getEventBus().
  +                postEvent(new ErrorEvent(getContext(), message));
           }
           else {
               try {
  -                ProjectProxy project = new ProjectProxy(_context, _file);
  -                _context.setProject(project);
  +                ProjectProxy project = new ProjectProxy(getContext(), _file);
  +                getContext().setProject(project);
               }
               catch(Exception ex) {
  -                String message = _context.getResources().getMessage(
  +                String message = getContext().getResources().getMessage(
                       getClass(), "loadError", 
                       new Object[] { _file.toString() });
   
  -                _context.getEventBus().
  -                    postEvent(new ErrorEvent(_context, message, ex));
  +                getContext().getEventBus().
  +                    postEvent(new ErrorEvent(getContext(), message, ex));
               }
           }
       }
  
  
  
  1.2       +3 -3      jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/NoOpCmd.java
  
  Index: NoOpCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/NoOpCmd.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NoOpCmd.java	2000/11/03 12:04:29	1.1
  +++ NoOpCmd.java	2000/11/24 17:09:17	1.2
  @@ -56,13 +56,13 @@
   /**
    * NoOp command.
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
  -public class NoOpCmd implements Command {
  +public class NoOpCmd extends AbstractCommand {
   	/** 
   	 * Successfully do nothing.
   	 * 
   	 */
  -    public void execute() {}
  +    public void run() {}
   }
  
  
  
  1.3       +10 -19    jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/OpenCmd.java
  
  Index: OpenCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/OpenCmd.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OpenCmd.java	2000/11/16 19:40:56	1.2
  +++ OpenCmd.java	2000/11/24 17:09:17	1.3
  @@ -64,26 +64,15 @@
    * user for selecting a build file to open. If a file is selected then an
    * OpenRequestEvent is posted.
    * 
  - * @version $Revision: 1.2 $ 
  + * @version $Revision: 1.3 $ 
    * @author Simeon Fitch 
    */
  -public class OpenCmd implements Command {
  -    /** Name of the action the command maps to. */
  -    public static final String ACTION_NAME = "open";
  -
  -    /** The application context */
  -    private AppContext _context = null;
  -    /** Filter for showing only XML files. */
  -    private FileFilter _filter = null;
  -
  +public class OpenCmd extends AbstractCommand {
   	/** 
   	 * Standard ctor.
   	 * 
  -	 * @param context Application context. 
   	 */
  -    public OpenCmd(AppContext context) {
  -        _context = context;
  -        _filter = new XMLFileFilter(_context.getResources());
  +    public OpenCmd() {
       }
   
   	/** 
  @@ -92,14 +81,16 @@
        * operation be completed.
   	 * 
   	 */
  -    public void execute() {
  +    public void run() {
  +        FileFilter filter = new XMLFileFilter(getContext().getResources());
  +
           JFileChooser chooser = new JFileChooser();
  -        chooser.addChoosableFileFilter(_filter);
  -        int val = chooser.showOpenDialog(_context.getParentFrame());
  +        chooser.addChoosableFileFilter(filter);
  +        int val = chooser.showOpenDialog(getContext().getParentFrame());
           if(val == JFileChooser.APPROVE_OPTION) {
               File selected = chooser.getSelectedFile();
  -            _context.getEventBus().postEvent(
  -                new OpenRequestEvent(_context, selected));
  +            getContext().getEventBus().postEvent(
  +                new OpenRequestEvent(getContext(), selected));
           }
       }
   }
  
  
  
  1.2       +98 -7     jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/SaveAsCmd.java
  
  Index: SaveAsCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/SaveAsCmd.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SaveAsCmd.java	2000/11/16 19:40:57	1.1
  +++ SaveAsCmd.java	2000/11/24 17:09:17	1.2
  @@ -53,24 +53,115 @@
    */
   package org.apache.tools.ant.gui.command;
   import org.apache.tools.ant.gui.AppContext;
  +import org.apache.tools.ant.gui.ProjectProxy;
  +import org.apache.tools.ant.gui.event.ErrorEvent;
  +import java.io.File;
  +import java.io.FileWriter;
  +import java.io.IOException;
  +import org.apache.tools.ant.gui.XMLFileFilter;
  +import javax.swing.JFileChooser;
  +import javax.swing.filechooser.FileFilter;
  +import javax.swing.JOptionPane;
   
   
   /**
    * Command for doing a "Save as" type of save.
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
  -public class SaveAsCmd extends SaveCmd {
  -    /** Name of the action the command maps to. */
  -    public static final String ACTION_NAME = "saveas";
  +public class SaveAsCmd extends AbstractCommand {
  +    /** File to save to. */
  +    private File _file = null;
   
   	/** 
   	 * Standard ctor.
   	 * 
  -	 * @param context Application context.
   	 */
  -    public SaveAsCmd(AppContext context) {
  -        super(context, null);
  +    public SaveAsCmd() {
       }
  +
  +	/** 
  +	 * Set the file to save to. 
  +	 * 
  +	 * @param file File to save to.
  +	 */
  +    public void setFile(File file) {
  +        _file = file;
  +    }
  +
  +
  +	/** 
  +	 * Save the project to the current file name.
  +	 * 
  +	 */
  +    public void run() {
  +        FileFilter filter = new XMLFileFilter(getContext().getResources());
  +
  +        ProjectProxy project = getContext().getProject();
  +        if(project != null) {
  +            if(_file == null) {
  +                // XXX code here to select a file to save to.
  +                JFileChooser chooser = new JFileChooser();
  +                chooser.addChoosableFileFilter(filter);
  +                int val = chooser.showSaveDialog(
  +                    getContext().getParentFrame());
  +                if(val == JFileChooser.APPROVE_OPTION) {
  +                    _file = chooser.getSelectedFile();
  +                    if(_file.exists()) {
  +                        String title = getContext().getResources().
  +                            getString(SaveCmd.class, "title");
  +                        String message = getContext().getResources().
  +                            getMessage(SaveCmd.class, "overwrite", 
  +                                       new Object[] {_file.toString()});
  +                        val = JOptionPane.showConfirmDialog(
  +                            getContext().getParentFrame(), message, title, 
  +                            JOptionPane.YES_NO_OPTION);
  +                        // If cancelled unset file.
  +                        if(val != JOptionPane.YES_OPTION) {
  +                            _file = null;
  +                        }
  +                    }
  +                }
  +            }
  +            
  +            if(_file != null) {
  +                project.setFile(_file);
  +                FileWriter out = null;
  +                try {
  +                    out = new FileWriter(_file);
  +                    project.write(out);
  +                }
  +                catch(IOException ex) {
  +                    String message = getContext().getResources().getMessage(
  +                        SaveCmd.class, "saveError", 
  +                        new Object[] { _file.toString() });
  +                    
  +                    getContext().getEventBus().
  +                        postEvent(new ErrorEvent(getContext(), message));
  +                }
  +                finally {
  +                    if (out != null) {
  +                        try {
  +                            out.flush();
  +                            out.close();
  +                        }
  +                        catch(IOException ex) {
  +                            // Intentionally ignored.
  +                        }
  +                    }
  +                }
  +            }
  +        }
  +        else {
  +            // We shouldn't ever get here.
  +            String message = getContext().getResources().getString(
  +                SaveCmd.class, "noProject"); 
  +            
  +            getContext().getEventBus().
  +                postEvent(new ErrorEvent(getContext(), message));
  +            
  +        }
  +    }
  +
   }
  
  
  
  1.2       +7 -104    jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/SaveCmd.java
  
  Index: SaveCmd.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/SaveCmd.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SaveCmd.java	2000/11/16 19:40:57	1.1
  +++ SaveCmd.java	2000/11/24 17:09:17	1.2
  @@ -53,122 +53,25 @@
    */
   package org.apache.tools.ant.gui.command;
   import org.apache.tools.ant.gui.AppContext;
  -import org.apache.tools.ant.gui.ProjectProxy;
  -import org.apache.tools.ant.gui.event.ErrorEvent;
  -import java.io.File;
  -import java.io.FileWriter;
  -import java.io.IOException;
  -import org.apache.tools.ant.gui.XMLFileFilter;
  -import javax.swing.JFileChooser;
  -import javax.swing.filechooser.FileFilter;
  -import javax.swing.JOptionPane;
   
   /**
    * Command to execute the saving of the current build file.
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
  -public class SaveCmd implements Command {
  -    /** Name of the action the command maps to. */
  -    public static final String ACTION_NAME = "save";
  +public class SaveCmd extends SaveAsCmd {
   
  -    /** The application context */
  -    private AppContext _context = null;
  -    /** Filter for showing only XML files. */
  -    private FileFilter _filter = null;
  -    /** File to save to. */
  -    private File _file = null;
  -
  -	/** 
  -	 * Standard ctor with file.
  -	 * 
  -	 * @param context Application context.
  -	 * @param file File to save to, or null.
  -	 */
  -    public SaveCmd(AppContext context, File file) {
  -        _context = context;
  -        _filter = new XMLFileFilter(_context.getResources());
  -        _file = file;
  +    public SaveCmd() {
       }
   
   	/** 
  -	 * Standard ctor.
  +	 * Set the application context.
   	 * 
  -	 * @param context Application context. 
  -	 */
  -    public SaveCmd(AppContext context) {
  -        this(context, context.getProject() == null ? null : 
  -             context.getProject().getFile());
  -    }
  -
  -	/** 
  -	 * Save the project to the current file name.
  -	 * 
  +	 * @param context Application context.
   	 */
  -    public void execute() {
  -        ProjectProxy project = _context.getProject();
  -        if(project != null) {
  -            if(_file == null) {
  -                // XXX code here to select a file to save to.
  -                JFileChooser chooser = new JFileChooser();
  -                chooser.addChoosableFileFilter(_filter);
  -                int val = chooser.showSaveDialog(_context.getParentFrame());
  -                if(val == JFileChooser.APPROVE_OPTION) {
  -                    _file = chooser.getSelectedFile();
  -                    if(_file.exists()) {
  -                        String title = _context.getResources().getString(
  -                            SaveCmd.class, "title");                         
  -                        String message = _context.getResources().getMessage(
  -                            SaveCmd.class, "overwrite", 
  -                            new Object[] {_file.toString()});
  -                        val = JOptionPane.showConfirmDialog(
  -                            _context.getParentFrame(), message, title, 
  -                            JOptionPane.YES_NO_OPTION);
  -                        // If cancelled unset file.
  -                        if(val != JOptionPane.YES_OPTION) {
  -                            _file = null;
  -                        }
  -                    }
  -                }
  -            }
  -            
  -            if(_file != null) {
  -                project.setFile(_file);
  -                FileWriter out = null;
  -                try {
  -                    out = new FileWriter(_file);
  -                    project.write(out);
  -                }
  -                catch(IOException ex) {
  -                    String message = _context.getResources().getMessage(
  -                        SaveCmd.class, "saveError", 
  -                        new Object[] { _file.toString() });
  -                    
  -                    _context.getEventBus().
  -                        postEvent(new ErrorEvent(_context, message));
  -                }
  -                finally {
  -                    if (out != null) {
  -                        try {
  -                            out.flush();
  -                            out.close();
  -                        }
  -                        catch(IOException ex) {
  -                            // Intentionally ignored.
  -                        }
  -                    }
  -                }
  -            }
  -        }
  -        else {
  -            // We shouldn't ever get here.
  -            String message = _context.getResources().getString(
  -                SaveCmd.class, "noProject"); 
  -            
  -            _context.getEventBus().
  -                postEvent(new ErrorEvent(_context, message));
  -            
  -        }
  +    public void setContext(AppContext context) {
  +        super.setContext(context);
  +        setFile(context.getProject().getFile());
       }
   }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/AbstractCommand.java
  
  Index: AbstractCommand.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", "Tomcat", 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.command;
  import org.apache.tools.ant.gui.AppContext;
  
  
  /**
   * Convenience base class for Command implementations.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public abstract class AbstractCommand implements Command {
  	/** Application context. */
  	private AppContext _context = null;
  
  	/** 
  	 * Default ctor.
  	 * 
  	 */
      protected AbstractCommand() {
      }
  
  	/** 
  	 * Set the application context.
  	 * 
  	 * @param context Application context.
  	 */
      public void setContext(AppContext context) {
          _context = context;
      }
  
  	/** 
  	 * Get the application context that was provided to setContext();
  	 * 
  	 * @return Application context.
  	 */
      protected AppContext getContext() {
          return _context;
      }
  
  	/** 
  	 * Run the command. From interface Runnable.
  	 * 
  	 */
      public abstract void run();
  
  }
  
  
  
  1.3       +2 -2      jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/AntEvent.java
  
  Index: AntEvent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/AntEvent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AntEvent.java	2000/11/15 21:25:58	1.2
  +++ AntEvent.java	2000/11/24 17:09:21	1.3
  @@ -59,7 +59,7 @@
   /**
    * Base class for all Ant specific events. Details TBD.
    * 
  - * @version $Revision: 1.2 $ 
  + * @version $Revision: 1.3 $ 
    * @author Simeon Fitch 
    */
   public abstract class AntEvent extends EventObject {
  @@ -81,7 +81,7 @@
   	 * 
   	 * @return Application context.
   	 */
  -    protected AppContext getAppContext() {
  +    protected AppContext getContext() {
           return (AppContext) getSource();
       }
   
  
  
  
  1.2       +4 -2      jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/ErrorEvent.java
  
  Index: ErrorEvent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/ErrorEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ErrorEvent.java	2000/11/03 12:04:30	1.1
  +++ ErrorEvent.java	2000/11/24 17:09:21	1.2
  @@ -61,7 +61,7 @@
   /**
    * Event fired whenever there is an error of any sort.
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
   public class ErrorEvent extends AntEvent {
  @@ -109,7 +109,9 @@
   	 * @return Command representing an appropriate response to this event.
   	 */
       public Command createDefaultCmd() {
  -        return new DisplayErrorCmd(getAppContext(), _message, _ex);
  +        Command retval = new DisplayErrorCmd(_message, _ex);
  +        retval.setContext(getContext());
  +        return retval;
       }
   
   	/** 
  
  
  
  1.2       +5 -2      jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/OpenRequestEvent.java
  
  Index: OpenRequestEvent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/OpenRequestEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OpenRequestEvent.java	2000/11/03 12:04:30	1.1
  +++ OpenRequestEvent.java	2000/11/24 17:09:21	1.2
  @@ -60,7 +60,7 @@
   /**
    * Event for requesting that the given file be opened.
    * 
  - * @version $Revision: 1.1 $ 
  + * @version $Revision: 1.2 $ 
    * @author Simeon Fitch 
    */
   public class OpenRequestEvent extends AntEvent {
  @@ -85,7 +85,10 @@
   	 * @return Load command.
   	 */
       public Command createDefaultCmd() {
  -        return new LoadFileCmd(getAppContext(), _file);
  +        LoadFileCmd load = new LoadFileCmd();
  +        load.setFile(_file);
  +        load.setContext(getContext());
  +        return load;
       }
   }
   
  
  
  
  1.8       +9 -0      jakarta-ant/src/antidote/org/apache/tools/ant/gui/resources/action.properties
  
  Index: action.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/resources/action.properties,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- action.properties	2000/11/16 19:41:04	1.7
  +++ action.properties	2000/11/24 17:09:22	1.8
  @@ -14,12 +14,14 @@
   open.icon=open.gif
   open.accelerator=control O
   open.enabled=true
  +open.command=org.apache.tools.ant.gui.command.OpenCmd
   
   save.name=Save
   save.shortDescription=Save the current project
   save.parentMenuName=File
   save.icon=save.gif
   save.accelerator=control S
  +save.command=org.apache.tools.ant.gui.command.SaveCmd
   save.enabled=false
   save.disableOn= \
       org.apache.tools.ant.gui.event.ProjectClosedEvent, \
  @@ -31,6 +33,7 @@
   saveas.name=Save As...
   saveas.shortDescription=Save to a specific file
   saveas.parentMenuName=File
  +saveas.command=org.apache.tools.ant.gui.command.SaveAsCmd
   saveas.enabled=false
   saveas.disableOn= \
       org.apache.tools.ant.gui.event.ProjectClosedEvent, \
  @@ -42,6 +45,7 @@
   close.name=Close
   close.shortDescription=Close the current project
   close.parentMenuName=File
  +close.command=org.apache.tools.ant.gui.command.CloseCmd
   close.enabled=false
   close.disableOn= \
       org.apache.tools.ant.gui.event.ProjectClosedEvent, \
  @@ -54,6 +58,7 @@
   exit.shortDescription=Quit the application
   exit.parentMenuName=File
   exit.separator=true
  +exit.command=org.apache.tools.ant.gui.command.ExitCmd
   exit.enabled=true
   
   about.name=About...
  @@ -61,6 +66,7 @@
   about.parentMenuName=Help
   about.separator=true;
   about.enabled=true
  +about.command=org.apache.tools.ant.gui.command.AboutCmd
   
   startBuild.name=Start Build
   startBuild.shortDescription=Start build of selected target
  @@ -68,6 +74,7 @@
   startBuild.icon=start.gif
   startBuild.separator=true
   startBuild.accelerator=control B
  +startBuild.command=org.apache.tools.ant.gui.command.BuildCmd
   startBuild.enabled=false
   startBuild.enableOn=\
       org.apache.tools.ant.gui.event.NewProjectEvent, \
  @@ -90,6 +97,7 @@
   changeLookAndFeel.name=Look and Feel...
   changeLookAndFeel.shortDescription=Change the Look and Feel
   changeLookAndFeel.parentMenuName=Options
  +changeLookAndFeel.command=org.apache.tools.ant.gui.command.ChangeLookAndFeelCmd
   changeLookAndFeel.enabled=true
   changeLookAndFeel.separator=true
   
  @@ -98,3 +106,4 @@
       Send a notification event to Emacs on build errors.
   notifyEmacs.parentMenuName=Options
   notifyEmacs.toggle=true
  +notifyEmacs.command=org.apache.tools.ant.gui.command.EmacsNotifyCmd
  
  
  

Mime
View raw message