ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@locus.apache.org
Subject cvs commit: jakarta-ant/src/antidote/org/apache/tools/ant/gui/util StackFrame.java WindowUtils.java
Date Fri, 03 Nov 2000 12:04:32 GMT
conor       00/11/03 04:04:32

  Added:       src/antidote ChangeLog build.xml
               src/antidote/docs gui-requirements.html
               src/antidote/etc manifest
               src/antidote/org/apache/tools/ant/gui About.java
                        ActionManager.java AntEditor.java Antidote.java
                        AppContext.java Console.java EventResponder.java
                        Main.java ProjectDocument.java
                        ProjectNavigator.java ProjectProxy.java
                        ProjectTreeModel.java PropertyEditor.java
                        ResourceManager.java SourceEditor.java
                        XMLFileFilter.java XMLHelper.java version.txt
               src/antidote/org/apache/tools/ant/gui/command AboutCmd.java
                        CloseCmd.java Command.java DisplayErrorCmd.java
                        ExitCmd.java LoadFileCmd.java NoOpCmd.java
                        OpenCmd.java
               src/antidote/org/apache/tools/ant/gui/event AntEvent.java
                        BusFilter.java BusMember.java ErrorEvent.java
                        EventBus.java NewProjectEvent.java
                        OpenRequestEvent.java
               src/antidote/org/apache/tools/ant/gui/resources
                        action.properties antidote.properties new.gif
                        open.gif save.gif
               src/antidote/org/apache/tools/ant/gui/util StackFrame.java
                        WindowUtils.java
  Log:
  The initial checkin of antidote - the ant GUI.
  
  This initial version is mainly to establish the source infrastructure. The
  code currently compiles under JDK 1.2+ and provides a basic GUI which is able
  to open a build.xml file.
  
  Stay tuned ...
  
  Submitted by:	Simeon Fitch <metasim@yahoo.com>
  
  Revision  Changes    Path
  1.1                  jakarta-ant/src/antidote/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  2000-11-02  Simeon H.K. Fitch  <simeon@fitch.net>
  
  	* org/apache/tools/ant/gui/event/EventBus.java: Added interrupt
  	level support.
  
  	* org/apache/tools/ant/gui/About.java: Created
  	
  2000-11-01  Simeon H.K. Fitch  <simeon@fitch.net>
  
  	* org/apache/tools/ant/gui/Main.java: Added XMLHelper.init() call
  	
  	* build.xml: Updated run target to include ant.jar in classpath.
  
  
  
  
  1.1                  jakarta-ant/src/antidote/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- ======================================================================= -->
  <!-- Ant GUI build file                                                      -->
  <!-- ======================================================================= -->
  
  <project name="Antidote" default="compile" basedir=".">
  
    <!-- Give user a chance to override without editing this file 
         (and without typing -D each time it compiles it) -->
    <property file="${user.home}/.ant.properties" />
  
    <property name="Name" value="Antidote"/>
    <property name="name" value="antidote"/>
    <property name="version" value="0.1"/>
  
    <property name="src.dir" value="."/>
    <property name="build.dir" value="../../../build/antidote"/>
    <property name="lib.dir" value="${build.dir}/lib"/>
    <property name="build.classes" value="${build.dir}/classes"/>
    <property name="build.javadocs" value="${build.dir}/javadocs"/>
    <property name="manifest" value="${src.dir}/etc/manifest"/>
  
    <path id="classpath">
    </path>
    <property name="packages" value="org.apache.tools.*"/>
  
  
    <!-- =================================================================== -->
    <!-- Set some the defaults the user can override in .ant.properties      -->
    <!-- =================================================================== -->
    <property name="build.compiler" value="classic"/>
    <property name="build.compiler.emacs" value="on"/>
    <property name="junit.fork" value="false" />
  
    <!-- =================================================================== -->
    <!-- Prepares the build directory                                        -->
    <!-- =================================================================== -->
    <target name="prepare">
      <mkdir dir="${build.dir}"/>
      <tstamp />
    </target>
  
    <!-- =================================================================== -->
    <!-- Compiles the source code                                            -->
    <!-- =================================================================== -->
    <target name="compile" depends="prepare">
      <mkdir dir="${build.classes}"/>
  
      <javac srcdir="${src.dir}"
             destdir="${build.classes}"
             debug="on"
             deprecation="off"
             optimize="on" >
        <classpath refid="classpath" />
      </javac>
   
      <copy todir="${build.classes}">
        <fileset dir="${src.dir}">
          <include name="**/*.properties" />
          <include name="**/*.gif" />
        </fileset>
      </copy>
  
      <filter token="VERSION" value="${version}" />
      <filter token="DATE" value="${TODAY}" />
      <filter token="TIME" value="${TSTAMP}" />
      <copy    todir="${build.classes}" 
               overwrite="true"
               filtering="on">
        <fileset dir="${src.dir}">
          <include name="**/version.txt" />
        </fileset>
      </copy>
    </target>
  
    <!-- =================================================================== -->
    <!-- Creates the jar archive                                             -->
    <!-- =================================================================== -->
    <target name="jar" depends="compile">
      <mkdir dir="${lib.dir}"/>
      <jar jarfile="${lib.dir}/${name}.jar"
           basedir="${build.classes}"
           includes="org/**"
           manifest="${manifest}"/>
    </target>
  
    <!-- =================================================================== -->
    <!-- Creates the API documentation                                       -->
    <!-- =================================================================== -->
    <target name="javadocs" depends="prepare" 
      description="Creates the API documentation">
      <mkdir dir="${build.javadocs}"/>
      <javadoc packagenames="${packages}"
               sourcepath="${basedir}/${src.dir}"
               destdir="${build.javadocs}"
               author="true"
               version="true"
               windowtitle="${Name} API"
               doctitle="${Name}"
               bottom="Copyright &#169; 2000 Apache Software Foundation. All Rights Reserved.">
        <group title="Ant Gui" packages="org.apache.tools.ant.gui*" />
      </javadoc>
    </target>
  
  
    <!-- =================================================================== -->
    <!-- Run the GUI                                                         -->
    <!-- =================================================================== -->
    <target name="run" depends="compile" description="Run Antidote">
      <java classname="org.apache.tools.ant.gui.Main" 
            fork="yes" 
            dir="${user.home}">
        <jvmarg value="-Djava.compiler=NONE"/>
        <classpath>
          <pathelement location="${build.classes}"/>
          <pathelement location="${ant.home}/lib/ant.jar"/>
        </classpath>
      </java>
    </target>
  
    <!-- =================================================================== -->
    <!-- Cleans up generated stuff                                           -->
    <!-- =================================================================== -->
    <target name="clean">
      <delete dir="${build.dir}"/>
    </target>
  
  </project>
  
  
  
  
  1.1                  jakarta-ant/src/antidote/docs/gui-requirements.html
  
  Index: gui-requirements.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "strict.dtd">
  <HTML> 
    <HEAD> 
  	 <TITLE>Ant GUI Feature List</TITLE> 
    </HEAD> 
    <BODY> 
      <H1>Ant GUI Feature List</H1>
      <P>Version 0.3 (2000/10/31)</P>
      <P>Authors: 
      <A HREF="mailto:simeon@fitch.net">Simeon H.K. Fitch</A>,
      <A HREF="mailto:chris@christophertodd.com">Chris Todd</A>,
      <A HREF="mailto:clint.combs@contrado.com">Clint Combs</A>,
      <A HREF="mailto:conor@ebinteractive.com.au">Conor MacNeill</A>,
      <A HREF="mailto:matthew.k.heun@gaerospace.com">Matthew Kuperus Heun</A>,
      <A HREF="mailto:duncan@x180.com">James Duncan Davidson</A>
      
      
      <P>The purpose of this document is to capture the proposed feature list for
      the Ant Graphical User Interface. This is not a hard requirements
      specification; you won't find the word "shall" in it (other than that one
      time). :-)</P>
  
      <P>In general, the purpose of the GUI is to allow the quick generation and
      modification of Ant build files, helping the user define their build process
      and track down build problems. For it to be successful it must make the user
      more efficient and productive, insofar as their involvement in build
      management and use of Ant goes. It should first address the needs of the
      novice Ant user, and then add abilities for the "power" user. This does not
      imply that the UI should be "dumbed down", it just means that usability
      should come before slick but complicated features.</P>
  
      <P>The features are in a loose order of expressed interested by
      contributors.</P>
      
  
      <!-- Section List -->
      <OL TYPE="A">
  
  
        <LI><H2>Build Management</H2></LI>
        <P>Once a build file is created, the user will want to start and
        stop it from the UI. This will serve both as a testing facility as well as
        a general compile tool. Monitoring of the build can occur through the Ant
        BuildListener interface.</P>
        <OL>
          <LI>Build execution.</LI>
          <OL TYPE="a">
            <LI>Initiate a build starting from any task.</LI>
            <LI>Stop a currently active build.</LI>
          </OL>
          <LI>Build monitoring.</LI>
          <OL TYPE="a">
            <LI>Provide feedback on the current status of the build.<BR>
            <I>This is where you can have more fun with the directed graph view,
            where the current build activity is highlighted on the screen, making
            the whole thing behave like a dynamic state transition diagram. You
            can then highlight the node where the build fails, etc.</I></LI>
            <LI>Show log messages from the build, allowing the user to determine
            the task they originated from.</LI>
            <LI>Provide the ability to filter logged messages, adn to display the
            messages in color codes corresponding to logging levels.</LI>
            <LI>Allow the installation of custom log listeners</LI>
            <LI>Record runtime statistics to determine bottleneck in the build
            process<BR>
            <I>This may be of limited use, as calling &lt;javac&gt; probably takes
            the most time. But maybe not.</I></LI> 
          </OL>
        </OL>
        <BR>
  
  
        <LI><H2>Build Wizard (auto-configure)</H2></LI>
        <P>To make starting a new project with Ant as easy as possible, the a
        wizard type of UI can be used where the user provides some basic
        information and the application deduces what a default build.xml file for
        it should look like.</P>
        <OL>
          <LI>Project attributes.</LI>
          <OL TYPE="a">
            <LI>Provide input for the required project attributes.<BR>
            <I>This probably means project name and default target.</I></LI>
          </OL>
          <LI>Project directories.</LI>
          <OL TYPE="a">
            <LI>Ask for the source directory.</LI>
            <LI>Ask for the destination directory.</LI>
            <LI>Ask for the necessary JAR files.</LI>
          </OL>
          <LI>Project properties.</LI>
          <OL TYPE="a">
            <LI>Provide a default set of project properties.<BR>
            <I>In here would be things like classpath, build.compiler, version,
            etc.</I></LI>
            <LI>Allow the user to add to or remove from properties the default set
            of properties.</LI>
          </OL>
          <LI>Task creation</LI>
          <OL TYPE="a">
            <LI>Provide a list of "standard" tasks to insert into the project.<BR>
            <I>This would be tasks like &lt;javac&gt; and
            &lt;javadoc&gt;.</I></LI>
            <LI>Generate default init, compile, javadoc, and clean targets.</LI>
          </OL>
          <LI>Creation review.</LI>
          <OL TYPE="a">
            <LI>Provide a review of the contents of the generated build.xml
            file.</LI>
            <LI>Allow the user to go back to any step in the process to change a
            setting.</LI> 
            <LI>Prompt the user to save the build.xml file.</LI>
          </OL>
        </OL>
        <BR>
  
  
        <LI><H2>IDE Integration</H2></LI>
        <P>Components of the Ant GUI shoule support plugging into IDEs and code
        editors.</P>
        <OL>
          <LI>Emacs</LI>
          <OL TYPE="a">
            <LI>Provide support for launching builds from emacs, and notification
            of errors.</LI>
          </OL>
          <LI>JEdit</LI>
          <OL TYPE="a">
            <LI>Provide JEdit plug-in.</LI>
          </OL>
          <LI>ProjectBuilder</LI>
          <OL TYPE="a">
            <LI>Provide integration with OSX ProjectBuilder.</LI>
          </OL>
          <LI>NetBeans</LI>
          <OL TYPE="a">
            <LI>Provide integration with the NetBeans IDE.</LI>
          </OL>
        </OL>
        <BR>
  
  
        <LI><H2>Project Editing</H2></LI>
        <P>The Ant UI will be centered around the project file. All operations of
        the UI will be on a project, whether it be existing or new. <I>How
        sub-projects are handled (i.e. via the &lt;ant&gt; task) needs to be
        determined.</I></P>
        <OL>
          <LI>Load a project.</LI>
          <OL TYPE="a">
            <LI>Read the native Ant XML format as defined by the Ant users'
            manual.</LI>
            <LI>When possible, automatically handle changes in the Ant element
            set, or at least changes to the task set, as well as the valid set of
            attributes.<BR>
            <I>Possible approach: load "default.properties", use
            introspection to discover attribute set, then reference some other
            mechanism for attributes that are manifested as properties.</I>
            </LI>
            <LI>Report errors in the XML source.</LI>
          </OL>
          <LI>View project contents.</LI>
          <OL TYPE="a">
            <LI>View the project in it's XML source format.</LI>
            <LI>View the project in a non-source format.<BR>
            <I>This is left ambiguous to keep the implementation out of the
            requirements. The different presentation formats are likely to evolve
            over time.</I>
            </LI>
            <LI>View the project properties.</LI>
            <LI>View the project contents (tasks).</LI>
          </OL>
          <LI>Modify a project.</LI>
          <OL TYPE="a">
            <LI>Edit via the XML source.</LI> 
            <LI>Edit properties via a property sheet.</LI>
            <LI>Provide facility for editing XML references used in the build
            file.</LI> 
          </OL>
          <LI>Save a project.</LI>
          <OL TYPE="a">
            <LI>Save to the native Ant XML format as defined by the Ant users'
            manual.</LI> 
            <LI>Default save name is "build.xml".</LI>
            <LI>Verify before overwriting existing file when in "Save as"
            mode.</LI> 
          </OL>
          <LI>Create a new project.</LI>
          <OL TYPE="a">
            <LI>Define a project name.</LI>
            <LI>Define the default target.</LI>
            <LI>Define the project base directory.</LI>
          </OL>
        </OL>
        <BR>
  
  
        <LI><H2>Task Editing</H2></LI>
        <P>Tasks define what it is that Ant is to do, and will be the object most
        edited in the UI. <U>Task</U> <I>is to</I> <U>Paragraph</U> <I>as</I>
        <U>Project</U> <I>is to</I> <U>Document</U>.  
        <OL>
          <LI>View tasks.</LI>
          <OL TYPE="a">
            <LI>View a sorted list of tasks.<BR>
            <I>Provide sorting based on name, depth in dependency tree, how many
            tasks depend in it...</I></LI>
            <LI>View tasks as a directed graph.<BR>
            <I>Need a good graph editing library. Looked at <A
            HREF="http://gef.tigris.org">GEF</A> but it still needs a lot of
            work, to make it easily reusable. Long term status unknown.</I></LI>
            <LI>View tasks as a dependency tree.</LI>
            <LI>View task as a properties sheet.</LI>
            <LI>Provide dependency viewing, both immediate and "flattened"
            views.</LI> 
          </OL>        
          <LI>Modify task.</LI>
          <OL TYPE="a">
            <LI>Allow editing of a task via a property sheet.</LI>
            <LI>Allow editing of a task via XML source.</LI>
            <LI>Allow the graphical editing of task dependencies<BR>
            <I>This is where you can go hog wild with the component wiring type of
            UI. </I></LI>
            <LI>Allow non-graphical editing of dependencies.</LI>
            <LI>Provide detection of circular dependencies.</LI>
            <LI>Facilitate definition of conditional tasks with evaluation
            editor.</LI> 
          </OL>
        </OL>
        <BR>
  
        <LI><H2>Build File Source Editing</H2></LI>
        <P>This section listes desired features for editing the Ant build file
        directly. Some components of this could be met by a generic XML editing
        capability, but other parts will be Ant specific features.</P>
        <OL>
          <LI>XML Editor.</LI>
          <OL TYPE="a">
            <LI>Provide syntax higlighting.</LI>
            <LI>Provide auto-indentation.</LI>
            <LI>Provide smart tag completion.</LI>
            <LI>Provide visual highlighting of syntax errors.</LI>
            <LI>Support auto-reparsing of contents and model update.</LI>
          </OL>
      </OL>
    </BODY>
  </HTML>
  
  
  
  1.1                  jakarta-ant/src/antidote/etc/manifest
  
  Index: manifest
  ===================================================================
  Manifest-Version: 1.0
  Main-Class: org.apache.tools.ant.gui.Main
  
  
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/About.java
  
  Index: About.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;
  import org.apache.tools.ant.gui.util.WindowUtils;
  
  import javax.swing.*;
  import java.io.IOException;
  import java.util.*;
  import java.awt.BorderLayout;
  import java.awt.event.ActionListener;
  import java.awt.event.ActionEvent;
  
  /**
   * Dialog displaying information on the application.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class About extends JDialog {
  
  	/** 
  	 * Standard ctor.
  	 * 
  	 * @param context Application context.
  	 */
  	public About(AppContext context) {
  		super(context.getParentFrame(), true);
  		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  
  		String version = null;
  		String date = null;
  		String contributors = null;
  
  		Properties props = new Properties();
  
  		try {
  			props.load(getClass().getResourceAsStream("version.txt"));
  		}
  		catch(IOException ex) {
  			// XXX log me.
  			ex.printStackTrace();
  			return;
  		}
  
  		version = props.getProperty("VERSION", "??");
  		date = props.getProperty("DATE", "??");
  		// XXX eventually this should be tokenized on commas and
  		// presented nicely in box.
  		contributors = props.getProperty("CONTRIBUTORS", "??");
  
  		String message = context.getResources().getMessage(
  			getClass(), "message", 
  			new Object[] { version, date, contributors });
  
  		String title = context.getResources().getString(
  			getClass(), "title");
  		setTitle(title);
  
  		JLabel contents = new JLabel(message);
  		getContentPane().add(BorderLayout.CENTER, contents);
  
  		// Add the OK button.
  		JButton ok = new JButton(
  			context.getResources().getString(getClass(), "ok"));
  		ok.addActionListener(new ActionHandler());
  		JPanel p = new JPanel();
  		p.add(ok);
  		getContentPane().add(BorderLayout.SOUTH, p);
  
  		// Just go ahead and show it...
  		pack();
  		WindowUtils.centerWindow(context.getParentFrame(), this);
  		setVisible(true);
  	}
  
  	/** Handles press of the OK button. */
  	private class ActionHandler implements ActionListener {
  		public void actionPerformed(ActionEvent e) {
  			WindowUtils.sendCloseEvent(About.this);
  		}
  	}
  
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/ActionManager.java
  
  Index: ActionManager.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;
  
  import org.apache.tools.ant.gui.event.*;
  import javax.swing.*;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.util.*;
  import java.net.URL;
  
  /**
   * Manager of antidote actions. Receives its configuration from the action
   * ResourceBundle.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class ActionManager {
      private  ResourceBundle _resources = 
          ResourceBundle.getBundle(
              "org.apache.tools.ant.gui.resources.action");
  
      /** Array of action identifiers. */
      private String[] _actionIDs = null;
  
      /** Look table of all defined actions. */
      private Map _actions = new HashMap();
  
      /** Event bus. */
      private EventBus _bus = null;
  
  	/** 
  	 * Standard ctor.
  	 * 
  	 * @param bus Event bus to post events to.
  	 */
      public ActionManager(EventBus bus) {
          _bus = bus;
  
          // Configure the set of actions.
          String toTok = _resources.getString("actions");
          StringTokenizer tok = new StringTokenizer(toTok, ", ");
          _actionIDs = new String[tok.countTokens()];
          for(int i = 0; i < _actionIDs.length; i++) {
              _actionIDs[i] = tok.nextToken();
              _actions.put(_actionIDs[i], new AntAction(_actionIDs[i]));
          }
      }
  
  	/** 
  	 * Create a menubar for the application based on the configuration file.
  	 * 
  	 * @return Menubar.
  	 */
      public JMenuBar createMenuBar() {
          JMenuBar retval = new JMenuBar();
          Map menus = new HashMap();
  
          String toTok = _resources.getString("menus");
          StringTokenizer tok = new StringTokenizer(toTok, ", ");
          while(tok.hasMoreTokens()) {
              String name = tok.nextToken();
              JMenu menu = new JMenu(name);
              retval.add(menu);
              menus.put(name, menu);
          }
  
          for(int i = 0; i < _actionIDs.length; i++) {
              AntAction action = (AntAction) _actions.get(_actionIDs[i]);
              String parent = action.getParentMenuName();
              if(parent != null) {
                  JMenu menu = (JMenu) menus.get(parent);
                  // A well configured file shouldn't cause this,
                  // but be safe anyway.
                  if(menu == null) {
                      menu = new JMenu(parent);
                      retval.add(menu);
                      menus.put(parent, menu);
                  }
  
                  if(action.isPreceededBySeparator()) {
                      menu.addSeparator();
                  }
                  JMenuItem item = menu.add(action);
                  addNiceStuff(item, action);
              }
          }
  
          return retval;
      }
  
  	/** 
  	 * Create a tool bar based on the current configuration.
  	 * 
  	 * @return Toolbar ready for action.
  	 */
      public JToolBar createToolBar() {
          JToolBar retval = new JToolBar();
          
          for(int i = 0; i < _actionIDs.length; i++) {
              AntAction action = (AntAction) _actions.get(_actionIDs[i]);
              // If it has an icon, then we add it to the toolbar.
              if(action.getIcon() != null) {
                  if(action.isPreceededBySeparator()) {
                      retval.addSeparator();
                  }
  
                  JButton button = retval.add(action);
                  button.setText(null);
  
                  addNiceStuff(button, action);
              }
          }
  
          return retval;
      }
  
      private void addNiceStuff(AbstractButton button, AntAction action) {
          // Set the action command so that it is consitent
          // no matter what language the display is in.
          button.setActionCommand(action.getID());
          String tip = action.getShortDescription();
          if(tip != null) {
              button.setToolTipText(tip);
          }
      }
  
  	/** 
  	 * Convenience method for looking put a resource with the name
       * "id.key". Will return null if the resource doesn't exist.
  	 * 
  	 * @param id Action id.
  	 * @param key Key name for the action.
  	 * @return String resource for composite key, or null if not found.
  	 */
      private String getString(String id, String key) {
          String retval = null;
          try {
              retval = _resources.getString(id + "." + key);
          }
          catch(MissingResourceException ex) {
              // Its ok to be missing a resource name...
              // Too bad the API throws an exception in this case. 
          }
          return retval;
      }
  
      /** Class representing an action in the Antidote application. */
      private class AntAction extends AbstractAction {
          /** Property name for the parent menu item. */
          public static final String PARENT_MENU_NAME = "parentMenuName";
          public static final String SEPARATOR = "separator";
  
          /** Unique id. */
          private String _id = null;
  
          /** 
           * Standard ctor.
           * 
           * @param id Unique id for the action
           */
          public AntAction(String id) {
              _id = id;
              putValue(NAME, getString(id, "name"));
              putValue(SHORT_DESCRIPTION, getString(id, "shortDescription"));
              putValue(PARENT_MENU_NAME, getString(id, "parentMenuName"));
              putValue(SEPARATOR, getString(id, "separator"));
  
              String iconName = getString(id, "icon");
              if(iconName != null) {
                  try {
                      URL imageLoc = 
                          AntAction.class.getResource("resources/" + iconName);
                      if(imageLoc != null) {
                          putValue(SMALL_ICON, new ImageIcon(imageLoc));
                      }
                  }
                  catch(Exception ex) {
                      // XXX log me.
                      ex.printStackTrace();
                  }
              }
              
          }
          
          /** 
           * Unique id for the action.
           * 
           * @return Action id.
           */
          public String getID() {
              return _id;
          }
  
          /** 
           * Get the name of the menu in the menu bar that this action shoul
           * appear under.
           * 
           * @return Menu to appear under, or null if not a menu action.
           */
          public String getParentMenuName() {
              return (String) getValue(PARENT_MENU_NAME);
          }
          
          /** 
           * Get the localized name for the action.
           * 
           * @return Name
           */
          public String getName() {
              return (String) getValue(NAME);
          }
          
          /** 
           * Get the short description. Used in tool tips.
           * 
           * @return Short description.
           */
          public String getShortDescription() {
              return (String) getValue(SHORT_DESCRIPTION);
          }
          
          /** 
           * Determine if a separator should appear before the action.
           * 
           * @return True if add separator, false otherwise.
           */
          public boolean isPreceededBySeparator() {
              return Boolean.valueOf(
                  String.valueOf(getValue(SEPARATOR))).booleanValue();
          }
  
          /** 
           * Get the icon.
           * 
           * @return Icon for action, or null if none.
           */
          public Icon getIcon() {
              return (Icon) getValue(SMALL_ICON);
          }
  
          /** 
           * Pass the action on to the EventBus.
           * 
           * @param e Event to forward.
           */
          public void actionPerformed(ActionEvent e) {
              _bus.postEvent(e);
          }
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/AntEditor.java
  
  Index: AntEditor.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;
  
  import javax.swing.JPanel;
  
  /**
   * Abstract base class for an "editor", which is really anything that
   * can send or receive events, or edit or view the model.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public abstract class AntEditor extends JPanel {
  
      /** Parameters to the Contructor. Used for loading
          classes through reflection. */
      public static final Class[] CTOR_PARAMS = { AppContext.class };
  
      /** The application context. */
      private AppContext _context = null;
  
  	/** 
  	 * Standard constuctor.
  	 * 
  	 * @param context Application context.
  	 */
  	protected AntEditor(AppContext context) {
          _context = context;
  	}
  
  	/** 
  	 * Get the application context.
  	 * 
  	 * @return Application context.
  	 */
      public AppContext getAppContext() {
          return _context;
      }
  	/** 
  	 * Get the name of the editor.
  	 * 
  	 * @return Editor's name.
  	 */
      public String getName() {
          return _context.getResources().getString(getClass(), "name");
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/Antidote.java
  
  Index: Antidote.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;
  
  import javax.swing.*;
  import java.awt.BorderLayout;
  import java.awt.Dimension;
  import java.lang.reflect.Constructor;
  
  /**
   * The root class for the Ant GUI. Assembles all the graphical components
   * based on the configuration files.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class Antidote extends JPanel {
  
  
      /** Logging console. */
      private Console _console = null;
  
      /** Source of application state data. */
      private AppContext _context = null;
  
  	/** 
  	 * Default ctor.
  	 * 
  	 */
      public Antidote(AppContext context) {
          setLayout(new BorderLayout());
  
          _context = context;
  
          _console = new Console(_context);
  
  
          // Add the various editors/views to the editing area.
          JSplitPane splitter = new JSplitPane();
          splitter.add(JSplitPane.LEFT, populateEditors("left"));
          splitter.add(JSplitPane.RIGHT, populateEditors("right"));
  
          add(BorderLayout.CENTER, splitter);
  
          add(BorderLayout.SOUTH, _console);
  
          setPreferredSize(new Dimension(640, 480));
      }
  
  
  	/** 
  	 * Instantiate the configured editors.
  	 * 
       * @return Component containing the editor(s).
  	 */
      private JComponent populateEditors(String prefix) {
  
          String[] classNames = _context.getResources().
              getStringArray(getClass(), prefix + ".editors");
  
          AntEditor[] editors = new AntEditor[classNames.length];
  
          for(int i = 0; i < classNames.length; i++) {
              try {
                  Class editorType = Class.forName(classNames[i]);
  
                  Constructor ctor = 
                      editorType.getConstructor(AntEditor.CTOR_PARAMS);
  
                  editors[i] = 
                      (AntEditor) ctor.newInstance(new Object[] { _context });
              }
              catch(Exception ex) {
                  // XXX log me.
                  ex.printStackTrace();
              }
          }
  
          if(editors.length == 1) {
              return editors[0];
          }
          else if(editors.length > 1) {
              JTabbedPane tabbed = new JTabbedPane(JTabbedPane.BOTTOM);
  
              for(int i = 0; i < editors.length; i++) {
                  tabbed.addTab(editors[i].getName(), editors[i]);
              }
              return tabbed;
          }
          else {
              return new JLabel("I shouldn't be here...");
          }
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/AppContext.java
  
  Index: AppContext.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;
  import org.apache.tools.ant.gui.event.*;
  import java.awt.Frame;
  
  
  /**
   * A container for the state information for the application. Provides
   * a centeralized place to gain access to resources and data.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class AppContext {
      /** Event bus. */
      private EventBus _eventBus = new EventBus();
      /** Application resources. */
      private ResourceManager _resources = new ResourceManager();
      /** Application actions. */
      private ActionManager _actions = new ActionManager(_eventBus);
  
      /** Parent frame used in various operations. XXX what do we do 
       *  in the applet context. */
      private Frame _parentFrame = null;
  
      /** The current data model. */
      private ProjectProxy _project = null;
  
  
      public AppContext(Frame parent) {
          _parentFrame = parent;
      }
  
  	/** 
  	 * Get the localized resources.
  	 * 
  	 * @return Resources.
  	 */
      public ResourceManager getResources() {
          return _resources;
      }
  
  	/** 
  	 * Get the action manager.
  	 * 
  	 * @return Action manager.
  	 */
      public ActionManager getActions() {
          return _actions;
      }
  
  	/** 
  	 * Get the event bus.
  	 * 
  	 * @return EventBus.
  	 */
      public EventBus getEventBus() {
          return _eventBus;
      }
  
  	/** 
  	 * Get the parent frame. XXX may change...
  	 * 
  	 * @return Parent frame.
  	 */
      public Frame getParentFrame() {
          return _parentFrame;
      }
  
  	/** 
  	 * Get the current project.
  	 * 
  	 * @return Current project. NUll if  no active project.
  	 */
      public ProjectProxy getProject() {
          return _project;
      }
  
  	/** 
  	 * Set the current project.
  	 * 
  	 * @param project Next project to operate on. May be null for the "close" 
       * action.
  
  	 */
      public void setProject(ProjectProxy project) {
          if(_project == null || !_project.equals(project)) {
              _project = project;
              getEventBus().postEvent(new NewProjectEvent(this));
          }
      }
  }
  
  
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/Console.java
  
  Index: Console.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;
  
  import javax.swing.*;
  import java.awt.GridLayout;
  import java.awt.Dimension;
  
  /**
   * Logging console display.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class Console extends JPanel {
      private AppContext _context = null;
      private JTextPane _text = null;
  
      public Console(AppContext context) {
          setLayout(new GridLayout(1,1));
          _context = context;
  
          _text = new JTextPane();
          _text.setEditable(false);
          JScrollPane scroller = new JScrollPane(_text);
          
          add(scroller);
  
          _text.setText(
              "This is the console area. \nLots of stuff to see here...");
          setPreferredSize(new Dimension(200, 40));
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/EventResponder.java
  
  Index: EventResponder.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;
  
  import org.apache.tools.ant.gui.event.*;
  import org.apache.tools.ant.gui.command.*;
  import java.util.EventObject;
  import java.awt.event.ActionEvent;
  import javax.swing.JFrame;
  
  /**
   * The purpose of this class is to watch for events that require some sort
   * of action, like opening a file.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  class EventResponder {
  
      /** The application context. */
      private AppContext _context = null;
  
  	/** 
  	 * Standard constructor. 
  	 * 
  	 * @param context Application context.
  	 */
      public EventResponder(AppContext context) {
          _context = context;
  
          // XXX This needs to be changed, along with the event bus,
          // to allow the EventResponder to be the last listener
          // to receive the event. This will allow the addition
          // of event filters to yank an event out of the bus, sort of 
          // like an interrupt level.
          _context.getEventBus().addMember(
  			EventBus.RESPONDING, new ActionResponder());
          _context.getEventBus().addMember(
  			EventBus.RESPONDING, new AntResponder());
      }
  
      /** Handler for bus events. */
      private class ActionResponder implements BusMember {
          private final ActionFilter _filter = new ActionFilter();
  
          /** 
           * Get the filter to that is used to determine if an event should
           * to to the member.
           * 
           * @return Filter to use.
           */
          public BusFilter getBusFilter() {
              return _filter;
          }
          
          /** 
           * Called when an event is to be posed to the member.
           * 
           * @param event Event to post.
           */
          public void 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();
              }
              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 {
  				// XXX log me.
                  System.err.println("Unhandled action: " + command);
              }
          }
      }
  
      /** Filter for action events. */
      private static class ActionFilter implements BusFilter {
          public boolean accept(EventObject event) {
              return event instanceof ActionEvent;
          }
      }
  
      /** Handler for bus events. */
      private class AntResponder implements BusMember {
          private final AntFilter _filter = new AntFilter();
  
          /** 
           * Get the filter to that is used to determine if an event should
           * to to the member.
           * 
           * @return Filter to use.
           */
          public BusFilter getBusFilter() {
              return _filter;
          }
          
          /** 
           * Called when an event is to be posed to the member.
           * 
           * @param event Event to post.
           */
          public void eventPosted(EventObject event) {
              AntEvent e = (AntEvent) event;
              Command cmd = e.createDefaultCmd();
              cmd.execute();
          }
      }
  
      /** Filter for ant events. */
      private static class AntFilter implements BusFilter {
          public boolean accept(EventObject event) {
              return event instanceof AntEvent;
          }
      }
  
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/Main.java
  
  Index: Main.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;
  
  import javax.swing.*;
  import java.awt.BorderLayout;
  
  /**
   * Launch point for the Antidote GUI. Configurs it as an application.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class Main {
  	/** 
  	 * Application start.
  	 * 
  	 * @param args TBD
  	 */
      public static void main(String[] args) {
          XMLHelper.init();
          try {
              JFrame f = new JFrame("Antidote");
              AppContext context = new AppContext(f);
              EventResponder resp = new EventResponder(context);
              Antidote gui = new Antidote(context);
  
              f.setDefaultCloseOperation(3 /*JFrame.EXIT_ON_CLOSE*/);
              f.setJMenuBar(context.getActions().createMenuBar());
              f.getContentPane().add(BorderLayout.CENTER, gui);
              f.getContentPane().add(BorderLayout.NORTH, 
                                     context.getActions().createToolBar());
  
              f.pack();
              f.setVisible(true);
              // Hack around linux window placement annoyance.
              f.setLocation(100, 100);
  
          }
          catch(Exception ex) {
              ex.printStackTrace();
          }
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/ProjectDocument.java
  
  Index: ProjectDocument.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;
  import org.apache.tools.ant.Project;
  import javax.swing.text.DefaultStyledDocument;
  import java.io.*;
  
  /**
   * Provides a Document view on the Project XML source.
   * NB: This class currently looks nothing like it should.
   * Rather than just rendering a copy of the build file contents,
   * this class should implement a true document model, representing
   * the true XML sturcture of the build file. This is just a temporary 
   * implementation. 
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class ProjectDocument extends DefaultStyledDocument {
  
      // This is what the real constructor needs to look like...
      //public ProjectDocument(Project project) {
      //}
  
      public ProjectDocument(File f) {
          // XXX stubbed method. will go away.
          try {
              // XXX hack hack hack....
              Reader reader = new BufferedReader(new FileReader(f));
  			char[] buf = new char[1024];
  			int num = 0;
              while((num = reader.read(buf)) >= 0) {
                  insertString(getLength(), new String(buf, 0, num), null);
              }
  
          }
          catch(Exception ex) {
  			// XXX log me.
              ex.printStackTrace();
          }
      }
  
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/ProjectNavigator.java
  
  Index: ProjectNavigator.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;
  import org.apache.tools.ant.gui.event.*;
  import javax.swing.*;
  import java.awt.GridLayout;
  import java.awt.Dimension;
  import java.util.EventObject;
  
  /**
   * AntEditor for displaying the project target in a 
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  class ProjectNavigator extends AntEditor {
  
      /** Navigation via a tree widget. */
      private JTree _tree = null;
  
  	/** 
  	 * Standard ctor.
  	 * 
  	 * @param context Application context.
  	 */
  	public ProjectNavigator(AppContext context) {
          super(context);
          context.getEventBus().addMember(EventBus.MONITORING, new Handler());
  
          setLayout(new GridLayout(1,1));
  
          _tree = new JTree();
          _tree.setModel(null);
          JScrollPane scroller = new JScrollPane(_tree);
          add(scroller);
  
          setPreferredSize(new Dimension(100, 100));
  
  	}
  
      /** Class for handling project events. */
      private class Handler implements BusMember {
          private final Filter _filter = new Filter();
  
          /** 
           * Get the filter to that is used to determine if an event should
           * to to the member.
           * 
           * @return Filter to use.
           */
          public BusFilter getBusFilter() {
              return _filter;
          }
          
          /** 
           * Called when an event is to be posed to the member.
           * 
           * @param event Event to post.
           */
          public void eventPosted(EventObject event) {
              ProjectProxy project = getAppContext().getProject();
  
              if(project == null) {
                  // The project has been closed.
                  // XXX this needs to be tested against 
                  // different version of Swing...
                  _tree.setModel(null);
              }
              else {
                  _tree.setModel(project.getTreeModel());
              }
          }
      }
  
      /** Class providing filtering for project events. */
      private static class Filter implements BusFilter {
          /** 
           * Determines if the given event should be accepted.
           * 
           * @param event Event to test.
           * @return True if event should be given to BusMember, false otherwise.
           */
          public boolean accept(EventObject event) {
              return event instanceof NewProjectEvent;
          }
      }
  
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/ProjectProxy.java
  
  Index: ProjectProxy.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;
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.ProjectHelper;
  import java.io.File;
  import java.io.IOException;
  import javax.swing.tree.TreeModel;
  import javax.swing.text.Document;
  
  /**
   * This class provides the gateway interface to the data model for
   * the application. The translation between the Ant datamodel, 
   * (or other external datamodel) occurs. This class also provides various
   * views into the data model, such as TreeModel, Documenet, etc.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class ProjectProxy {
  
      /** The file where the project was last saved. */
      private File _file = null;
  
      /** The real Ant Project instance. */
      private Project _project = null;
  
  	/** 
  	 * Default constructor. NB: right now it is private, but
       * will be opened up once the gui supports creating new projects.
  	 * 
  	 */
      private ProjectProxy() {
      }
  
  	/** 
  	 * File loading ctor.
  	 * 
  	 * @param file File containing build file to load.
  	 */
      public ProjectProxy(File file) throws IOException {
          this();
          _file = file;
          loadProject();
      }
  
  
      private void loadProject() throws IOException {
          _project = new Project();
          _project.init();
  
          // XXX there is a bunch of stuff in the class org.apache.tools.ant.Main
          // that needs to be abstracted out so that it doesn't 
          // have to be replicated here.
          
          // XXX need to provide a way to pass in externally defined properties.
          // Perhaps define an external Antidote properties file.
          _project.setUserProperty("ant.file" , _file.getAbsolutePath());
          ProjectHelper.configureProject(_project, _file);
      }
  
  	/** 
  	 * Get the file where the project is saved to. If the project
       * is a new one that has never been saved the this will return null.
  	 * 
  	 * @return Project file, or null if not save yet.
  	 */
      public File getFile() {
          return _file;
      }
  
  	/** 
  	 * Get the TreeModel perspective on the data.
  	 * 
  	 * @return TreeModel view on project.
  	 */
      public TreeModel getTreeModel() {
          if(_project != null) {
              return new ProjectTreeModel(_project);
          }
          return null;
      }
  
  	/** 
  	 * Get the Document perspective on the data.
  	 * 
  	 * @return Document view on project.
  	 */
      public Document getDocument() {
          if(_project != null) {
              // This is what the call should look like
              //return new ProjectDocument(_project);
  
              return new ProjectDocument(_file);
          }
          return null;
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/ProjectTreeModel.java
  
  Index: ProjectTreeModel.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;
  
  
  import javax.swing.tree.TreeModel;
  import javax.swing.tree.TreePath;
  import javax.swing.event.TreeModelListener;
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.Target;
  import java.util.*;
  
  
  /**
   * Provides a tree model view of the Project class.
   *
   * @version $Revision: 1.1 $ 
   * @author Simeon H.K. Fitch 
   */
  public class ProjectTreeModel implements TreeModel {
  
      private Project _project = null;
      private ProjectWrapper _wrapper = null;
  
      // XXX temp doesn't handle dynamic updates.
      /** Defines an ordering for the tasks. */
      private List _targetOrdering = new ArrayList();
  
      public ProjectTreeModel(Project project) {
          _project = project;
          _wrapper = new ProjectWrapper();
          Enumeration enum = _project.getTargets().keys();
          while(enum.hasMoreElements()) {
              _targetOrdering.add(enum.nextElement());
          }
      }
  
      /**
       * Returns the root of the tree.  Returns null only if the tree has
       * no nodes.
       *
       * @return  the root of the tree
       */
      public Object getRoot() {
          return _wrapper;
      }
  
  
      /**
       * Returns the child of <I>parent</I> at index <I>index</I> in the parent's
       * child array.  <I>parent</I> must be a node previously obtained from
       * this data source. This should not return null if <i>index</i>
       * is a valid index for <i>parent</i> (that is <i>index</i> >= 0 &&
       * <i>index</i> < getChildCount(<i>parent</i>)).
       *
       * @param   parent  a node in the tree, obtained from this data source
       * @return  the child of <I>parent</I> at index <I>index</I>
       */
      public Object getChild(Object parent, int index) {
          if(parent != _wrapper) return null;
          
          Object name = _targetOrdering.get(index);
          return _project.getTargets().get(name);
      }
  
  
      /**
       * Returns the number of children of <I>parent</I>.  Returns 0 if the node
       * is a leaf or if it has no children.  <I>parent</I> must be a node
       * previously obtained from this data source.
       *
       * @param   parent  a node in the tree, obtained from this data source
       * @return  the number of children of the node <I>parent</I>
       */
      public int getChildCount(Object parent) {
          return parent == _wrapper ? _project.getTargets().size() : 0;
      }
  
  
      /**
       * Returns true if <I>node</I> is a leaf.  It is possible for this method
       * to return false even if <I>node</I> has no children.  A directory in a
       * filesystem, for example, may contain no files; the node representing
       * the directory is not a leaf, but it also has no children.
       *
       * @param   node    a node in the tree, obtained from this data source
       * @return  true if <I>node</I> is a leaf
       */
      public boolean isLeaf(Object node) {
          return node != _wrapper;
      }
  
      /**
        * Messaged when the user has altered the value for the item identified
        * by <I>path</I> to <I>newValue</I>.  If <I>newValue</I> signifies
        * a truly new value the model should post a treeNodesChanged
        * event.
        *
        * @param path path to the node that the user has altered.
        * @param newValue the new value from the TreeCellEditor.
        */
      public void valueForPathChanged(TreePath path, Object newValue) {
          System.out.println(path);
      }
  
      /**
       * Returns the index of child in parent.
       */
      public int getIndexOfChild(Object parent, Object child) {
          return parent == _project ? 
              _targetOrdering.indexOf(((Target)child).getName()) : -1;
      }
  
  
      /**
       * Adds a listener for the TreeModelEvent posted after the tree changes.
       *
       * @see     #removeTreeModelListener
       * @param   l       the listener to add
       */
      public void addTreeModelListener(TreeModelListener l) {
  
      }
  
      /**
       * Removes a listener previously added with <B>addTreeModelListener()</B>.
       *
       * @see     #addTreeModelListener
       * @param   l       the listener to remove
       */  
      public void removeTreeModelListener(TreeModelListener l) {
  
      }
  
  	/** 
  	 * A wrapper around the Project class to provide different
       * toString behavior. XXX this is temporary until a custom
       * cell renderer is created.
  	 * 
  	 */
      private class ProjectWrapper {
          public String toString() {
              return _project.getName();
          }
      }
  
  
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/PropertyEditor.java
  
  Index: PropertyEditor.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;
  import javax.swing.*;
  
  /**
   * Stub for a property editor.
   *
   * @version $Revision: 1.1 $ 
   * @author Simeon H.K. Fitch 
   */
  class PropertyEditor extends AntEditor {
  
  	public PropertyEditor(AppContext context) {
          super(context);
  		add(new JLabel(getName()));
  	}
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/ResourceManager.java
  
  Index: ResourceManager.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;
  
  import java.util.*;
  import java.text.MessageFormat;
  
  /**
   * Singleton class for accessing various resources by the application.
   * Relies on the resource bundles for resource values.
   *
   * @version $Revision: 1.1 $ 
   * @author Simeon H.K. Fitch 
   */
  public class ResourceManager {
      private ResourceBundle _resources = 
          ResourceBundle.getBundle(
              "org.apache.tools.ant.gui.resources.antidote");
  
  	/** 
  	 * Get a string resource for the given class.
  	 * 
  	 * @param clazz Class to get resource for.
  	 * @param name Name of the string resource.
  	 * @return String resource for the given class.
  	 */
      public String getString(Class clazz, String name) {
          if(clazz == null || name == null) {
              return null;
          }
  
          return _resources.getString(getKey(clazz, name));
      }
  
  	/** 
  	 * Get an array of string resources for the given class.
  	 * 
  	 * @param clazz Class to get resource for.
  	 * @param name Name of the string resource.
  	 * @return Array of string resources for the given class.
  	 */
      public String[] getStringArray(Class clazz, String name) {
          if(clazz == null || name == null) {
              return null;
          }
  
          String key = getKey(clazz, name);
  
          String toTok = null;
          try {
              toTok = _resources.getString(key);
          }
          catch(MissingResourceException ex) {
              // Ignore as we are doing a cascading lookup.
          }
  
          if(toTok == null) {
              return _resources.getStringArray(key);
          }
          else {
              StringTokenizer tok = new StringTokenizer(toTok, ", ");
              String[] retval = new String[tok.countTokens()];
              for(int i = 0; i < retval.length; i++) {
                  retval[i] = tok.nextToken();
              }
              return retval;
          }
      }
  
  	/** 
  	 * Generate a composit key from the given class and key name.
  	 * 
  	 * @param clazz Class to find resource for.
  	 * @param name Name of the resource.
  	 * @return Composite key.
  	 */
      private String getKey(Class clazz, String name) {
          return clazz.getName() + "." + name;
      }
  
  	/** 
  	 * Generate a localized message using the given set of arguments to 
       * format the message with.
  	 * 
  	 * @param clazz Class to get message resource for.
  	 * @param name 
  	 * @param arguments 
  	 * @return 
  	 */
      public String getMessage(Class clazz, String name, Object[] arguments) {
          String format = getString(clazz, name);
          return MessageFormat.format(format, arguments);
      }
  
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/SourceEditor.java
  
  Index: SourceEditor.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;
  import org.apache.tools.ant.gui.event.*;
  
  import java.util.EventObject;
  import javax.swing.*;
  import javax.swing.text.PlainDocument;
  
  import java.awt.GridLayout;
  import java.awt.Font;
  
  /*
   * AntEditor for the XML source. XXX Stubbed version.
   *
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  class SourceEditor extends AntEditor {
      private JEditorPane _text = null;
  
  	public SourceEditor(AppContext context) {
          super(context);
          context.getEventBus().addMember(EventBus.MONITORING, new Handler());
  
          setLayout(new GridLayout(1,1));
  
          _text = new JEditorPane();
          _text.setEditable(false);
  //		_text.setFont(new Font("Monospaced", 10, Font.PLAIN));
  
          JScrollPane scroller = new JScrollPane(_text);
          add(scroller);
  	}
  
      /** Class for handling project events. */
      private class Handler implements BusMember {
          private final Filter _filter = new Filter();
  
          /** 
           * Get the filter to that is used to determine if an event should
           * to to the member.
           * 
           * @return Filter to use.
           */
          public BusFilter getBusFilter() {
              return _filter;
          }
          
          /** 
           * Called when an event is to be posed to the member.
           * 
           * @param event Event to post.
           */
          public void eventPosted(EventObject event) {
              ProjectProxy project = getAppContext().getProject();
  
              _text.setDocument(project == null ? new PlainDocument() :
                                project.getDocument());
          }
      }
  
      /** Class providing filtering for project events. */
      private static class Filter implements BusFilter {
          /** 
           * Determines if the given event should be accepted.
           * 
           * @param event Event to test.
           * @return True if event should be given to BusMember, false otherwise.
           */
          public boolean accept(EventObject event) {
              return event instanceof NewProjectEvent;
          }
      }
  
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/XMLFileFilter.java
  
  Index: XMLFileFilter.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;
  
  import javax.swing.filechooser.FileFilter;
  import java.io.File;
  
  /**
   * FileFilter for showing only XML files.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class XMLFileFilter extends FileFilter {
  
      /** Text description of filter. */
      private String _description = null;
  
  
  	/** 
  	 * Standard constructor.
  	 * 
  	 * @param resources Access to text resources.
  	 */
      public XMLFileFilter(ResourceManager resources) {
          _description = resources.getString(getClass(), "description");
      }
  
  	/** 
  	 * Accept files that end with ".xml".
  	 * 
  	 * @param f File to test.
  	 * @return True if accepted, false otherwise.
  	 */
      public boolean accept(File f) {
          if(f.isDirectory()) return true;
  
          String name = f.getName().toLowerCase();
          return name.endsWith(".xml");
      }
  
  	/** 
  	 * Human readable description of filter.
  	 * 
  	 * @return Description.
  	 */
      public String getDescription() {
          return _description;
      }
  
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/XMLHelper.java
  
  Index: XMLHelper.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;
  
  /**
   * Placeholder for XML related duties.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class XMLHelper {
      public static void init() {
          try {
              Class.forName("javax.xml.parsers.SAXParserFactory");
          } 
          catch(Exception ex) {
              System.err.println("No JAXP compliant XML parser found. " +
                                 "See http://java.sun.com/xml for the\n" +
                                 "reference implementation.");
              ex.printStackTrace();
          } 
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/version.txt
  
  Index: version.txt
  ===================================================================
  VERSION=@VERSION@
  DATE=@DATE@
  CONTRIBUTORS=Simeon H.K. Fitch, Ant Development Team
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/AboutCmd.java
  
  Index: AboutCmd.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;
  import org.apache.tools.ant.gui.About;
  import java.awt.Window;
  import java.awt.event.WindowEvent;
  
  
  /**
   * Handler for the About command.
   * 
   * @version $Revision: 1.1 $ 
   * @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;
  	/** 
  	 * Standard constructor. 
  	 * 
  	 * @param window 
  	 */
      public AboutCmd(AppContext context) {
          _context = context;
      }
  
  	/** 
  	 * Show the about box.
  	 * 
  	 */
      public void execute() {
  		new About(_context);
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/CloseCmd.java
  
  Index: CloseCmd.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;
  
  
  /**
   * Handler for the close command.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class CloseCmd implements Command {
      /** Name of the exit command. */
      public static final String ACTION_NAME = "close";
  
      /** Application context. */
      private AppContext _context = null;
  
  	/** 
  	 * Standard constructor. 
  	 * 
  	 * @param window 
  	 */
      public CloseCmd(AppContext context) {
          _context = context;
      }
  
  	/** 
  	 * Send a close event to the parent window. 
  	 * 
  	 */
      public void execute() {
          _context.setProject(null);
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/Command.java
  
  Index: Command.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;
  
  /**
   * Interface for commands.  Details TBD
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public interface Command {
      public void execute();
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/DisplayErrorCmd.java
  
  Index: DisplayErrorCmd.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;
  import javax.swing.JOptionPane;
  
  /**
   * Command for displaying an arbitrary error message to the user.
   *
   * @version $Revision: 1.1 $ 
   * @author Simeon H.K. Fitch 
   */
  public class DisplayErrorCmd implements Command {
      /** The application context */
      private AppContext _context = null;
      /** Text description of error. */
      private String _message = null;
      /** Throwable associated with the error. */
      private Throwable _ex = null;
  
  	/** 
  	 * 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;
      }
  
  	/** 
  	 * No Throwable constructor.
  	 * 
  	 * @param context Application context.
  	 * @param message Error message.
  	 */
      public DisplayErrorCmd(AppContext context, String message) {
          this(context, message, null);
      }
  
  	/** 
  	 * Display the error.
  	 * 
  	 */
      public void execute() {
          // XXX change this so that exceptions can be optionally shown.
          String title = _context.getResources().getString(getClass(), "title"); 
  
          JOptionPane.showMessageDialog(
              _context.getParentFrame(), _message, 
              title, JOptionPane.ERROR_MESSAGE);
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/ExitCmd.java
  
  Index: ExitCmd.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;
  import org.apache.tools.ant.gui.util.WindowUtils;
  
  import java.awt.Window;
  import java.awt.event.WindowEvent;
  
  
  /**
   * Handler for an exit command .
   * 
   * @version $Revision: 1.1 $ 
   * @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;
  
  	/** 
  	 * Standard constructor. 
  	 * 
  	 * @param context Application context.
  	 */
      public ExitCmd(AppContext context) {
          _window = context.getParentFrame();
      }
  
  	/** 
  	 * Send a close event to the parent window. 
  	 * 
  	 */
      public void execute() {
          // Manually send a window close event to the window.
  		WindowUtils.sendCloseEvent(_window);
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/LoadFileCmd.java
  
  Index: LoadFileCmd.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;
  import org.apache.tools.ant.gui.ProjectProxy;
  import org.apache.tools.ant.gui.event.ErrorEvent;
  import java.io.File;
  import java.io.IOException;
  
  /**
   * Command for reading in a build file and initializing the data model.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class LoadFileCmd implements Command {
      /** The application context */
      private AppContext _context = null;
      /** 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;
          _file = file;
      }
  
  	/** 
  	 * Open the file and load it.
  	 * 
  	 */
      public void execute() {
          if(!_file.exists()) {
              String message = _context.getResources().getMessage(
                  getClass(), "noFile", new Object[] { _file.toString() });
  
              _context.getEventBus().
                  postEvent(new ErrorEvent(_context, message));
          }
          else {
              try {
                  ProjectProxy project = new ProjectProxy(_file);
                  _context.setProject(project);
              }
              catch(IOException ex) {
                  String message = _context.getResources().getMessage(
                      getClass(), "loadError", 
                      new Object[] { _file.toString() });
  
                  _context.getEventBus().
                      postEvent(new ErrorEvent(_context, message));
              }
          }
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/NoOpCmd.java
  
  Index: NoOpCmd.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;
  
  /**
   * NoOp command.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class NoOpCmd implements Command {
  	/** 
  	 * Successfully do nothing.
  	 * 
  	 */
      public void execute() {}
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/command/OpenCmd.java
  
  Index: OpenCmd.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;
  import org.apache.tools.ant.gui.event.OpenRequestEvent;
  import org.apache.tools.ant.gui.XMLFileFilter;
  import javax.swing.JFileChooser;
  import javax.swing.filechooser.FileFilter;
  import java.io.File;
  
  /**
   * Command to execute the opening of a file. A dialog is presented to the
   * user for selecting a build file to open. If a file is selected then an
   * OpenRequestEvent is posted.
   * 
   * @version $Revision: 1.1 $ 
   * @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 file.s */
      private FileFilter _filter = null;
  
  	/** 
  	 * Standard ctor.
  	 * 
  	 * @param context Application context. 
  	 */
      public OpenCmd(AppContext context) {
          _context = context;
          _filter = new XMLFileFilter(_context.getResources());
      }
  
  	/** 
  	 * Display a dialog asking the user to select a file to open.
       * If one is selected then an event is posted requesting the open 
       * operation be completed.
  	 * 
  	 */
      public void execute() {
          // XXX need to set chooser text based on ResourceManager values.
          JFileChooser chooser = new JFileChooser();
          chooser.addChoosableFileFilter(_filter);
          int val = chooser.showOpenDialog(_context.getParentFrame());
          if(val == JFileChooser.APPROVE_OPTION) {
              File selected = chooser.getSelectedFile();
              _context.getEventBus().postEvent(
                  new OpenRequestEvent(_context, selected));
          }
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/AntEvent.java
  
  Index: AntEvent.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.event;
  import org.apache.tools.ant.gui.command.Command;
  import org.apache.tools.ant.gui.AppContext;
  import java.util.EventObject;
  
  /**
   * Base class for all Ant specific events. Details TBD.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public abstract class AntEvent extends EventObject {
  
  	/** Flag indicating that the event has been cancelled. */
  	private boolean _cancelled = false;
  
  	/** 
  	 * Standard ctor.
  	 * 
  	 * @param context application context.
  	 */
      protected AntEvent(AppContext context) {
          super(context);
      }
  
  	/** 
  	 * Get the application context.
  	 * 
  	 * @return Application context.
  	 */
      protected AppContext getAppContext() {
          return (AppContext) getSource();
      }
  
  	/** 
  	 * Determine if the event has been cancelled.
  	 * 
  	 * @return True if cancelled, false otherwise.
  	 */
  	public boolean isCancelled() {
  		return _cancelled;
  	}
  
  	/** 
  	 * Tag the event as being canceled.
  	 * 
  	 */
  	public void cancel() {
  		_cancelled = true;
  	}
  
  	/** 
  	 * Create the appropriate default response command to this event.
  	 * 
  	 * @return Command representing an appropriate response to this event.
  	 */
      public abstract Command createDefaultCmd();
  
  
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/BusFilter.java
  
  Index: BusFilter.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.event;
  import java.util.EventObject;
  
  
  /**
   * Interace for determining whether an event should be given to a BusMember
   * instance.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public interface BusFilter {
  	/** 
  	 * Determines if the given event should be accepted.
  	 * 
  	 * @param event Event to test.
  	 * @return True if event should be given to BusMember, false otherwise.
  	 */
      public boolean accept(EventObject event);
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/BusMember.java
  
  Index: BusMember.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.event;
  
  import java.util.EventObject;
  
  /**
   * Interface for classes that want to be a member of the EventBus.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public interface BusMember {
  	/** 
  	 * Get the filter to that is used to determine if an event should
       * to to the member.
  	 * 
  	 * @return Filter to use.
  	 */
      public BusFilter getBusFilter();
  
  	/** 
  	 * Called when an event is to be posed to the member.
  	 * 
  	 * @param event Event to post.
  	 */
      public void eventPosted(EventObject event);
  
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/ErrorEvent.java
  
  Index: ErrorEvent.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.event;
  import org.apache.tools.ant.gui.AppContext;
  import org.apache.tools.ant.gui.command.DisplayErrorCmd;
  import org.apache.tools.ant.gui.command.Command;
  import org.apache.tools.ant.gui.util.StackFrame;
  
  
  /**
   * Event fired whenever there is an error of any sort.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class ErrorEvent extends AntEvent {
      /** Text description of error. */
      private String _message = null;
      /** Throwable associated with the error. */
      private Throwable _ex = null;
  
  	/** 
  	 * Standard constructor.
  	 * 
  	 * @param context Application context.
  	 * @param message Message about the error.
  	 * @param ex Throwable associated with the error.
  	 */
      public ErrorEvent(AppContext context, String message, Throwable ex) {
          super(context);
          _message = message;
          _ex = ex;
      }
  
  	/** 
  	 * Message centric constructor.
  	 * 
  	 * @param context Application context.
  	 * @param message Message to display.
  	 */
      public ErrorEvent(AppContext context, String message) { 
          this(context, message, null);
      }
  
  	/** 
  	 * Throwable centric constructor.
  	 * 
  	 * @param context Application context.
  	 * @param ex Throwable behind the error.
  	 */
      public ErrorEvent(AppContext context, Throwable ex) {
          this(context, ex.getMessage(), ex);
      }
  
  	/** 
  	 * Create the appropriate response command to this event.
  	 * 
  	 * @return Command representing an appropriate response to this event.
  	 */
      public Command createDefaultCmd() {
          return new DisplayErrorCmd(getAppContext(), _message, _ex);
      }
  
  	/** 
  	 * Create human readable version of this.
  	 * 
  	 * @return String representation.a
  	 */
      public String toString() {
          StringBuffer buf = new StringBuffer("Error: ");
  
          if(_message != null) {
              buf.append(_message);
              buf.append('\n');
          }
          if(_ex != null) {
              buf.append(StackFrame.toString(_ex));
          }
          return buf.toString();
      }
  
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/EventBus.java
  
  Index: EventBus.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.event;
  
  import java.util.*;
  
  /**
   * An event "bus" providing a centralized place for posting
   * and recieving generic application events. To receive events a class must 
   * implement the "BusMember" interface. When registering as a member, an
   * "interrupt level" is provided, which specifies a relative ordering level
   * that the member wishes to receive events for. By convention, a member
   * can be registered at the MONITORING, VETOING, or RESPONDING levels, which
   * correspond to recieving events first to receiving events last. If a member
   * receives an event, the event is of type AntEvent, and the member calls the 
   * AntEvent.cancel() method, the event is not then delivered
   * to subsequent members. Members also indicate interest in an event
   * by providing an instance of the BusFilter interface.<BR>
   *
   * NB: This class is overly simple right now, but will eventually
   * be expanded to do better event filtering, interrupt levels, etc. 
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
  */
  public class EventBus {
  	/** The default "monitoring" interrupt level, used by members who
  	 * are only listeners/monitors of events. */
  	public static final int MONITORING = 1;
  	/** The default "vetoing" interrupt level, used by bus members
  	 *  whose role is to veto request events or otherwise handle an
  	 *  event before it is processed by the default handler. */
  	public static final int VETOING = 5;
  	/** The default "responding" interrupt level, for members who service
  	 *  events in a default manner. */
  	public static final int RESPONDING = 10;
  
  	/** The maximum valid interrupt value. */
  	public static final int MAX_INTERRUPT = 15;
  
      /** Set of bus members, with a list for each interrupt level. */
      private List[] _memberSet = new List[MAX_INTERRUPT];
  
  	/** 
  	 * Default ctor.
  	 * 
  	 */
      public EventBus() {
      }
  
  	/** 
  	 * Add a member to the bus. 
  	 * 
  	 * @param intLevel Interrupt level.
  	 * @param member Member to add.
  	 */
      public void addMember(int intLevel, BusMember member) {
  		if(intLevel < 1 || intLevel > MAX_INTERRUPT) {
  			throw new IllegalArgumentException(
  				"Invalid interrupt level: " + intLevel);
  		}
          synchronized(_memberSet) {
  			List list = _memberSet[intLevel - 1];
  			if(list == null) {
  				list = new LinkedList();
  				_memberSet[intLevel - 1] = list;
  			}
              list.add(member);
          }
      }
  
  
  	/** 
  	 * Remove a member from the bus.
  	 * 
  	 * @param member Member to remove.
  	 */
      public void removeMember(BusMember member) {
          synchronized(_memberSet) {
  			// XXX lets hope we don't do too much removing. Yuck...
  			for(int i = 0; i < _memberSet.length; i++) {
  				if(_memberSet[i] == null) continue;
  				_memberSet[i].remove(member);
  			}
          }
      }
  
  	/** 
  	 * Method used for sending an event to the bus.
  	 * 
  	 * @param event Event to post.
  	 */
      public void postEvent(EventObject event) {
          synchronized(_memberSet) {
              // XXX need to insert code here to test whether we are being
              // executed by the AWTEventQueue, or some other thread. If 
              // the latter, then we need to insert our execution on the 
              // AWTEventQueue thread as all code executing commands assumes 
              // that context.
  
  			for(int i = 0; i < _memberSet.length; i++) {
  				if(_memberSet[i] == null) continue;
  
  				Iterator it = _memberSet[i].iterator();
  				while(it.hasNext()) {
  					BusMember next = (BusMember) it.next();
  					BusFilter filter = next.getBusFilter();
  					if(filter == null || filter.accept(event)) {
  						next.eventPosted(event);
  					}
  					// Check to see if the member cancelled the event. If so
  					// then don't send it on to the other members.
  					if(event instanceof AntEvent &&
  					   ((AntEvent)event).isCancelled()) break;
  				}
  			}
          }
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/NewProjectEvent.java
  
  Index: NewProjectEvent.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.event;
  import org.apache.tools.ant.gui.command.Command;
  import org.apache.tools.ant.gui.command.NoOpCmd;
  import org.apache.tools.ant.gui.AppContext;
  
  /**
   * Event providing notification of a change in the current project.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class NewProjectEvent extends AntEvent {
  
  	/** 
  	 * Standard ctor.
  	 * 
  	 * @param context application context.
  	 */
      public NewProjectEvent(AppContext context) {
          super(context);
      }
  
  	/** 
  	 * Create the appropriate default response command to this event.
  	 * 
  	 * @return Command representing an appropriate response to this event.
  	 */
      public Command createDefaultCmd() {
          return new NoOpCmd();
      }
  }
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/event/OpenRequestEvent.java
  
  Index: OpenRequestEvent.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.event;
  import org.apache.tools.ant.gui.AppContext;
  import org.apache.tools.ant.gui.command.Command;
  import org.apache.tools.ant.gui.command.LoadFileCmd;
  
  import java.io.File;
  /**
   * Event for requesting that the given file be opened.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class OpenRequestEvent extends AntEvent {
      /** The file to open. */
      private File _file = null;
  
  	/** 
  	 * Standard ctor.
  	 * 
  	 * @param context Application context.
  	 * @param file File to be opened.
  	 */
      public OpenRequestEvent(AppContext context, File file) {
          super(context);
          _file = file;
      }
  
  	/** 
  	 * Create the appropriate response command to this event, which is to
       * load in a build file.
  	 * 
  	 * @return Load command.
  	 */
      public Command createDefaultCmd() {
          return new LoadFileCmd(getAppContext(), _file);
      }
  }
  
  
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/resources/action.properties
  
  Index: action.properties
  ===================================================================
  menus=File, Help
  
  actions=open, close, exit, about
  
  new.name=New
  new.shortDescription=Create a new project
  new.parentMenuName=File
  new.icon=new.gif
  
  open.name=Open
  open.shortDescription=Open an existing project
  open.parentMenuName=File
  open.icon=open.gif
  
  save.name=Save
  save.shortDescription=Save the current project
  save.parentMenuName=File
  save.icon=save.gif
  
  close.name=Close
  close.shortDescription=Close the current project
  close.parentMenuName=File
  
  exit.name=Exit
  exit.shortDescription=Quit the application
  exit.parentMenuName=File
  exit.separator=true
  
  about.name=About
  about.shortDescription=About this application
  about.parentMenuName=Help
  about.separator=true;
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/resources/antidote.properties
  
  Index: antidote.properties
  ===================================================================
  # This is the general properties file for the Antidote application.
  
  # Configure the editors that appear on the right of the UI.
  org.apache.tools.ant.gui.Antidote.right.editors=\
  	org.apache.tools.ant.gui.PropertyEditor, \
  	org.apache.tools.ant.gui.SourceEditor
  
  # Configure the editors that appear on the left of the UI.
  org.apache.tools.ant.gui.Antidote.left.editors=\
  	org.apache.tools.ant.gui.ProjectNavigator
  
  # Set specific class properties.
  org.apache.tools.ant.gui.SourceEditor.name=Source
  org.apache.tools.ant.gui.PropertyEditor.name=Properties
  org.apache.tools.ant.gui.ProjectNavigator.name=Task Navigator
  
  org.apache.tools.ant.gui.XMLFileFilter.description=XML Files
  
  org.apache.tools.ant.gui.command.LoadFileCmd.noFile=The file "{0}" was not found.
  org.apache.tools.ant.gui.command.LoadFileCmd.loadError=The file "{0}" could not be loaded.
  org.apache.tools.ant.gui.command.DisplayErrorCmd.title=Error...
  
  org.apache.tools.ant.gui.About.title=About
  org.apache.tools.ant.gui.About.ok=OK
  org.apache.tools.ant.gui.About.message=\
  	<html><h1>Antidote</h1> \
  	<p><b>Version:</b> {0}</p> \
  	<p><b>Date:</b> {1}</p> \
  	<p><b>Contributors:</B> {2}</p> \
  	<hr> \
  	<p>Copyright &copy; 2000 The Apache Software Foundation.</p>
  	<p>All rights reserved.</p> \
  	<hr> \
  	</html>
  
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/resources/new.gif
  
  	<<Binary file>>
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/resources/open.gif
  
  	<<Binary file>>
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/resources/save.gif
  
  	<<Binary file>>
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/util/StackFrame.java
  
  Index: StackFrame.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.util;
  
  import java.io.StringWriter;
  import java.io.PrintWriter;
  import java.util.StringTokenizer;
  
  /*
   * Class for parsing the stack frame information from a Throwable's stack frame
   * dump. Probably only suitable for debugging, as it depends on the specific 
   * output format of the stack dump, which could change with JVM releases.
   *
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch
   */
  public class StackFrame {
  	private String _method = null;
  	private int _line = -1;
  	private String _clazz = null;
  
  	/** 
  	 * Default ctor. Gets the stack frame info for the calling method.
  	 * 
  	 */
  	public StackFrame() {
  		this(1);
  	}
  
      public StackFrame(int frame) {
  		if(frame < 0) {
  			throw new IllegalArgumentException("Frame number must be <= 0");
  		}
  		// Add a stack frame for this method and for 
  		// the fillInStackTrace method.
  		frame += 2;
  
  		Throwable t = new Throwable();
  		t.fillInStackTrace();
  		String text = toString(t);
  
  		// Extract the line that has the stack frame info we want on it.
  		StringTokenizer tok = new StringTokenizer(text, "\n");
  		// Ignore the first line as it just has the exception type on it.
  		tok.nextToken();
  		String hit = null;
  		while(tok.hasMoreTokens() && frame-- >= 0) {
  			hit = tok.nextToken();
  		}
  
  		// This should always pass. '4' is the number of characters to get
  		// to the start of the class name ("\tat ").
  		if(hit != null && hit.length() > 4) {
  			int idx = hit.indexOf('(');
  			if(idx > 4) {
  				String before = hit.substring(4, idx);
  				String after = hit.substring(idx + 1, hit.length() - 1);
  
  				// Extract the method name and class name.
  				idx = before.lastIndexOf('.');
  				if(idx >= 0) {
  					_clazz = before.substring(0, idx);
  					_method = before.substring(
  						idx + 1, before.length());
  				}
  				idx = after.lastIndexOf(':');
  				// Extract the line number. If it fails in any way
  				// then just leave the value at -1 which is a valid value.
  				try {
  					_line = Integer.parseInt(
  						after.substring(idx + 1, after.length()));
  				}
  				catch(Exception ex) {
                      // Ignore.
                  }
  			}
  		}
      }
  
  	/** 
  	 * Utility method for converting a throwable object to a string.
  	 * 
  	 * @param t Throwable to convert.
  	 * @return String representation.
  	 */
  	public static String toString(Throwable t) {
  		StringWriter writer = new StringWriter();
  		t.printStackTrace(new PrintWriter(writer));
  		return writer.toString();
  	}
  
  	/** 
  	 * Get the stack frame class.
  	 * 
  	 * @return 
  	 */
  	public String getClassName() {
  		return _clazz;
  	}
  
  	/** 
  	 * Get the name of the stack frame method 
  	 * 
  	 * @return 
  	 */
  	public String getMethodName() {
  		return _method;
  	}
  
  	/** 
  	 * Get the line number for the frame call.
  	 * 
  	 * @return Line number, or -1 if unknown.
  	 */
  	public int getLineNumber() {
  		return _line;
  	}
  
  	public String toString() {
  		return getClassName() + "." + getMethodName() + "(line " + 
  			(getLineNumber() >= 0 ? 
  			 String.valueOf(getLineNumber()) : "unknown") + ")";
  	}
  
  	/** 
  	 * Test code.
  	 * 
  	 * @param args Ignored.
  	 */
  /*
  	public static void main(String[] args) {
  		//Test class for generating a bunch of stack frames.
  		class Test {
  			public Test() {
  				System.out.println("Main method: " + new StackFrame(2));
  				recurse(20);
  			}
  
  			private void recurse(int val) {
  				if(val == 0) {
  					System.out.println("Recurse method: " + new StackFrame());
  				}
  				else if(val % 2 == 0) {
  					recurse(val - 1);
  				}
  				else {
  					recurse(val - 1);
  				}
  			}
  		}
  
  		new Test();
  	}
  */
  }
  
  
  
  
  
  1.1                  jakarta-ant/src/antidote/org/apache/tools/ant/gui/util/WindowUtils.java
  
  Index: WindowUtils.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.util;
  
  import java.awt.Window;
  import java.awt.Rectangle;
  import java.awt.Dimension;
  import java.awt.event.WindowEvent;
  
  /**
   * Function container for various window operations.
   * 
   * @version $Revision: 1.1 $ 
   * @author Simeon Fitch 
   */
  public class WindowUtils {
  	/** 
  	 * Default ctor.
  	 * 
  	 */
  	private WindowUtils() {}
  
  	/** 
  	 * Send a close event to the given window.
  	 * 
  	 * @param window Window to send close event to.
  	 */
  	public static void sendCloseEvent(Window window) {
          window.dispatchEvent(
              new WindowEvent(window, WindowEvent.WINDOW_CLOSING));
  	}
  
  	/** 
  	 * Center the given child window with repsect to the child window.
  	 * 
  	 * @param parent Window to base centering on.
  	 * @param child Window to center.
  	 */
  	public static void centerWindow(Window parent, Window child) {
  		Rectangle bounds = parent.getBounds();
  		Dimension size = child.getSize();
  		child.setLocation(bounds.x + (bounds.width - size.width)/2,
  						  bounds.y + (bounds.height - size.height)/2);
  	}
  
  }
  
  
  

Mime
View raw message