diff --git a/src/antidote/ChangeLog b/src/antidote/ChangeLog deleted file mode 100644 index b9bf0261c..000000000 --- a/src/antidote/ChangeLog +++ /dev/null @@ -1,153 +0,0 @@ -2000-11-27 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/ActionManager.java: Added ability to - generate popup menus from a list of action IDs. - -2000-11-24 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/Console.java: Added context colorization. - -2000-11-20 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/command/DisplayErrorCmd.java: Added - code to allow display of stack backtrace if needed. - -2000-11-18 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/customizer/PropertiesPropertyEditor.java: - Added proper editing capability. Rows are added and removed - automatically. - - * org/apache/tools/ant/gui/customizer/XXXPropertyEditor.java: - Removed stray event firing upon setting value of property to edit. - -2000-11-16 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/customizer/StringPropertyEditor.java: - Changed underlying widget type to JTextPane so that it would - accomidate multi-line strings property. - - * org/apache/tools/ant/gui/acs/ACSTreeNodeElement.java: Fixed - nasty java.lang.IllegalAccessException bug that I thought was - related to Java 1.3 Blackdown RC1, but wasn't. It was related to - using Jikes, which interprests method resolution differently than - javac, resulting in a call trying to access a private method - implementation of a public interface. - - * org/apache/tools/ant/gui/ResourceManager.java: Added convenience - method for getting resource images for a given class. - - * org/apache/tools/ant/gui/AntAction.java: Added toggle property. - - * org/apache/tools/ant/gui/ActionManager.java: Added ability to - handle toggle actions to menu bar (still need to add support to - tool bar). - - * org/apache/tools/ant/gui/EventResponder.java: Added emacs - notifier command. - - * org/apache/tools/ant/gui/ide/EmacsNotifier.java: Imported. - - * org/apache/tools/ant/gui/ProjectProxy.java: Added code to add - listeners registered with the AppContext to the build. - - * org/apache/tools/ant/gui/AppContext.java: Now allows registering - of build listeners to be added to project at build time. - - * org/apache/tools/ant/gui/Main.java: Added loading of build file - provided on command line. - -2000-11-14 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/Antidote.java: Added top area widget, - which is *not* managed inside a split pane. - - * org/apache/tools/ant/gui/ProjectNavigator.java: Added minimum - size to keep resizing of parent from hiding widget. - - * org/apache/tools/ant/gui/ActionManager.java: Large functionality - addtion for allowing action enabled/disabled state to be defined - in the configuration file. The triggering of state changes is - based on the firing of specific events. - - * org/apache/tools/ant/gui/AntAction.java: Broke out from inner - class of ActionManager to its own self (I'm my own man!). - - * org/apache/tools/ant/gui/command/CloseCmd.java: Added firing of - ProjectClosedEvent so state updates could occur. - - * org/apache/tools/ant/gui/resources/action.properties: Added - enabledOn and disabledOn event specifications. - - * org/apache/tools/ant/gui/Console.java: Improved reporting level - handling (some events weren't getting reported). - -2000-11-10 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/PropertyEditor.java: Added new - DynamicCustomizer class instead of HTML based info. - -2000-11-09 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/ProjectProxy.java: Started rework of - project data model, using elements from the XML parser directly - through the new Ant Construction Set package. - -2000-11-08 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/About.java: Useless tweaking inspired - by procrastination. - -2000-11-05 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/LogLevelEnum.java: Added log level - enumeration for use with combo boxes (drops nicely into default model). - - * org/apache/tools/ant/gui/event/BuildEventType.java: Added - delivering of event to a BuildListener based on enumeration value. - - * org/apache/tools/ant/gui/ProjectProxy.java: Added generation of - BuildEvent on project start and finish, as the project itself - doesn't generate theses events (unfortunately). - - * org/apache/tools/ant/gui/Console.java: Added filtering level, - and clearing of buffer when a new build starts. - - * org/apache/tools/ant/gui/AntEditor.java: Added automatic border - for all subclasses. - -2000-11-04 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/ProjectProxy.java: Added inner class to - execute the build in a separate thread. - - * org/apache/tools/ant/gui/event/EventBus.java: Added check to see - if postEvent() is being called on the AWTEvent thread, and if not, - post the dispatching of the event to that thread. This is needed - as most of the listeners will be bound to GUI components and will - be updating their state (which must occur on the event thread). - - * org/apache/tools/ant/gui/ProjectProxy.java: Added a - BuildListener to forward events to the EventBus. - -2000-11-03 Simeon H.K. Fitch - - * org/apache/tools/ant/gui/Antidote.java: Removed hard-coded - Console class. - - * org/apache/tools/ant/gui/Console.java: Changed to a real - AntEditor class, initialized by the config file. - -2000-11-02 Simeon H.K. Fitch - - * 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 - - * org/apache/tools/ant/gui/Main.java: Added XMLHelper.init() call - - * build.xml: Updated run target to include ant.jar in classpath. - diff --git a/src/antidote/README b/src/antidote/README deleted file mode 100644 index a7597365a..000000000 --- a/src/antidote/README +++ /dev/null @@ -1,68 +0,0 @@ - - A N T I D O T E - - What is it? - ----------- - - Antidote is the Java based GUI interface to the Ant build tool. - - Status - ------ - - Antidote is in the early stages of development. Its usefulnes is limited, and - will not be distributed with the binary versions of Ant until it is deemed - featureful and robust enough for end user use. That being said, it currently - will load an Ant build.xml file, allow you to edit some of the file's - properties, save it, and launch a build starting at any target in the - project. - - The Latest Version - ------------------ - - The latest version is the current CVS version, which may or may not be useful - at any given time. The source code is not being base-lined at any specific - version at this time. - - Documentation - ------------- - - Any documentation that exists for Antidote can be found in the antidote/docs - directory. Documentation is primarily developement based documentation as - Antidote is not yet mature enough for reliable user documentation. - - Building - -------- - - Antidote requres JAXP 1.0.1 from Sun (http://java.sun.com/xml). Some time in - the future it is hoped at any w3c based XML will be usable, but at the - current time the Sun library is needed. The easiest way to install the - jaxp.jar and parsers.jar file that comes with the distribution is to copy - them into your $JAVA_HOME/jre/lib/ext directory. - - There is a build.xml file in the same directory as this file that will work - with Ant 1.2. It is recommended that Ant be built first (from ../..), - followed by this directory. By default, the compiled classes will be written - to ~/built/antidote/classes, but the JAR file and launch scripts are written - to the Ant build directory (~/build/ant). - - Running - ------- - - Antidote requires at least Java 1.2 to run. - - Upon successful building of Ant and Antidote (in that order), go to - ~/build/ant/bin and run "antidote". You will probably have to set the - environment variable "ANT_HOME" to "~/build/ant" in the shell that you launch - antidote from. If desired, you can provide the build file to launch at statup - as the first argument on the command line to "antidote". - - Licensing - --------- - - This software is licensed under the terms you may find in the file - named "LICENSE" provided with this distribution. - - Thanks for using Antidote. - - The Apache Jakarta Project - diff --git a/src/antidote/TODO b/src/antidote/TODO deleted file mode 100644 index 5c5f88758..000000000 --- a/src/antidote/TODO +++ /dev/null @@ -1,69 +0,0 @@ -TODO List: - * Rewrite ACSFactory to use it's own parser rather than the implementation - specific com.sun.xml.tree.SimpleElementFactory class (only available - in JAXP from Sun). - - * Add editors for defining file sets, and other "sets". - - * Write wizzard framework. - - * Implement a build progress reporter. - - * Implement a "Worker Thread" pattern that allows workers to have - their work done in a thread property registered with Antidote, and - provide support to that worker to provide progress updates via - the GUI. Should also provide support for hour-glass cursor - handling, and AWT event blocking until task is completed. This - would be used for things such as loading files or other tasks - that the user must wait for completion. - - * Add menu option to select the compiler to use, which then sets - the "build.compiler" property. Better yet, create a generic menu - building capability that allows the setting of a property from a - list of options. - - * Add ability to put an "all" or "don't care" specifyer on the action - "enableOn" and "disableOn" properties. - - * Add ability to view task dependencies more fully. - - * Add better editors for specific tasks. - - * Add a Progress Monitor for file loading (especially for slow boxen like - mine) . - - * Implement some for of refid hyperlinking functionality. - - * Implement context sensitive menus for the console window, allowing - an error to be selected and invoked in IDE. - - * Write preferences framwork, including persistence support. - - * Provide some sort of class path debugging support. - - * Add "syntax" colorization to the console window {done}, - with a preferences editor for setting up the styles {not-done}. - - * Figure out an approach to gracefully stopping a running build. - - * Add error handler for SAX parser to better report loading errors. - - * Project properties viewer, including the ability to view - dependencies (local and cascading). - - * Acquire or implement a logging facility. - - * Eat more dog food. - -(pending Ant 2.0) - - * Need Ant API access to: - - Tasks within a Target - - The topo sorted task list to get flattened dependencies - - The build setup code to recduce code replication. - - Normalize the Ant data model to represent a more consistent - tree structure, and more bean-like API. - - * Better define the data model architecture, and how it interfaces - with the Ant data model. - diff --git a/src/antidote/bin/antidote b/src/antidote/bin/antidote deleted file mode 100755 index 22e167a80..000000000 --- a/src/antidote/bin/antidote +++ /dev/null @@ -1,48 +0,0 @@ -#! /bin/sh - -if [ -f $HOME/.antrc ] ; then - . $HOME/.antrc -fi - -if [ "$ANT_HOME" = "" ] ; then - # try to find ANT - if [ -d /opt/ant ] ; then - ANT_HOME=/opt/ant - fi - - if [ -d ${HOME}/opt/ant ] ; then - ANT_HOME=${HOME}/opt/ant - fi - - ## resolve links - $0 may be a link to ant's home - PRG=$0 - progname=`basename $0` - - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '.*/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname $PRG`/$link" - fi - done - - ANT_HOME=`dirname "$PRG"`/.. - -fi - -# Allow .antrc to specifiy flags to java cmd -if [ "$JAVACMD" = "" ] ; then - JAVACMD=java -fi - -LOCALCLASSPATH=`echo $ANT_HOME/lib/*.jar | tr ' ' ':'` - -if [ "$CLASSPATH" != "" ] ; then - LOCALCLASSPATH=$CLASSPATH:$LOCALCLASSPATH -fi - - -$JAVACMD -classpath $LOCALCLASSPATH -Dant.home=${ANT_HOME} org.apache.tools.ant.gui.Main $@ - diff --git a/src/antidote/bin/antidote.bat b/src/antidote/bin/antidote.bat deleted file mode 100644 index f7f74c9ef..000000000 --- a/src/antidote/bin/antidote.bat +++ /dev/null @@ -1,48 +0,0 @@ -@echo off - -rem Slurp the command line arguments. This loop allows for an unlimited number of -rem agruments (up to the command line limit, anyway). - -set ANT_CMD_LINE_ARGS= - -:setupArgs -if %1a==a goto doneArgs -set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1 -shift -goto setupArgs - -:doneArgs -rem The doneArgs label is here just to provide a place for the argument list loop -rem to break out to. - -rem find ANT_HOME -if not "%ANT_HOME%"=="" goto checkJava - -rem check for ant in Program Files on system drive -rem if not exist "%SystemDrive%\Program Files\ant" goto checkSystemDrive -rem set ANT_HOME=%SystemDrive%\Program Files\ant -rem goto checkJava - -rem :checkSystemDrive -rem check for ant in root directory of system drive -rem if not exist "%SystemDrive%\ant" goto noAntHome -rem set ANT_HOME=%SystemDrive%\ant -rem goto checkJava - -:noAntHome -echo ANT_HOME is not set and ant could not be located. Please set ANT_HOME. -goto end - -:checkJava -if "%JAVACMD%" == "" set JAVACMD=java - -set LOCALCLASSPATH="%CLASSPATH%" -for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" "%%i" - -%JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" org.apache.tools.ant.gui.Main %ANT_CMD_LINE_ARGS% -goto end - -:end -set LOCALCLASSPATH= -set ANT_CMD_LINE_ARGS= - diff --git a/src/antidote/build.xml b/src/antidote/build.xml deleted file mode 100644 index 52e0671ad..000000000 --- a/src/antidote/build.xml +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/antidote/docs/design-overview.html b/src/antidote/docs/design-overview.html deleted file mode 100644 index 4436afcde..000000000 --- a/src/antidote/docs/design-overview.html +++ /dev/null @@ -1,253 +0,0 @@ - - - - Antidote Design Overview - - - - -

Antidote Design Overview

- -

Version 0.2 (2000/12/18)

- -

Authors: - Simeon H.K. Fitch -

- -

Introduction

- -

The purpose of this document is to communicate the overall - structure and design patters used in Antidote, the GUI for - Ant. This document is a work in progress, as well as a living - document, and it is most likely not be in full synchronization with - the source code. Therefore, if there is any doubt, view the source - ;-)

- -

Overview

- -

The Antidote architecture design aims to provide a high level - of modularity and extensibility. Ideally the components of - Antidote will be able to be assembled in different configurations - to provide the type of application or plug-in desired.

- -

To acheive this modularity, a high level of decoupling is - necessary. The standard UI design approach of providing separation - of view (presentation) from model (data) is applied, leveraging - the built-in Ant data model where possible, as well as the - predifined Swing model interfaces. Furthermore, the architecture - is highly event driven, whereby modules communicate via a shared - communications channel.

- -

To a large extent, the configuration of application modules is - driven by localized configuration files, allowing new modules or - data views to be added, as well as providing multi-language - support.

- -

The diagram below conveys a high altitude view of the - application's structure. As the application grows, new components - will be plugged in to what will be described as the EventBus. - -

-
-Antidote Component Architecture
-
-   +---------------+ +----------------+ +-------------+ +-------------+
-   |               | |                | |             | |             |  
-   | ActionManager | | EventResponder | |  AntModule  | |  AntModule  |
-   |               | |                | |(ProjectNav) | |(SourceEdit) |  
-   +---------------+ +----------------+ +-------------+ +-------------+
-           |                  ^               ^               ^
-           |                  |               |               |
-      ActionEvent         EventObject      AntEvent       AntEvent
-           |                  |               |               |
-           v                  v               v               v
-  /---------------------------------------------------------------------\
- /                                                                       \
-<                                   EventBus                              >
- \                                                                       /
-  \---------------------------------------------------------------------/
-           |                  ^               ^               ^
-           |                  |               |               |
-      EventObject         ChangeEvent      BuildEvent     EventObject
-           |                  |               |               |
-           v                  |               |               v
-   +---------------+ +----------------+ +-------------+ +--------------+
-   |               | |                | |             | |              |  
-   |   Console     | |  ProjectProxy  | |    Ant      | | (Your Module)|
-   |               | |                | |             | |              |  
-   +---------------+ +----------------+ +-------------+ +--------------+
-
-    
- -

Event Bus

- -

The backbone of the application is the EventBus. Any - component of the application can post events to the - EventBus. Components that wish to receive events are - called BusMembers.

- -

The EventBus will dispatch any object of type - java.util.Event, which means that Ant BuildEvent - objects, as well as AWTEvent objects can be posted (if desired). A - new class of events called AntEvent is defined for Antidote - specific events, which have the additional capability of being - cancelled mid-dispatch.

- -

Each BusMember must provide a BusFilter instance, - which is the members' means of telling the bus which - events it is interested in. This allows a BusMember to, - say, only receive AntEvent objects.

- -

When a BusMember registers itself with the - EventBus, it must provide a (so called) interrupt - level which is a integer value defining a relative ordering - for dispatching EventObjects to BusMembers. The - purpose of this is to allow certain BusMember instances - to see an event before others, and in the case of AntEventEventBus class defines the interrupt level constants - VETOING=1, MONITORING=5, and RESPONDING=10 to - help define categories of members. The implied purpose being that: -

    - -
  • VETOING: Listens for certain types of events, and - may process them in a non-default manner to determine if the - event should be cancelled before being dispatched to the - RESPONDING group. - -
  • MONITORING: Just listens for events, like a logger - or status monitor.
  • - -
  • RESPONDING: Process events in a default manner, - knowing that the event has passed any VETOING members.
  • - -
- - Within a specific interrupt level, the order in which members will - receive events is undefied. A BusMember may be registered - at a level that is +/- of one of the defined levels, as long as it - follows the constraint MONITORING <= interruptLevel <= - MAX_INTERRUPT.

- - -

Actions and ActionManager

- -

Extensive use of the javax.swing.Action interface is - made for defining the set of menu and tool bar options that are - available. The configuration file action.properties - exists to define what should appear in the menu and toolbar, how - it is displayed, and the Action command name that is - dispatched when the user invokes that action. A class called - ActionManager exists for not only processing the - configuration file, but also for dispatching invoked action events - to the EventBus, and for controlling the enabled state of - an Action. When a new menu item or toolbar button is - desired, first it is added to the action.properties file, - and then the code to respond to it is added to the - EventResponder (see below). - - -

Commands and EventResponder

- -

At some point in the stages of event processing, an event may - require the data model to be modified, or some other task be - performed. The Command interface is defined to classify - code which performs some task or operation. This is distinct from - an Action, which is a user request for an operation. A - Command class is the encapsulation of the operation - itself.

- -

When an Action generates an ActionEvent, the - event is posted to the EventBus which delivers the event - to all interested BusMembers. It eventually makes it to - the EventResponder instance (registered at the - RESPONDING interrupt level), which is responsible for - translating specific events into Command objects, and - then executing the Command object. For example, when the - user selects the "Open..." menu option, an ActionEvent is - generated by the Swing MenuItem class, which is then - posted to the EventBus by the ActionManager. The - ActionEvent is delivered to the EventResponder, - which converts the ActionEvent into a Command - instance. The EventResponder then calls the method - Command.execute() to invoke the command (which displays a - dialog for selecting a file to open).

- -

When adding new Actions or general tasks to the - application, a Command object should be created to - encapsulate the behavior. This includes most operations which - modify the state of the data model.

- -

The purpose of this encapsulation is to allow the clean - separation of making a request, and servicing a request. Due to - various conditions in the application state, the actualy response - to a request may change, as well as who services it. This - design approach facilitates that.

- -

Data Model and Views

- -

NB: This part of the architecture is not fleshed out very well. There - needs to be a discussion of the degree to which the Antidote development - should be able to impose changes on the Ant data model, and to what level - that model should be mirrored in the Antidote code base. The coupling - between them should be kept low, and at the same time changes to one should - affect the other minimally. Still, features like property change events and - bean introspection (or BeanInfo) may be needed to be added to the Ant data - model. Right now the data model is encapsulated in the package - org.apache.tools.ant.gui.acs (where "acs" stands for "Ant - Construction Set").

- -

Application Context

- -

In order to keep the coupling amoung application modules to a - minimum, a single point of reference is needed for coordination - and data sharing. The class AppContext is the catch-all - class for containing the application state. Most modules and - Command classes require an instance of the - AppContext class. Because all state information in - contained in an AppContext instance, multiple instances - of Antidote can run inside the same JVM as long as each has it's - own AppContext. (Interestingly, two instances of the - Antidote could conceivably share an AppContext instance - through RMI, allowing remote interaction/collaboration.)

- -

Configuration and ResourceManager

- -

Full "i18n" support should be assumed in modern applications, - and all user viewable strings should be defined in a configuration - file. For Antidote this configuraiton file is - antidote.properties, which is located (with other UI - resources) in the subpackage "resources".

- -

To aid in the lookup of text properties, as well as other - resources like icons, a class called ResourceManager is - defined. There are various convenience methods attached to this - class, which will likely grow to make looking up configuration - values as easy as possible.

- -

The organization of configuration properties is based on the - fully qualifed path of the class that requires the property. For - example, the "about" box contains a messages, so it looks for the - property "org.apache.tools.ant.gui.About.message" for the text - message it should display. Therefore, the ResourceManager - method getString() takes a Class instance as - well as a String key. Please see the - ResourceManager documentation for more information. Given - this support, no user visible strings should appear in the source - code itself.

- -

Other Resources

- -

Other information about development on Antidote:

- - -
-

Copyright © 2000 Apache Software Foundation. All - rights Reserved.

- - - diff --git a/src/antidote/docs/gui-ideas.txt b/src/antidote/docs/gui-ideas.txt deleted file mode 100644 index 7d1900594..000000000 --- a/src/antidote/docs/gui-ideas.txt +++ /dev/null @@ -1,335 +0,0 @@ -(NOTE: the following text is a vision for an Ant GUI by Stefan Vaillant - called Anttool. It is included here in the -Antidote docs section as it provides a better vision for what the GUI should be -than the current requirements document, and should be considered an integral -part of the long-term plans for Antidote. Simeon Fitch) - - ------------------------------------------------------------------------ - -******************** -**Anttool Proposal** -******************** - -By: Stefan Vaillant - ------------------------------------------------------------------------ - -Anttool Overview: ------------------ - -With Anttool a user can manage the build process for existing ant build files. -By using the grafical user interface, the user can adjust certain properties to -his environment, start and cancel builds, monitor their progress and call -appropiate programs to fix problems. It is not possible to modify the build -file. Instead, an external XML editor or antidote should be used. - - -For inexperienced users, the tool provides an easy and efficient way to install -open source software: load software to the local system, build it and install -it. The tool can be used without any knowledge of XML or the ant DTD. Instead, -the user just adjusts the relevant properties to his environment and starts the -build. - -For programmers, the tool supports the basic build/test/edit cycle. Given an -existing ant build file, the programmer can use the grafical user interface to -execute individual targets, browse the effects of the build and start editors to -fix problems that occured during the build. - - -I general, anttool is ment for users who see the build file as a black-box: They -are not primarily interested in the internal structure of the build file nor in -modifiying it. Instead, they want to call ant with the appropiate arguments and -want to see, what is the result of the build. - -Therefore, anttool only shows targets and properties that are relevant for these -users. Tasks are not shown at all. - - -Anttool User Interface: ------------------------ - -The user interface of anttool is devided into two panels: The "Control Panel" -shows all loaded build files and their targets. The "Project Panel" shows -details for one project, including the logging information from the last -build(s), the editable properties of an build and relevant files of that build. - -By default, the user interface does not show targets or properties that have no -description or a descriuption starting with a ".". These targets or properties -are called "hidden" in the following text. - - -The Control Panel: ------------------- - -The Control Panel shows a tree with all loaded projects. For each project the -non-hidden targets are shown. (Anttool can be configured to show also hidden -targets, see Configuration below). - -If you move the cursor over a project or target, a description for it will be -shown as a tooltip. - -Two icons are prefixing the name of the project or target: one is visualizing -the state of the project or target, the other is a button to start or cancel the -project or target. The state icon can have the following different colors: - - green if the execution was successfull. - - yellow if an execution is needed because the output files are - out-of-date [not possible with current ant version?] - - red if the execution resulted in errors. - - white (i.e. nothing) if the state is unknown -[Alternative: what about buttons labeled with the target name? - The button is used for start/stopping the build. - No tree required then. ] - - -If you select a node in the tree, the Project Panel (see below) will show -details for the relevant project. - -If you right-click on a node in the tree, a pop-up menu will show the following -commands: - edit: open XML editor at selected element - open: in new window [? is that needed] - - -The Project Panel: ------------------- - -The Project Panel consists of three tabs: - -The "Build Log" tab shows information about the last build(s), the "Properties" -tab shows non-hidden properties and the "Files" tab shows files relevant for the -project. - -The Build Log Tab: - -In this tab you can monitor the build on detail. A tree shows the executed -targets of a build, their tasks and log messages for each task. The start time -is noted after the build name. - -In the pop-up menu, you can choose from the following commands: - edit: open editor for shown file at shown location. - show log level->Error/Warning/Info/Verbose/Debug - (only the items possible are shown, - see configuration.) - -The Properties Tab: - -The properties tab shows all non-hidden properties of the project. (optionally, -also hidden properties can be shown, see Configuratin below.) - -Each Property is shown as follows: - : -where - is name of the property, with "." and "-" replaced by " " - and first letters capatilized. - is a text field to enter a value for the properts. - In some cases, special benas are shown: - Name ends with ".dir" => provide a file chooser to select a directory - Name ends with ".lib" => provide a file chooser to select .jar file - Name is "build.compiler" => provide combo box with possible compilers. - [selecting JDK's seems not well support in ant? - If you have e.g. JDK 1.2.1 and 1.2.2 installed, - how to easily select the compiler version?] - Name ends with ".jdk" => let the user select one of the configures -JDK's - [more general then build.compiler, but supported by ant?] - Name ends with ".file" => provide a file chooser - resets the value to the (default) value that is -contained in the .xml file - -All values entered are save in a file -$HOME/.ant/.property. (See also Configuration.) - -If property values are changed, then ant is called with -main("-Dproperty1=value1 .."). - -[show also (class)pathes as property, use id instead of name? But: is that - required? Why not simply define individual properties for the required - libraries and combine them then to a path. ] - - - -The File Set Tab: - -This tab show files that are releated to the project. For each non-hidden -fileset of the project, the id of the fileset is shown and all files included to -that fileset. - -If you right-click on a file, a pop-up menu is shown with which you can start -programs to deal with these files. The relevant configuration information is -extracted from the existing operation system settings. - -[or: one tab for each fileset?] - -Repository: ------------ - -[This needs some more work.] - -Anttool also simplyfies the loading of source files form the web. By using the -repository mechanism of anttool, you can perform the complete workflow from -download to install with just a few mouse clicks: - - select one out of the Repositories from the main menu. - Anttool will query the server for a list of up-to-date - packages. - - select one of the presented packages - Anttool will then download the selected package: - In case a .zip (or similar) package was selected, - the file is downloaded and - unpacked to "/Users/". - In case a CVS repository was selected, - the files are downloaded to "/Users/". - - Afterwards - a file with the name "build.xml" is searched - and loaded to anttool. - Optionally, the file "$HOME/.ant/default.properties" - is copied to "$HOME/.ant/.properties, - overwriting the defaults in the downloaded build file - with your preferences (e.g. installation directory, JDK, ...) - [copy only relevant properties?] - - check if the properties in the selected project match your intention. - - press "start" on the project - - -Anttool Configuration: ------------------------ - -The menu "Tools" in the menu bar allows you to adjust Anttool behavior to your -preferences and environment. - -The following menu entries are available: - -Configure JDKs: - Can be used to configure the JDKs available - on your system. The configured values are offered - for properties that end with ".jdk". - - The screen offers a table to edit a set of names - and pathes. - By pressing "rescan" the system is scanned for new JDKs - by consulting the installed software. - - [Should there be one combo box - Anttool JDK: - that indicates the JDK that should be used to run ant? - Should that be even project specific setting? - ] - -Configure Repository: [better name?] - Anttool is aware of certain places where Anttool supporting software - can be found on the internet. - These URLs can be configured here. - These repositories are offered to the user when he selects - the "Repository" menu in the menu bar. - - The screen offers a table to edit a set of names - and URLs. - -Configure Libraries: - Can be used to configure the libraries available - on your system. The configured values are offered - for properties that end with ".lib". - - The screen offers a table to edit a set of names - and pathes. - By pressing "rescan" the system is scanned for new libraries - by searching below a directory. - - -Preferences: - show hidden targets: bool - [or: offer addition menu to start hidden targets?] - show hidden filesets: bool - show hidden properties: bool - - log level used for build: ... - number of log files saved: - number of log files shown in UI: - - Directory to save property values: - - file name remembered in file menu: - - checkig for new files in filesets: [seconds] - autoload new buildfile: [seconds, 0= never] - - -General features: ------------------ -The menubar menu's are - File - Open... - Close - ------- - 1 buildfile.xml - 2 .... - 3 ... - ------ - Exit - Repository - Apache... as configured - ... - .... - Options - Configure JDKs... - Configure Repository... - Configure Libraries... - Preferences... - Look&Feel... - Help - Antool Help... - Ant Web Home calls netscape - ----------- - About... - - -Build files can be dragged and dropped into anttool. - -The set off loaded build files should be saved on exit and -reloaded on restart automatically. - - - -Technical questions on the internals of anttool ------------------------------------------------ -- How to detect if a target needs to be run (yellow color)? - Seems not be possible currently. - One solution [what will ant 2.0 contain?]: - Define new abstract class "MonitoredTask", inherited from Task. - Copy, Javac, javadoc, etc inherit from these. - MonitoredTask defines: - execute() { prepareTask(); if (executionNeeded) { perform() }; } - executionNeeded: boolean // signals that I need to run because output is -older than input - perform() - performMap() // what will happen with each file, i.e. - Main.java -> Main.class - UI.java -> UI.class - ... - or - Main.class -> lib.jar - UI.class -> lib.jar - size of Map should be equal to number of steps reported in loggin. - - Only "executionNeeded" is required to add a yellow flag for targets. The - performMap would be nice to have. It could be used later to show a finegrained - graph (or matrix) about what is happening during a build. - - Add configuration item on how often call the funtions (i.e. how often to do - the polling.) - -- How to do the calling of the external tools? - XML editor? (how to generate the dtd? How to execute "antstructure" - withour changing the build file.) - How to simulate the windows functionality for e.g. open java source with - JBuilder? - How to read the registry information? - How to do DDE calls? - -- is there any free installation tool for java? - (to install anttool itself) diff --git a/src/antidote/docs/gui-requirements.html b/src/antidote/docs/gui-requirements.html deleted file mode 100644 index 079684a66..000000000 --- a/src/antidote/docs/gui-requirements.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - Ant GUI Feature List - - -

Ant GUI Feature List

-

Version 0.4 (2000/11/06)

-

Authors: - Simeon H.K. Fitch, - Chris Todd, - Clint Combs, - Conor MacNeill, - Matthew Kuperus Heun, - James Duncan Davidson - - -

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). :-)

- -

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.

- -

The features are in a loose order of expressed interested by - contributors.

- - -
    - - -
  1. Build Management

  2. -

    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.

    -
      -
    1. Build execution.
    2. -
        -
      1. Initiate a build starting from any task.
      2. -
      3. Stop a currently active build.
      4. -
      -
    3. Build monitoring.
    4. -
        -
      1. Provide feedback on the current status of the build.
        - 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.
      2. -
      3. Show log messages from the build, allowing the user to determine - the task they originated from.
      4. -
      5. Provide the ability to filter logged messages, adn to display the - messages in color codes corresponding to logging levels.
      6. -
      7. Allow the installation of custom log listeners
      8. -
      9. Record runtime statistics to determine bottleneck in the build - process
        - This may be of limited use, as calling <javac> probably takes - the most time. But maybe not.
      10. -
      -
    -
    - -
  3. Build Wizard (auto-configure)

  4. -

    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.

    -
      -
    1. Project attributes.
    2. -
        -
      1. Provide input for the required project attributes.
        - This probably means project name and default target.
      2. -
      -
    3. Project directories.
    4. -
        -
      1. Ask for the source directory.
      2. -
      3. Ask for the destination directory.
      4. -
      5. Ask for the necessary JAR files.
      6. -
      -
    5. Project properties.
    6. -
        -
      1. Provide a default set of project properties.
        - In here would be things like classpath, build.compiler, version, - etc.
      2. -
      3. Allow the user to add to or remove from properties the default set - of properties.
      4. -
      -
    7. Task creation
    8. -
        -
      1. Provide a list of "standard" tasks to insert into the project.
        - This would be tasks like <javac> and - <javadoc>.
      2. -
      3. Generate default init, compile, javadoc, and clean targets.
      4. -
      -
    9. Creation review.
    10. -
        -
      1. Provide a review of the contents of the generated build.xml - file.
      2. -
      3. Allow the user to go back to any step in the process to change a - setting.
      4. -
      5. Prompt the user to save the build.xml file.
      6. -
      -
    -
    - - -
  5. IDE Integration

  6. -

    Components of the Ant GUI shoule support plugging into IDEs and code - editors.

    -
      -
    1. Emacs
    2. -
        -
      1. Provide support for launching builds from emacs, and notification - of errors.
      2. -
      -
    3. JEdit
    4. -
        -
      1. Provide JEdit plug-in.
      2. -
      -
    5. ProjectBuilder
    6. -
        -
      1. Provide integration with OSX ProjectBuilder.
      2. -
      -
    7. NetBeans
    8. -
        -
      1. Provide integration with the NetBeans IDE.
      2. -
      -
    -
    - - -
  7. Project Editing

  8. -

    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. How - sub-projects are handled (i.e. via the <ant> task) needs to be - determined.

    -
      -
    1. Load a project.
    2. -
        -
      1. Read the native Ant XML format as defined by the Ant users' - manual.
      2. -
      3. 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.
        - Possible approach: load "default.properties", use - introspection to discover attribute set, then reference some other - mechanism for attributes that are manifested as properties. -
      4. -
      5. Report errors in the XML source.
      6. -
      7. Provide a list of recently opened documents for - quick reloading.
      8. -
      -
    3. View project contents.
    4. -
        -
      1. View the project in it's XML source format.
      2. -
      3. View the project in a non-source format.
        - This is left ambiguous to keep the implementation out of the - requirements. The different presentation formats are likely to evolve - over time. -
      4. -
      5. View the project properties.
      6. -
      7. View the project contents (tasks).
      8. -
      -
    5. Modify a project.
    6. -
        -
      1. Edit via the XML source.
      2. -
      3. Edit properties via a property sheet.
      4. -
      5. Provide facility for editing XML references used in the build - file.
      6. -
      -
    7. Save a project.
    8. -
        -
      1. Save to the native Ant XML format as defined by the Ant users' - manual.
      2. -
      3. Default save name is "build.xml".
      4. -
      5. Verify before overwriting existing file when in "Save as" - mode.
      6. -
      -
    9. Create a new project.
    10. -
        -
      1. Define a project name.
      2. -
      3. Define the default target.
      4. -
      5. Define the project base directory.
      6. -
      -
    -
    - - -
  9. Task Editing

  10. -

    Tasks define what it is that Ant is to do, and will be the object most - edited in the UI. Task is to Paragraph as - Project is to Document. -

      -
    1. View tasks.
    2. -
        -
      1. View a sorted list of tasks.
        - Provide sorting based on name, depth in dependency tree, how many - tasks depend in it...
      2. -
      3. View tasks as a directed graph.
        - Need a good graph editing library. Looked at GEF but it still needs a lot of - work, to make it easily reusable. Long term status unknown.
      4. -
      5. View tasks as a dependency tree.
      6. -
      7. View task as a properties sheet.
      8. -
      9. Provide dependency viewing, both immediate and "flattened" - views.
      10. -
      -
    3. Modify task.
    4. -
        -
      1. Allow editing of a task via a property sheet.
      2. -
      3. Allow editing of a task via XML source.
      4. -
      5. Allow the graphical editing of task dependencies
        - This is where you can go hog wild with the component wiring type of - UI.
      6. -
      7. Allow non-graphical editing of dependencies.
      8. -
      9. Provide detection of circular dependencies.
      10. -
      11. Facilitate definition of conditional tasks with evaluation - editor.
      12. -
      -
    -
    - -
  11. Build File Source Editing

  12. -

    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.

    -
      -
    1. XML Editor.
    2. -
        -
      1. Provide syntax higlighting.
      2. -
      3. Provide auto-indentation.
      4. -
      5. Provide smart tag completion.
      6. -
      7. Provide visual highlighting of syntax errors.
      8. -
      9. Support auto-reparsing of contents and model update.
      10. -
      -
    - -
    -

    Copyright © 2000 Apache Software Foundation. All - rights Reserved.

    - - - diff --git a/src/antidote/docs/new-module-howto.html b/src/antidote/docs/new-module-howto.html deleted file mode 100644 index db0140847..000000000 --- a/src/antidote/docs/new-module-howto.html +++ /dev/null @@ -1,89 +0,0 @@ - - - - Antidote New Module HOWTO - - - - -

    Antidote New Module HOWTO

    - -

    Version 0.1 (2000/12/18)

    - -

    Authors: - Simeon H.K. Fitch -

    - -

    Introduction

    - -

    The purpose of this document is to provide an overview of the - basic steps one must undertake to add a new module to - Antidote. Please see The Antidote - Design Overview for information on what a module is and how it - fits into Antidote. If you've already got all that, then read - on!

    - -

    NB: Please submit updates and criticisms to this, particularly - areas that were unclear, missing, or difficult to follow.

    - -

    1) Specialize org.apache.tools.ant.gui.core.AntModule

    - -

    All modules must inherit from the AntModule - class. This will probably irritate some of you, but it essentially - enforces inheritance from javax.swing.JComponent and - provides encapsulated handling of the AppContext instance - that is so important to this class.

    - -

    Your module is required to implement the - AntModule.contextualize(AppContext) method. The first - thing this method should do is call - AntModule.setContext(AppContext), and then it is safe for - it to begin constructing its display, using whatever resources it - needs from the given AppContext instance. Think of this - in a similar manner to Applet.init() or - Servlet.init(). - -

    2) Update - org/apache/tools/ant/gui/resources/antidote.properties

    - -

    2a) Externalize All Displayable Strings

    - -

    All displayable strings must be externalized to the - antidote.properties file, and looked up via the - AppContext.getResources() method after the - AntModule.contextualize() method has been called. Follow - the naming convention currently used in the properties file and - you should have to problems. This task should be done - during development of your module. Under no cercumstances - should your module be submitted or committed without this task - being completed. Remember that Antidote has an international - audience.

    - -

    2b) Add Module to List of Auto-Loaded Modules

    - -

    Look for the properties with the format - org.apache.tools.ant.gui.Antidote.xxx.modules where - xxx is one of {left | right | top | bottom}. Depending on - where you want your module to appear, and the order that you want - it to appear in relationship to the other modules, add the class - name of your module appropriately. If multiple modules are listed - for a single property (via a comma delimited list), then each - module will have it's own tab in a javax.swing.JTabbedPane. - -

    NB:This goofy way of constructing the main screen will probably - change to something much more general (but not as general as, say - BML).

    - -

    Run it!

    -

    That should be all you need to do, at least to get your module - plugged in. Check out the source code for - ProjectNavigator and PropertyEditor for module - examples that use the various facilities of the Antidote - framework.

    - -
    -

    Copyright © 2000 Apache Software Foundation. All - rights Reserved.

    - - - diff --git a/src/antidote/docs/uml/index.html b/src/antidote/docs/uml/index.html deleted file mode 100644 index 4f685e9de..000000000 --- a/src/antidote/docs/uml/index.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - Antidote UML Static Class Diagrams - - - - -

    Antidote UML Static Class Diagrams

    - -

    Version 0.1 (2000/12/19)

    - -

    Authors: - Simeon H.K. Fitch -

    - -

    Diagram Images

    - -

    The following UML static class diagrams were generated using Together/J, reverse engineering the - existing code. They are no means guaranteed to be kept up to date, and are - only a snapshot of development in progress. Their purpose is to help give - people a quick glance a the class structure of the various packages that - make up.

    - -
      -
    1. org.apache.tools.ant.gui
    2. -
    3. org.apache.tools.ant.gui.acs
    4. -
    5. org.apache.tools.ant.gui.core
    6. -
    7. org.apache.tools.ant.gui.command
    8. -
    9. org.apache.tools.ant.gui.customizer
    10. -
    11. org.apache.tools.ant.gui.event
    12. -
    13. org.apache.tools.ant.gui.ide
    14. -
    15. org.apache.tools.ant.gui.modules
    16. -
    17. org.apache.tools.ant.gui.modules.console
    18. -
    19. org.apache.tools.ant.gui.modules.edit
    20. -
    21. org.apache.tools.ant.gui.util
    22. -
    - -
    -

    Copyright © 2000 Apache Software Foundation. All - rights Reserved.

    - - diff --git a/src/antidote/docs/uml/org-apache-tools-ant-gui-acs.gif b/src/antidote/docs/uml/org-apache-tools-ant-gui-acs.gif deleted file mode 100644 index 215b26dfb..000000000 Binary files a/src/antidote/docs/uml/org-apache-tools-ant-gui-acs.gif and /dev/null differ diff --git a/src/antidote/docs/uml/org-apache-tools-ant-gui-command.gif b/src/antidote/docs/uml/org-apache-tools-ant-gui-command.gif deleted file mode 100644 index d8f28a222..000000000 Binary files a/src/antidote/docs/uml/org-apache-tools-ant-gui-command.gif and /dev/null differ diff --git a/src/antidote/docs/uml/org-apache-tools-ant-gui-core.gif b/src/antidote/docs/uml/org-apache-tools-ant-gui-core.gif deleted file mode 100755 index da7c4c70a..000000000 Binary files a/src/antidote/docs/uml/org-apache-tools-ant-gui-core.gif and /dev/null differ diff --git a/src/antidote/docs/uml/org-apache-tools-ant-gui-customizer.gif b/src/antidote/docs/uml/org-apache-tools-ant-gui-customizer.gif deleted file mode 100644 index a7a0d8b13..000000000 Binary files a/src/antidote/docs/uml/org-apache-tools-ant-gui-customizer.gif and /dev/null differ diff --git a/src/antidote/docs/uml/org-apache-tools-ant-gui-event.gif b/src/antidote/docs/uml/org-apache-tools-ant-gui-event.gif deleted file mode 100644 index 16dff2115..000000000 Binary files a/src/antidote/docs/uml/org-apache-tools-ant-gui-event.gif and /dev/null differ diff --git a/src/antidote/docs/uml/org-apache-tools-ant-gui-ide.gif b/src/antidote/docs/uml/org-apache-tools-ant-gui-ide.gif deleted file mode 100644 index b8fe34344..000000000 Binary files a/src/antidote/docs/uml/org-apache-tools-ant-gui-ide.gif and /dev/null differ diff --git a/src/antidote/docs/uml/org-apache-tools-ant-gui-modules-console.gif b/src/antidote/docs/uml/org-apache-tools-ant-gui-modules-console.gif deleted file mode 100755 index fced09ce8..000000000 Binary files a/src/antidote/docs/uml/org-apache-tools-ant-gui-modules-console.gif and /dev/null differ diff --git a/src/antidote/docs/uml/org-apache-tools-ant-gui-modules-edit.gif b/src/antidote/docs/uml/org-apache-tools-ant-gui-modules-edit.gif deleted file mode 100755 index 0bf9f769c..000000000 Binary files a/src/antidote/docs/uml/org-apache-tools-ant-gui-modules-edit.gif and /dev/null differ diff --git a/src/antidote/docs/uml/org-apache-tools-ant-gui-modules.gif b/src/antidote/docs/uml/org-apache-tools-ant-gui-modules.gif deleted file mode 100755 index 6530e8f5e..000000000 Binary files a/src/antidote/docs/uml/org-apache-tools-ant-gui-modules.gif and /dev/null differ diff --git a/src/antidote/docs/uml/org-apache-tools-ant-gui-util.gif b/src/antidote/docs/uml/org-apache-tools-ant-gui-util.gif deleted file mode 100644 index 482c86d50..000000000 Binary files a/src/antidote/docs/uml/org-apache-tools-ant-gui-util.gif and /dev/null differ diff --git a/src/antidote/docs/uml/org-apache-tools-ant-gui.gif b/src/antidote/docs/uml/org-apache-tools-ant-gui.gif deleted file mode 100644 index 59ab84fa9..000000000 Binary files a/src/antidote/docs/uml/org-apache-tools-ant-gui.gif and /dev/null differ diff --git a/src/antidote/etc/manifest b/src/antidote/etc/manifest deleted file mode 100644 index c06eb52b9..000000000 --- a/src/antidote/etc/manifest +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: org.apache.tools.ant.gui.Main - - diff --git a/src/antidote/org/apache/tools/ant/gui/About.java b/src/antidote/org/apache/tools/ant/gui/About.java deleted file mode 100644 index aa07f16b6..000000000 --- a/src/antidote/org/apache/tools/ant/gui/About.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui; -import org.apache.tools.ant.gui.util.WindowUtils; - -import org.apache.tools.ant.gui.core.AppContext; -import javax.swing.*; -import java.io.IOException; -import java.util.*; -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** - * Dialog displaying information on the application. - * - * @version $Revision$ - * @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; - - 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", "??"); - - String message = context.getResources().getMessage( - getClass(), "message", - new Object[] { version, date }); - - String title = context.getResources().getString( - getClass(), "title"); - setTitle(title); - - JTextPane contents = new JTextPane(); - contents.setContentType("text/html"); - contents.setText(message); - contents.setEditable(false); - // XXX Still not sure why this is necessary. JTextPane doesn't - // seem to report a "true" preferred size. - contents.setPreferredSize( - new Dimension(contents.getPreferredSize().width, 450)); - 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); - - getRootPane().setDefaultButton(ok); - - - // 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); - } - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/Antidote.java b/src/antidote/org/apache/tools/ant/gui/Antidote.java deleted file mode 100644 index 6f9eb6e25..000000000 --- a/src/antidote/org/apache/tools/ant/gui/Antidote.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui; -import org.apache.tools.ant.gui.core.*; -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$ - * @author Simeon Fitch - */ -public class Antidote extends JComponent { - /** Source of application state data. */ - private AppContext _context = null; - - /** - * Default ctor. - * - */ - public Antidote(AppContext context) { - setLayout(new BorderLayout()); - - _context = context; - - // Add the various modules to the editing area. - JSplitPane splitter = new JSplitPane(); - splitter.add(JSplitPane.LEFT, populateModules("left")); - splitter.add(JSplitPane.RIGHT, populateModules("right")); - // This is necessary because, frankly, the JSplitPane widget - // sucks, and doesn't provide enought (working) control over the - // initial size of it's subcomponents. setDividerLocation(double) - // doesn't seem to work until after the widget is visible. - splitter.setPreferredSize(new Dimension(500, 300)); - - // Top bottom splitter. - JSplitPane splitter2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT); - splitter2.setOneTouchExpandable(true); - - splitter2.add(JSplitPane.TOP, splitter); - splitter2.add(JSplitPane.BOTTOM, populateModules("bottom")); - - add(BorderLayout.CENTER, splitter2); - splitter2.resetToPreferredSizes(); - - add(BorderLayout.NORTH, populateModules("top")); - - setPreferredSize(new Dimension(640, 480)); - } - - - /** - * Instantiate the configured modules. - * - * @return Component containing the modules(s). - */ - private JComponent populateModules(String prefix) { - - String[] classNames = _context.getResources(). - getStringArray(getClass(), prefix + ".modules"); - - AntModule[] modules = new AntModule[classNames.length]; - - for(int i = 0; i < classNames.length; i++) { - try { - Class type = Class.forName(classNames[i]); - - modules[i] = (AntModule) type.newInstance(); - modules[i].contextualize(_context); - } - catch(Exception ex) { - // XXX log me. - ex.printStackTrace(); - } - } - - if(modules.length == 1) { - return modules[0]; - } - else if(modules.length > 1) { - JTabbedPane tabbed = new JTabbedPane(JTabbedPane.BOTTOM); - - for(int i = 0; i < modules.length; i++) { - tabbed.addTab(modules[i].getName(), modules[i]); - } - return tabbed; - } - else { - return new JLabel("I shouldn't be here..."); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/Args.java b/src/antidote/org/apache/tools/ant/gui/Args.java deleted file mode 100644 index 9c9581a6f..000000000 --- a/src/antidote/org/apache/tools/ant/gui/Args.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.gui; -import org.apache.tools.ant.gui.core.ResourceManager; - -/** - * Class encapsulating the parsing of command-line arguments for Antidote. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class Args { - - private ResourceManager _resources = null; - private boolean _wizardMode = false; - private String _fileName = null; - private boolean _debugMode = false; - - /** - * Ctor for parsing command line arguments. - * - * @param args Arguments to parse. - */ - public Args(String[] args) { - for(int i = 0; i < args.length; i++) { - String arg = args[i]; - if(i == args.length - 1 && !arg.startsWith("-")) { - _fileName = arg; - } - else if(arg.startsWith("-h")) { - System.out.println(getUsage()); - System.exit(0); - } - else if(arg.equals("-wizard")) { - _wizardMode = true; - } - else if(arg.equals("-debug")) { - _debugMode = true; - } - else { - String msg = getResources().getMessage( - "invalidArg", new Object[] { arg }); - abort(msg); - } - } - } - - /** - * Get the resources, loading them if necessary. - * - * @return Loaded resources. - */ - private ResourceManager getResources() { - if(_resources == null) { - _resources = new ResourceManager( - "org.apache.tools.ant.gui.resources.args"); - } - return _resources; - } - - /** - * Print message and exit. - * - * @param error Error message to print. - */ - private void abort(String error) { - System.err.println(error); - System.err.println(getUsage()); - System.exit(1); - } - - /** - * Get the command line usage of Antidote. - * - * @return Command line usage help. - */ - public String getUsage() { - return getResources().getString("usage"); - } - - /** - * Get the build filename. - * - * @return Build file name. - */ - public String getBuildFile() { - return _fileName; - } - - /** - * Determine if wizard mode was requested for generating a new - * build file. - * - * @return True if wizard mode, false otherwise. - */ - public boolean isWizardMode() { - return _wizardMode; - } - - /** - * Determine if debug mode was requested. - * - * @return True if debug mode, false otherwise. - */ - public boolean isDebugMode() { - return _debugMode; - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/Main.java b/src/antidote/org/apache/tools/ant/gui/Main.java deleted file mode 100644 index 5047a0ab1..000000000 --- a/src/antidote/org/apache/tools/ant/gui/Main.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui; -import org.apache.tools.ant.gui.core.*; -import org.apache.tools.ant.gui.util.XMLHelper; -import org.apache.tools.ant.gui.wizard.Wizard; -import org.apache.tools.ant.gui.wizard.build.BuildData; -import org.apache.tools.ant.gui.wizard.WizardListener; -import org.apache.tools.ant.gui.command.LoadFileCmd; -import org.apache.tools.ant.gui.event.EventBus; -import org.apache.tools.ant.gui.acs.ACSFactory; -import javax.swing.*; -import java.awt.BorderLayout; -import java.io.File; - -/** - * Launch point for the Antidote GUI. Configurs it as an application. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class Main { - /** - * Application start. - * - * @param args TBD - */ - public static void main(String[] args) { - XMLHelper.init(); - - Args settings = new Args(args); - - - try { - JFrame f = new JFrame("Antidote"); - f.setDefaultCloseOperation(3 /*JFrame.EXIT_ON_CLOSE*/); - AppContext context = new AppContext(f); - - if(!settings.isWizardMode()) { - EventResponder resp = new EventResponder(context); - Antidote gui = new Antidote(context); - - JMenuBar menu = context.getActions().createMenuBar(); - f.setJMenuBar(menu); - f.getContentPane().add(BorderLayout.CENTER, gui); - f.getContentPane().add(BorderLayout.NORTH, - context.getActions().createToolBar()); - - // Add the project selection menu. - ProjectSelectionMenu ps = new ProjectSelectionMenu(context); - ps.insertInto(menu); - - // Add debugging items. - if(settings.isDebugMode()) { - context.getEventBus().addMember( - EventBus.VETOING, new EventDebugMonitor()); - } - - // Load a build file if one is provided. - if(settings.getBuildFile() != null) { - LoadFileCmd load = new LoadFileCmd(context); - load.setFile(new File(settings.getBuildFile())); - load.run(); - } - } - else { - // We are in wizard mode. Create it. - Wizard wiz = new Wizard(new BuildData()); - // XXX this is temporary for testing. Eventually - // it will launch the regular antidote screen with the - // results of the wizard. - wiz.addWizardListener(new WizardListener() { - public void finished(Object model) { - BuildData data = (BuildData) model; - System.out.println(data.createProject()); - System.exit(0); - } - public void canceled() { - System.exit(0); - } - - }); - - f.getContentPane().add(BorderLayout.CENTER, wiz); - } - - ImageIcon icon = - context.getResources().loadImageIcon("icon-small.gif"); - if(icon != null) { - f.setIconImage(icon.getImage()); - } - else { - System.out.println("Application icon not found."); - } - - f.pack(); - f.setVisible(true); - - } - catch(Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSBeanDescriptor.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSBeanDescriptor.java deleted file mode 100644 index 2912e302b..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSBeanDescriptor.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import org.apache.tools.ant.gui.core.ResourceManager; -import java.beans.*; - -/** - * Specialized BeanDescriptor for providing more descriptive information. - * - * @version $Revision$ - * @author Simeon Fitch - */ -class ACSBeanDescriptor extends BeanDescriptor { - public ACSBeanDescriptor(BaseBeanInfo type) { - super(type.getType(), type.getCustomizerType()); - setDisplayName( - type.getResources().getString(type.getClass(), "beanName")); - setShortDescription( - type.getResources().getString(type.getClass(), "beanDescription")); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSDefaultElement.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSDefaultElement.java deleted file mode 100644 index eb82fa671..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSDefaultElement.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import com.sun.xml.tree.ElementNode; - -/** - * Default element used when no other element is specificed. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ACSDefaultElement extends ACSElement { - /** - * Default ctor. - * - */ - public ACSDefaultElement() { - - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSDocumentType.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSDocumentType.java deleted file mode 100644 index 4ad48f039..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSDocumentType.java +++ /dev/null @@ -1,504 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; -import java.io.*; -import java.net.*; -import java.util.*; -import org.w3c.dom.*; -import javax.xml.parsers.*; -import org.xml.sax.SAXException; -import org.xml.sax.InputSource; -import com.sun.xml.parser.Parser; -import com.sun.xml.parser.DtdEventListener; -import com.sun.xml.parser.ValidatingParser; -import com.sun.xml.tree.*; -import com.sun.xml.parser.Resolver; - -/** - * Reads the ANT DTD and provides information about it. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class ACSDocumentType extends java.lang.Object { - /** ID for core elements */ - public final static int CORE_ELEMENT = 0; - /** ID for optional elements */ - public final static int OPTIONAL_ELEMENT = 1; - /** True if the DTD has been loaded */ - private boolean isInit = false; - /** Hold the core DTD elements */ - private HashMap coreElementMap = new HashMap(); - /** Hold the optional DTD elements */ - private HashMap optionalElementMap = new HashMap(); - /** Hold the DTD elements */ - private HashMap elementMap; - /** First part of the XML document used to load the DTD */ - private final static String XMLDOC_1 = - "" + - "" + - ""; - /** DTD which holds the core tasks */ - private final static String DTD_1 = "project.dtd"; - /** DTD which holds the optional tasks */ - private final static String DTD_2 = "project-ext.dtd"; - /** DTD which holds the shared elements */ - private final static String DTD_SHARE = "share.dtd"; - - /** - * Standard ctor. - */ - public ACSDocumentType() { - } - - /** - * Loads the DTD if not already loaded. - */ - public void init() { - // Return if already inited. - if (isInit) { - return; - } - - try { - // Setup the parser - Parser p = new Parser(); - p.setEntityResolver(new ACSResolver()); - - // Setup the builder - XmlDocumentBuilder builder = new XmlDocumentBuilder(); - SimpleElementFactory fact = new SimpleElementFactory(); - fact.addMapping(new Properties(), - ACSDocumentType.class.getClassLoader()); - builder.setElementFactory(fact); - builder.setParser(p); - - DtdHandler dtdh = new DtdHandler(); - p.setDTDHandler(dtdh); - - String coreDoc = XMLDOC_1 + DTD_1 + XMLDOC_2; - String optionalDoc = XMLDOC_1 + DTD_2 + XMLDOC_2; - - // Parse the core task DTD - elementMap = coreElementMap; - InputSource xmldocCore = new InputSource( - new ByteArrayInputStream(coreDoc.getBytes())); - p.parse(xmldocCore); - - // Parse the core task DTD - elementMap = optionalElementMap; - InputSource xmldocOptional = new InputSource( - new ByteArrayInputStream(optionalDoc.getBytes())); - p.parse(xmldocOptional); - - isInit = true; - } catch (Exception e) { - System.out.println(e); - } - } - - /** - * Returns the dtd element. - * - * @param elementType CORE_ELEMENT or OPTIONAL_ELEMENT - * @param name the element name - */ - public DtdElement findElement(int elementType, String name) { - if (elementType == OPTIONAL_ELEMENT) { - return (DtdElement) optionalElementMap.get(name); - } - return (DtdElement) coreElementMap.get(name); - } - - /** - * Class which represents a DTD element. - */ - static class DtdElement { - private String _name; - private String[] _contentModel; - private DtdAttributes _map = new DtdAttributes(); - - public String getName() { - return _name; - } - public void setName(String name) { - _name = name; - } - public String[] getContentModel() { - return _contentModel; - } - public void setContentModel(String[] model) { - _contentModel = model; - } - public DtdAttributes getAttributes() { - return _map; - } - } - - /** - * Class which represents a DTD attribute. - */ - static class DtdAttribute { - private String _name; - private String _type; - private String[] _options; - private String _defaultValue; - private boolean _isFixed; - private boolean _isRequired; - - public String getName() { - return _name; - } - public void setName(String name) { - _name = name; - } - public String getType() { - return _type; - } - public void setType(String type) { - _type = type; - } - public String getDefaultValue() { - return _defaultValue; - } - public void setDefaultValue(String value) { - _defaultValue = value; - } - public String[] getOptions() { - return _options; - } - public void setOptions(String[] s) { - _options = s; - } - public boolean isFixed() { - return _isFixed; - } - public void setFixed(boolean value) { - _isFixed = value; - } - public boolean isRequired() { - return _isRequired; - } - public void setRequired(boolean value) { - _isRequired = value; - } - } - - /** - * Class which represents a collection of DTD attributes. - */ - public static class DtdAttributes extends HashMap { - /** - * Default constructor - */ - public DtdAttributes() { - } - - /** - * Adds the Attribute - * - * @param attribute new attribute - */ - public void addAttribute(DtdAttribute attribute) { - put(attribute.getName(), attribute); - } - - /** - * Return the requested attribute - * - * @param name attribute name - * @returns the requested attribute - */ - public DtdAttribute getAttribute(String name) { - return (DtdAttribute) get(name); - } - - /** - * @returns an array of the optional attribute names - */ - public String[] getOptionalAttributes() { - ArrayList list = new ArrayList(); - Iterator i = values().iterator(); - while(i.hasNext()) { - DtdAttribute a = (DtdAttribute)i.next(); - if (!a.isRequired()) { - list.add(a.getName()); - } - } - String[] result = new String[list.size()]; - list.toArray(result); - return result; - } - - /** - * @returns an array of the required attribute names - */ - public String[] getRequiredAttributes() { - ArrayList list = new ArrayList(); - Iterator i = values().iterator(); - while(i.hasNext()) { - DtdAttribute a = (DtdAttribute)i.next(); - if (a.isRequired()) { - list.add(a.getName()); - } - } - String[] result = new String[list.size()]; - list.toArray(result); - return result; - } - /** - * @returns an array of the all attribute names - */ - public String[] getAttributes() { - ArrayList list = new ArrayList(); - Iterator i = values().iterator(); - while(i.hasNext()) { - DtdAttribute a = (DtdAttribute)i.next(); - list.add(a.getName()); - } - String[] result = new String[list.size()]; - list.toArray(result); - return result; - } - } - - /** - * When parsing XML documents, DTD related events are signaled through - * this interface. - */ - class DtdHandler implements DtdEventListener { - public void externalDtdDecl ( - String publicId, - String systemId) - throws SAXException { } - - public void internalDtdDecl ( - String internalSubset) - throws SAXException { } - - public void internalEntityDecl ( - String name, - String value) - throws SAXException { } - - public void externalEntityDecl ( - String name, - String publicId, - String systemId) - throws SAXException { } - - public void endDtd () - throws SAXException { } - - public void notationDecl ( - String name, - String publicId, - String systemId) - throws SAXException { } - - public void unparsedEntityDecl ( - String name, - String publicId, - String systemId, - String notationName) - throws SAXException { } - - public void startDtd ( - String rootName - ) throws SAXException - { - elementMap.clear(); - } - - /** - * Reports an attribute declaration found within the DTD. - * - * @param elementName The name of the element to which the attribute - * applies; this includes a namespace prefix if one was used within - * the DTD. - * @param attributeName The name of the attribute being declared; this - * includes a namespace prefix if one was used within the DTD. - * @param attributeType The type of the attribute, either CDATA, NMTOKEN, - * NMTOKENS, ENTITY, ENTITIES, NOTATION, ID, IDREF, or IDREFS as - * defined in the XML specification; or null for enumerations. - * @param options When attributeType is null or NOTATION, this is an - * array of the values which are permitted; it is otherwise null. - * @param defaultValue When not null, this provides the default value - * of this attribute. - * @param isFixed When true, the defaultValue is the only legal value. - * (Precludes isRequired.) - * @param isRequired When true, the attribute value must be provided - * for each element of the named type. (Precludes isFixed.) - */ - public void attributeDecl ( - String elementName, - String attributeName, - String attributeType, - String options [], - String defaultValue, - boolean isFixed, - boolean isRequired - ) throws SAXException - { - // Try to find the element. - DtdElement e = (DtdElement) elementMap.get(elementName); - if (e == null) { - throw new SAXException("element " + elementName + - " not declared before attributes"); - } - - // Update the element's attribute. - DtdAttribute attrib = new DtdAttribute(); - attrib.setName(attributeName); - attrib.setType(attributeType); - attrib.setFixed(isFixed); - attrib.setRequired(isRequired); - attrib.setDefaultValue(defaultValue); - attrib.setOptions(options); - e.getAttributes().addAttribute(attrib); - } - - /** - * Reports an element declaration found within the DTD. The content - * model will be a string such as "ANY", "EMPTY", "(#PCDATA|foo)*", - * or "(caption?,tr*)". - * - * @param elementName The name of the element; this includes a namespace - * prefix if one was used within the DTD. - * @param contentModel The content model as defined in the DTD, with - * any whitespace removed. - */ - public void elementDecl ( - String elementName, - String contentModel - ) throws SAXException - { - DtdElement e = new DtdElement(); - e.setName(elementName); - - // Break the contentModel string into pieces. - ArrayList list = new ArrayList(); - StringTokenizer st = new StringTokenizer(contentModel, "|()*"); - while (st.hasMoreTokens()) { - String s = st.nextToken(); - if ( s.length() > 0 && !"EMPTY".equals(s) ) { - list.add(s); - } - } - String[] array = new String[list.size()]; - list.toArray(array); - e.setContentModel(array); - - // Update the map - elementMap.put(e.getName(), e); - } - } - - /** - * We provide the location for the ant dtds. - */ - class ACSResolver implements org.xml.sax.EntityResolver { - - /** - * We process the project.dtd and project-ext.dtd. - * - * @param name Used to find alternate copies of the entity, when - * this value is non-null; this is the XML "public ID". - * @param uri Used when no alternate copy of the entity is found; - * this is the XML "system ID", normally a URI. - */ - public InputSource resolveEntity ( - String publicId, - String systemId) - throws SAXException, IOException { - - InputStream result = null; - - // Is it the project.dtd? - if (systemId.indexOf(DTD_1) != -1) { - try { - // Look for it as a resource - result = getClass().getResourceAsStream(DTD_1); - } catch (Exception e) {} - } - // Is it the project-ext.dtd? - if (systemId.indexOf(DTD_2) != -1) { - try { - // Look for it as a resource - result = getClass().getResourceAsStream(DTD_2); - } catch (Exception e) {} - } - if (result != null) { - return new InputSource(result); - } - // Is it the share.dtd? - if (systemId.indexOf(DTD_SHARE) != -1) { - try { - // Look for it as a resource - result = getClass().getResourceAsStream(DTD_SHARE); - } catch (Exception e) {} - } - if (result != null) { - return new InputSource(result); - } - - // Otherwise, use the default impl. - com.sun.xml.parser.Resolver r = new com.sun.xml.parser.Resolver(); - return r.resolveEntity(publicId, systemId); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSDtdDefinedAttributes.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSDtdDefinedAttributes.java deleted file mode 100644 index d732d67b3..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSDtdDefinedAttributes.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.gui.acs; -import org.apache.tools.ant.gui.acs.ACSDocumentType.DtdElement; -import java.util.Properties; - -/** - * Represents the attributes defined by the DTD. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class ACSDtdDefinedAttributes extends Properties { - - ACSDocumentType.DtdElement _element = null; - - /** - * Default constructor - */ - public ACSDtdDefinedAttributes() { - this(null); - } - - /** - * Constructor - * - * @param element provides information about possible attributes. - */ - public ACSDtdDefinedAttributes(ACSDocumentType.DtdElement element) { - _element = element; - } - - /** - * Return the required attributes or null. - */ - public String[] getRequiredAttributes() { - if (_element == null) { - return null; - } - return _element.getAttributes().getRequiredAttributes(); - } - /** - * Return the optional attributes or null. - */ - public String[] getOptionalAttributes() { - if (_element == null) { - return null; - } - return _element.getAttributes().getOptionalAttributes(); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSDtdDefinedElement.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSDtdDefinedElement.java deleted file mode 100644 index 5c2bdd3e9..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSDtdDefinedElement.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; -import org.apache.tools.ant.gui.command.NewElementCmd; -import org.apache.tools.ant.gui.util.Collections; -import org.w3c.dom.*; -import java.beans.*; -import java.util.*; - -/** - * Element defined by the DTD. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class ACSDtdDefinedElement extends ACSTreeNodeElement -implements ACSInfoProvider { - - /** Property name for the task type. */ - public static final String TASK_TYPE = "taskType"; - /** Property name for attributes. It's called "namedValues" so - * it doesn't collide with the Node.getAttributes() method. */ - public static final String NAMED_VALUES = "namedValues"; - /** The ANT DTD */ - static ACSDocumentType docType = new ACSDocumentType(); - /** Our menu string */ - public String[] menuString = null; - /** The DTD element we represent */ - private ACSDocumentType.DtdElement _dtdElement = null; - - /** - * Default ctor. - * - */ - public ACSDtdDefinedElement() { - // Load the DTD - docType.init(); - } - - /** - * Get the task type. - * - * @return Task type. - */ - public String getTaskType() { - return getTagName(); - } - - /** - * Get the display name of this. - * - * @return Display name. - */ - public String getDisplayName() { - String name = getTagName(); - - // Is there only one attribute? - if (getAttributes().getLength() == 1) { - Node onlyNode = getAttributes().item(0); - - // Display the only attribute - name += ": " + onlyNode.getNodeValue(); - } else { - - // Display one of these attributes - // if they are present. - final String[] DISPLAY_ATTRIBUTES = - { - "name", - "id", - "property" - }; - - for(int i = 0; i < DISPLAY_ATTRIBUTES.length; i++) { - Node testNode = - getAttributes().getNamedItem(DISPLAY_ATTRIBUTES[i]); - if (testNode != null) { - name += ": " + testNode.getNodeValue(); - break; - } - } - } - - return name; - } - - /** - * Set the task type. - * - * @param type Type name. - */ - public void setTaskType(String type) { - setTag(type); - } - - /** - * Get the attributes (named value mappings). This method is not named - * getAttributes() because there is already a method of that name in - * the Node interface. - * - * @return Name-value mappings. - */ - public ACSDtdDefinedAttributes getNamedValues() { - ACSDtdDefinedAttributes retval = - new ACSDtdDefinedAttributes(getDtdElement()); - - NamedNodeMap attribs = getAttributes(); - for(int i = 0, len = attribs.getLength(); i < len; i++) { - Node n = attribs.item(i); - retval.setProperty(n.getNodeName(), n.getNodeValue()); - } - return retval; - } - - - /** - * Set the attributes. This method sets the Node attirbutes using - * the given Map containing name-value pairs. - * - * @param attributes New attribute set. - */ - public void setNamedValues(ACSDtdDefinedAttributes attributes) { - // XXX this code really sucks. It is really annoying that the - // DOM interfaces don't have a general "setAttributes()" or - // "removeAllAttributes()" method, but instead make you - // remove each attribute individually, or require you to figure - // out what the differences are between the two. - - // Although this is very inefficient, I'm taking the conceptually - // simplistic approach to this and brute force removing the existing - // set and replacing it with a brand new set. If this becomes a - // performance concern (which I doubt it will) it can be optimized - // later. - - ACSDtdDefinedAttributes old = (ACSDtdDefinedAttributes) getNamedValues(); - - Enumeration enum = old.propertyNames(); - while(enum.hasMoreElements()) { - String name = (String) enum.nextElement(); - removeAttribute(name); - } - - enum = attributes.propertyNames(); - while(enum.hasMoreElements()) { - String key = (String) enum.nextElement(); - setAttribute(key, attributes.getProperty(key)); - } - - firePropertyChange(NAMED_VALUES, old, attributes); - } - - /** - * Returns the menu items which may be used for this element. - */ - public String[] getMenuString() { - - // If it already exists, use it. - if (menuString != null) { - return menuString; - } - - // Find the DtdElement - String name = getTagName(); - - // Are we the project element? - boolean isProject = false; - if (name.equals("project")) { - isProject = true; - } - - ACSDocumentType.DtdElement e = - docType.findElement(ACSDocumentType.CORE_ELEMENT, name); - if (e == null) { - e = docType.findElement(ACSDocumentType.OPTIONAL_ELEMENT, name); - } - - if (e != null) { - // Use the content model (all the possible - // sub-elements) to create the menu. - String[] temp = e.getContentModel(); - - // Sort the items - List list = Collections.fill(null, temp); - java.util.Collections.sort(list); - list.toArray(temp); - - int size = (temp.length > 5) ? 5 : temp.length; - - // The project doesn't need a delete menu - if (isProject) { - menuString = new String[size+1]; - } else { - menuString = new String[size+2]; - } - System.arraycopy(temp, 0, menuString, 0, size); - - } else { - // This is for elements not in the DTD - menuString = new String[2]; - } - - if (isProject) { - menuString[menuString.length-1] = "newElement"; - } else { - // Add the delete and generic create commands - menuString[menuString.length-1] = "deleteElement"; - menuString[menuString.length-2] = "newElement"; - } - - return menuString; - } - - /** - * Returns the string to use if an action ID is not found. - * In our case, the newElement command is used. - */ - public String getDefaultActionID() { - return "newElement"; - } - - /** - * Returns a string array which contains this elements - * possible children. - * - * @param childType ACSDocumentType.CORE_ELEMENT or - * ACSDocumentType.OPTIONAL_ELEMENT - */ - public String[] getPossibleChildren(int childType) { - String name = getTagName(); - - ACSDocumentType.DtdElement e = - docType.findElement(childType, name); - if (e != null) { - return e.getContentModel(); - } - return null; - } - - /** - * Adds the attributes which are required by this node. - */ - public void addRequiredAttributes() { - ACSDocumentType.DtdElement e = getDtdElement(); - if (e == null) { - return; - } - String[] attributes = e.getAttributes().getRequiredAttributes(); - if (attributes == null) { - return; - } - for(int i = 0; i < attributes.length; i++) { - if ( getAttributes().getNamedItem(attributes[i]) == null) { - // XXX should set to default? - setAttribute(attributes[i], ""); - } - } - } - - /** - * Returns the DTD element we represent - */ - private ACSDocumentType.DtdElement getDtdElement() { - if (_dtdElement != null) { - return _dtdElement; - } - - String name = getNodeName(); - - _dtdElement = docType.findElement(ACSDocumentType.CORE_ELEMENT, name); - if (_dtdElement == null) { - _dtdElement = docType.findElement( - ACSDocumentType.OPTIONAL_ELEMENT, name); - } - - return _dtdElement; - } -} - diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSDtdDefinedElementBeanInfo.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSDtdDefinedElementBeanInfo.java deleted file mode 100644 index 64694112a..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSDtdDefinedElementBeanInfo.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; -import org.apache.tools.ant.gui.customizer.DynamicCustomizer; -import org.apache.tools.ant.gui.modules.edit.DtdAttributePropertyEditor; -import java.beans.*; - -/** - * BeanInfo for the ACSDtdDefinedElement class. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class ACSDtdDefinedElementBeanInfo extends BaseBeanInfo { - /** - * Default ctor. - * - */ - public ACSDtdDefinedElementBeanInfo() { - } - - /** - * Get the type that this BeanInfo represents. - * - * @return Type. - */ - public Class getType() { - return ACSDtdDefinedElement.class; - } - - /** - * Get the customizer type. - * - * @return Customizer type. - */ - public Class getCustomizerType() { - return Customizer.class; - } - - /** - * Get the property descriptors. - * - * @return Property descriptors. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - PropertyDescriptor[] retval = null; - - try { - retval = new PropertyDescriptor[] { - new PropertyDescriptor(ACSDtdDefinedElement.TASK_TYPE, - ACSDtdDefinedElement.class, - "getTaskType", null), - new PropertyDescriptor(ACSDtdDefinedElement.NAMED_VALUES, - ACSDtdDefinedElement.class), - new PropertyDescriptor(ACSDtdDefinedElement.XML_STRING, - ACSDtdDefinedElement.class, - "getXMLString", null) - }; - int pos = 0; - retval[pos++].setDisplayName(getResources().getString( - getClass(),ACSDtdDefinedElement.TASK_TYPE)); - retval[pos++].setDisplayName(getResources().getString( - getClass(),ACSDtdDefinedElement.NAMED_VALUES)); - retval[pos++].setDisplayName(getResources().getString( - getClass(),ACSDtdDefinedElement.XML_STRING)); - - setSortingOrder(retval); - } catch(IntrospectionException ex) { - ex.printStackTrace(); - throw new Error(ex.toString()); - } - - return retval; - } - - /** Customizer for this bean info. */ - public static class Customizer extends DynamicCustomizer { - static { - PropertyEditorManager.registerEditor( - ACSDtdDefinedAttributes.class, DtdAttributePropertyEditor.class); - } - - public Customizer() { - super(ACSDtdDefinedElement.class); - } - } -} - diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSElement.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSElement.java deleted file mode 100644 index e04835b8a..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSElement.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import com.sun.xml.tree.ElementNode; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeSupport; - -/** - * Abstract base class for all Ant Construction Set - * elements. Depends on the JAXP XML library from Sun. - * - * @version $Revision$ - * @author Simeon Fitch */ -public abstract class ACSElement extends ElementNode { - /** Name of the 'xmlString' property. */ - public static final String XML_STRING = "xmlString"; - - /** Event support. */ - private PropertyChangeSupport _propSupport = null; - - /** - * Default ctor. - * - */ - protected ACSElement() { - } - - /** - * Get the display name of this. - * - * @return Display name. - */ - public String getDisplayName() { - return getTagName(); - } - - /** - * Get the XML representation of this. - * - * @return XML representation. - */ - public String getXMLString() { - return toString(); - } - - /** - * Set the given attribute. - * - * @param name Name of the attribute. - * @param value Value of the attribute. - */ - public void setAttribute(String name, String value) { - if(value == null && getAttribute(name).length() != 0) { - removeAttribute(name); - } - else { - super.setAttribute(name, value); - } - } - - /** - * Add a change listener. - * - * @param l Listener to add. - */ - public void addPropertyChangeListener(PropertyChangeListener l) { - if(_propSupport == null) { - _propSupport = new PropertyChangeSupport(this); - } - _propSupport.addPropertyChangeListener(l); - } - - - /** - * Remove a change listener - * - * @param l Listener to remove. - */ - public void removePropertyChangeListener(PropertyChangeListener l) { - if(_propSupport == null) { - _propSupport = new PropertyChangeSupport(this); - } - _propSupport.removePropertyChangeListener(l); - } - - /** - * Fire a change event to all listener. - * - * @param propName Name of the property. - * @param oldValue The old value. - * @param newValue The new value. - */ - protected void firePropertyChange( - String propName, Object oldValue, Object newValue) { - - if(_propSupport != null) { - _propSupport.firePropertyChange(propName, oldValue, newValue); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSFactory.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSFactory.java deleted file mode 100644 index 56e30ed52..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSFactory.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import javax.xml.parsers.*; -import java.io.IOException; -import java.io.File; -import java.net.URL; -import org.w3c.dom.*; -import org.xml.sax.SAXException; -import com.sun.xml.parser.Parser; -import com.sun.xml.tree.*; -import java.util.Properties; -import java.util.Enumeration; -import com.sun.xml.parser.Resolver; - -/** - * Factory for loading Ant Construction set elements. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ACSFactory { - /** Singleton instance of the factory. */ - private static ACSFactory _instance = null; - - /** Element maping. */ - private static final Properties _elementMap = new Properties(); - - static { - try { - // First we bootstrap our knowledge of the Ant tasks by reading - // in the taskdef definitions and assigning them the default - // task element class. - _elementMap.load(org.apache.tools.ant.taskdefs.Ant.class. - getResourceAsStream("defaults.properties")); - Enumeration enum = _elementMap.propertyNames(); - while(enum.hasMoreElements()) { - String name = (String) enum.nextElement(); - // XXX the name of the class needs to be stored externally. - _elementMap.setProperty( - name, "org.apache.tools.ant.gui.acs.ACSDtdDefinedElement"); - } - - // Then we add/override the local definitions. - _elementMap.load(ACSFactory.class. - getResourceAsStream("acs-element.properties")); - } - catch(Throwable ex) { - // If something wrong happens here we can't do much more... - ex.printStackTrace(); - System.exit(1); - } - } - - /** - * Default ctor. - * - */ - private ACSFactory() { - - } - - /** - * Get an instance of the factory. - * - * @return Factory instance. - */ - public static ACSFactory getInstance() { - if(_instance == null) { - _instance = new ACSFactory(); - } - return _instance; - } - - /** - * Load a project from the given XML file. - * XXX fix me. - * - * @param location Location of the file. - * @return Loaded project. - */ - public ACSProjectElement load(File location) throws IOException { - return load(new URL("file", null, location.getPath())); - } - - /** - * Load a project from the given XML file. - * XXX fix me. - * - * @param location Location of the file. - * @return Loaded project. - */ - public ACSProjectElement load(URL location) throws IOException { - XmlDocument doc = null; - - try { - SAXParser sax = SAXParserFactory.newInstance().newSAXParser(); - Parser parser = (Parser) sax.getParser(); - XmlDocumentBuilder builder = new XmlDocumentBuilder(); - builder.setIgnoringLexicalInfo(false); - SimpleElementFactory fact = new SimpleElementFactory(); - fact.addMapping(_elementMap, ACSFactory.class.getClassLoader()); - - builder.setElementFactory(fact); - - parser.setDocumentHandler(builder); - parser.setEntityResolver(new Resolver()); - //parser.setErrorHandler(); - - sax.parse(location.openStream(), null); - - doc = builder.getDocument(); - } - catch(ParserConfigurationException ex) { - ex.printStackTrace(); - throw new IOException(ex.getMessage()); - } - catch(SAXException ex) { - ex.printStackTrace(); - throw new IOException(ex.getMessage()); - } - - return (ACSProjectElement) doc.getDocumentElement(); - } - - /** - * Create a new, empty project. - * - * @return Empty project. - */ - public ACSProjectElement createProject() { - SimpleElementFactory fact = new SimpleElementFactory(); - fact.addMapping(_elementMap, ACSFactory.class.getClassLoader()); - XmlDocument doc = new XmlDocument(); - doc.setElementFactory(fact); - return (ACSProjectElement) doc.createElement("project"); - } - - - /** - * Create a new target. - * - * @param project Project the target is assigned to. - * @return New, unnamed target. - */ - public ACSTargetElement createTarget(ACSProjectElement project) { - ACSTargetElement retval = (ACSTargetElement) project. - getOwnerDocument().createElement("target"); - indent(project, 1); - project.appendChild(retval); - return retval; - } - - /** - * Create a new task. - * - * @param target Target the task is assigned to. - * @return New, unnamed task. - */ - public ACSTaskElement createTask(ACSTargetElement target) { - ACSTaskElement retval = (ACSTaskElement) target. - getOwnerDocument().createElement("task"); - indent(target, 2); - target.appendChild(retval); - return retval; - } - - /** - * Create a new property. - * - * @param node the Node to assign the property to. - * @return New, unnamed property. - */ - public ACSPropertyElement createProperty(ACSElement node) { - ACSPropertyElement retval = (ACSPropertyElement) node. - getOwnerDocument().createElement("property"); - // XXX fixme. - indent(node, 1); - node.appendChild(retval); - return retval; - } - - /** - * Create a new element. - * - * @param node the Node to assign the property to. - * @param name the new elements type. - * @return New, unnamed property. - */ - public ACSElement createElement(ACSElement node, String name) { - ACSElement retval = (ACSElement) node. - getOwnerDocument().createElement(name); - // XXX fixme. - indent(node, 1); - addRequiredAttributes(retval); - node.appendChild(retval); - return retval; - } - - /** - * Add required attributes to the node. - * - * @param node the Node to add the attrinutes to. - */ - public void addRequiredAttributes(ACSElement node) { - if (node instanceof ACSDtdDefinedElement) { - ACSDtdDefinedElement dtdElement = - (ACSDtdDefinedElement) node; - dtdElement.addRequiredAttributes(); - } - } - - /** - * Insert a new line and indentation at the end of the given - * node in preparation for a new element being added. - * - * @param node Node to append indent to. - * @param level Indentation level. - */ - private void indent(ACSElement node, int level) { - StringBuffer buf = new StringBuffer("\n"); - for(int i = 0; i < level; i++) { - buf.append(" "); - } - - Text text = node.getOwnerDocument().createTextNode(buf.toString()); - node.appendChild(text); - } - - - /** - * Test code - * - * @param args XML file to parse. - */ - public static void main(String[] args) { - try { - ACSFactory f = ACSFactory.getInstance(); - - System.out.println(f.load(new File(args[0]))); - } - catch(Exception ex) { - ex.printStackTrace(); - } - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSInfoProvider.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSInfoProvider.java deleted file mode 100644 index 3764cc1b9..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSInfoProvider.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -/** - * Provides menu infomation for a node. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public interface ACSInfoProvider { - /** - * Returns the menu items which may be used on this node. - * If the strings are not valid action IDs, use - * getDefaultActionID to find the action for the menu item. - */ - public String[] getMenuString(); - /** - * Returns the action ID to use for a menu item which does not - * represent a valid action ID. - */ - public String getDefaultActionID(); -} - diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSNamedElement.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSNamedElement.java deleted file mode 100644 index 96f747cfc..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSNamedElement.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import com.sun.xml.tree.ElementNode; -import java.util.StringTokenizer; - -/** - * Class representing an element with a name and description. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ACSNamedElement extends ACSDtdDefinedElement { - /** The 'name' property name. */ - public static final String NAME = "name"; - /** The discription property name. */ - public static final String DESCRIPTION = "description"; - - /** - * Default ctor. - * - */ - public ACSNamedElement() { - } - - /** - * Get the target name. - * - * @return Target name. - */ - public String getName() { - return getAttribute(NAME); - } - - /** - * Set the name. - * - * @param name New name value. - */ - public void setName(String name) { - String old = getName(); - setAttribute(NAME, name); - firePropertyChange(NAME, old, name); - } - - /** - * Get the long description of the target. - * - * @return Target description. - */ - public String getDescription() { - return getAttribute(DESCRIPTION); - } - - /** - * Set the description - * - * @param description New description value. - */ - public void setDescription(String description) { - String old = getDescription(); - setAttribute(DESCRIPTION, description); - firePropertyChange(DESCRIPTION, old, description); - } - - /** - * Get the display name. - * - * @return Display name. - */ - public String getDisplayName() { - return getName(); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSProjectElement.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSProjectElement.java deleted file mode 100644 index 02743ab5f..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSProjectElement.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import com.sun.xml.tree.ElementNode; -import java.net.URL; -import java.io.File; - -/** - * Class representing a project element in the build file. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ACSProjectElement extends ACSNamedElement { - /** The 'default' property name. */ - public static final String DEFAULT = "default"; - /** The 'basdir' property name. */ - public static final String BASEDIR = "basedir"; - /** Property name of the persistence location. */ - public static final String LOCATION = "location"; - /** The location where this project is persisted. */ - private URL _location = null; - - /** - * Default ctor. - * - */ - public ACSProjectElement() { - } - - /** - * Get the type that this BeanInfo represents. - * - * @return Type. - */ - public Class getType() { - return ACSProjectElement.class; - } - - /** - * Get the name of the default target. - * - * @return Default target name. - */ - public String getDefault() { - return getAttribute(DEFAULT); - } - - /** - * Set the name of the default target. - * - * @param def Name of the default target. - */ - public void setDefault(String def) { - String old = getDefault(); - setAttribute(DEFAULT, def); - firePropertyChange(DEFAULT, old, def); - } - - /** - * Get the specified base directory for the build. - * - * @return Base directory - */ - public String getBasedir() { - return getAttribute(BASEDIR); - } - - /** - * Set the base directory for builds. - * - * @param baseDir Build base directory. - */ - public void setBasedir(String baseDir) { - String old = getBasedir(); - setAttribute(BASEDIR, baseDir); - firePropertyChange(BASEDIR, old, baseDir); - } - - /** - * Get the location where this project is persisted. - * - * @return Saved location, or null if not persisted. - */ - public URL getLocation() { - return _location; - } - - /** - * Set the loction where the project is persisted. - * - * @param location Location of project. - */ - public void setLocation(URL location) { - URL old = _location; - _location = location; - firePropertyChange(LOCATION, old, _location); - } - - /** - * Set the loction where the project is persisted. - * - * @param location Location of project as a file. - */ - public void setLocation(File location) { - try { - setLocation(new URL("file", null, location.getAbsolutePath())); - } - catch(java.net.MalformedURLException ex) { - // No reason why this should happen. - // xxx Log me. - ex.printStackTrace(); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSProjectElementBeanInfo.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSProjectElementBeanInfo.java deleted file mode 100644 index 3903a77bf..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSProjectElementBeanInfo.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import org.apache.tools.ant.gui.customizer.DynamicCustomizer; -import java.beans.*; - -/** - * BeanInfo for the ACSProjectElement class. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ACSProjectElementBeanInfo extends BaseBeanInfo { - /** - * Default ctor. - * - */ - public ACSProjectElementBeanInfo() { - } - - /** - * Get the type that this BeanInfo represents. - * - * @return Type. - */ - public Class getType() { - return ACSProjectElement.class; - } - - /** - * Get the customizer type. - * - * @return Customizer type. - */ - public Class getCustomizerType() { - return Customizer.class; - } - - /** - * Get the property descriptors. - * - * @return Property descriptors. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - PropertyDescriptor[] retval = null; - - try { - retval = new PropertyDescriptor[] { - new PropertyDescriptor(ACSProjectElement.NAME, - ACSProjectElement.class), - new PropertyDescriptor(ACSProjectElement.DESCRIPTION, - ACSProjectElement.class), - new PropertyDescriptor(ACSProjectElement.DEFAULT, - ACSProjectElement.class), - new PropertyDescriptor(ACSProjectElement.BASEDIR, - ACSProjectElement.class) - - }; - retval[0].setDisplayName(getResources().getString( - getClass(),ACSProjectElement.NAME)); - retval[1].setDisplayName(getResources().getString( - getClass(),ACSProjectElement.DESCRIPTION)); - retval[2].setDisplayName(getResources().getString( - getClass(),ACSProjectElement.DEFAULT)); - retval[3].setDisplayName(getResources().getString( - getClass(),ACSProjectElement.BASEDIR)); - - setSortingOrder(retval); - } - catch(IntrospectionException ex) { - ex.printStackTrace(); - throw new Error(ex.toString()); - } - - return retval; - } - - /** Customizer for this bean info. */ - public static class Customizer extends DynamicCustomizer { - public Customizer() { - super(ACSProjectElement.class); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSPropertyElement.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSPropertyElement.java deleted file mode 100644 index 9e13cafa1..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSPropertyElement.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import com.sun.xml.tree.ElementNode; - -/** - * Element containing a property definition. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ACSPropertyElement extends ACSDtdDefinedElement { - /** The 'name' property name. */ - public static final String NAME = "name"; - /** The 'value' property name. */ - public static final String VALUE = "value"; - /** The file to load properties from. */ - public static final String FILE = "file"; - - /** - * Default ctor. - * - */ - public ACSPropertyElement() { - } - - /** - * Get the display name of this. - * - * @return Display name. - */ - public String getDisplayName() { - String file = getFile(); - - if(file == null || file.trim().length() == 0) { - return getName(); - } - else { - return "file: " + file; - } - } - - /** - * Get the property name. - * - * @return Property name. - */ - public String getName() { - return getAttribute(NAME); - } - - /** - * Set the property name. - * - * @param name Property name. - */ - public void setName(String name) { - String old = getName(); - setAttribute(NAME, name); - firePropertyChange(NAME, old, name); - } - - /** - * Get the property value. - * - * @return Property value. - */ - public String getValue() { - return getAttribute(VALUE); - } - - /** - * Set the property value. - * - * @param name Property value. - */ - public void setValue(String value) { - String old = getValue(); - setAttribute(VALUE, value); - firePropertyChange(VALUE, old, value); - } - - /** - * Get the external property file. - * - * @return Property file. - */ - public String getFile() { - return getAttribute(FILE); - } - - /** - * Set the external property file. - * - * @param name Property file. - */ - public void setFile(String file) { - String old = getFile(); - setAttribute(FILE, file); - firePropertyChange(FILE, old, file); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSPropertyElementBeanInfo.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSPropertyElementBeanInfo.java deleted file mode 100644 index 0c9872293..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSPropertyElementBeanInfo.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import org.apache.tools.ant.gui.customizer.DynamicCustomizer; -import java.beans.*; - -/** - * BeanInfo for the ACSPropertyElement class. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ACSPropertyElementBeanInfo extends BaseBeanInfo { - /** - * Default ctor. - * - */ - public ACSPropertyElementBeanInfo() { - } - - /** - * Get the type that this BeanInfo represents. - * - * @return Type. - */ - public Class getType() { - return ACSPropertyElement.class; - } - - /** - * Get the customizer type. - * - * @return Customizer type. - */ - public Class getCustomizerType() { - return Customizer.class; - } - - /** - * Get the property descriptors. - * - * @return Property descriptors. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - PropertyDescriptor[] retval = null; - - try { - retval = new PropertyDescriptor[] { - new PropertyDescriptor(ACSPropertyElement.FILE, - ACSPropertyElement.class), - new PropertyDescriptor(ACSPropertyElement.NAME, - ACSPropertyElement.class), - new PropertyDescriptor(ACSPropertyElement.VALUE, - ACSPropertyElement.class) - }; - - retval[0].setDisplayName(getResources().getString( - getClass(),ACSPropertyElement.FILE)); - retval[1].setDisplayName(getResources().getString( - getClass(),ACSPropertyElement.NAME)); - retval[2].setDisplayName(getResources().getString( - getClass(),ACSPropertyElement.VALUE)); - - setSortingOrder(retval); - } - catch(IntrospectionException ex) { - ex.printStackTrace(); - throw new Error(ex.toString()); - } - - return retval; - } - - /** Customizer for this bean info. */ - public static class Customizer extends DynamicCustomizer { - public Customizer() { - super(ACSPropertyElement.class); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSTargetElement.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSTargetElement.java deleted file mode 100644 index d531d5503..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSTargetElement.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import com.sun.xml.tree.ElementNode; -import java.util.StringTokenizer; - -/** - * Class representing a build target. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ACSTargetElement extends ACSNamedElement implements Cloneable{ - - /** Dependency property name. */ - public static final String DEPENDS = "depends"; - /** 'if' clause property name. */ - public static final String IF = "if"; - /** 'unless' clause property name. */ - public static final String UNLESS = "unless"; - - /** - * Default ctor. - * - */ - public ACSTargetElement() { - - } - - /** - * Get the set of dependency names. - * - * @return Dependency names. - */ - public String[] getDepends() { - String depends = getAttribute(DEPENDS); - StringTokenizer tok = new StringTokenizer(depends,","); - String[] retval = new String[tok.countTokens()]; - for(int i = 0; i < retval.length; i++) { - retval[i] = tok.nextToken().trim(); - } - - return retval; - } - - /** - * Set the list of dependency names. - * - * @param depends Dependency names. - */ - public void setDepends(String[] depends) { - String old = getAttribute(DEPENDS); - StringBuffer buf = new StringBuffer(); - for(int i = 0; depends != null && i < depends.length; i++) { - buf.append(depends[i]); - if(i < depends.length - 1) { - buf.append(", "); - } - } - setAttribute(DEPENDS, buf.toString()); - firePropertyChange(DEPENDS, old, buf.toString()); - } - - /** - * Get the 'if' clause. - * - * @return 'if' clause. - */ - public String getIf() { - return getAttribute(IF); - } - - /** - * Set the 'if' clause. - * - * @param val 'if' clause value. - */ - public void setIf(String val) { - String old = getIf(); - setAttribute(IF, val); - firePropertyChange(IF, old, val); - } - - /** - * Get the 'unless' clause. - * - * @return 'unless' clause. - */ - public String getUnless() { - return getAttribute(UNLESS); - } - - /** - * Set the 'unless' clause. - * - * @param val 'unless' clase value. - */ - public void setUnless(String val) { - String old = getUnless(); - setAttribute(UNLESS, val); - firePropertyChange(UNLESS, old, val); - } - - /** - * Copys the depends of a given target to the current. - * - * @param Source target for the copy operation. - */ - public void copyDependsFromTarget(ACSTargetElement newTarget) { - setDepends(newTarget.getDepends()); - } - - /** - * Copys the depends of a given target to the current. - * I can't override clone, because I need an ACSTargetElement - * to be returned! - * - * @return A clones target element - */ - public ACSTargetElement getClone() { - ACSTargetElement retVal = null; - try { - retVal = (ACSTargetElement)clone(); - retVal.setDepends(getDepends()); - } catch (java.lang.CloneNotSupportedException ex) { - // Cannot occur, for ACSTarget implements Clonable! - } - return retVal; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSTargetElementBeanInfo.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSTargetElementBeanInfo.java deleted file mode 100644 index 1e17d4a20..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSTargetElementBeanInfo.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; -import org.apache.tools.ant.gui.customizer.DynamicCustomizer; - -import java.beans.*; - -/** - * BeanInfo for the ACSTargetElement class. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ACSTargetElementBeanInfo extends BaseBeanInfo { - /** - * Default ctor. - * - */ - public ACSTargetElementBeanInfo() { - } - - /** - * Get the type that this BeanInfo represents. - * - * @return Type. - */ - public Class getType() { - return ACSTargetElement.class; - } - - /** - * Get the customizer type. - * - * @return Customizer type. - */ - public Class getCustomizerType() { - return Customizer.class; - } - - /** - * Get the property descriptors. - * - * @return Property descriptors. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - PropertyDescriptor[] retval = null; - - try { - retval = new PropertyDescriptor[] { - new PropertyDescriptor(ACSTargetElement.NAME, - ACSTargetElement.class), - new PropertyDescriptor(ACSTargetElement.DESCRIPTION, - ACSTargetElement.class), - new PropertyDescriptor(ACSTargetElement.DEPENDS, - ACSTargetElement.class, - "getClone", "copyDependsFromTarget"), - new PropertyDescriptor(ACSTargetElement.IF, - ACSTargetElement.class), - new PropertyDescriptor(ACSTargetElement.UNLESS, - ACSTargetElement.class), - new PropertyDescriptor(ACSTargetElement.XML_STRING, - ACSTargetElement.class, - "getXMLString", null) - }; - - // Set display names. - retval[0].setDisplayName(getResources().getString( - getClass(),ACSTargetElement.NAME)); - retval[1].setDisplayName(getResources().getString( - getClass(),ACSTargetElement.DESCRIPTION)); - retval[2].setDisplayName(getResources().getString( - getClass(),ACSTargetElement.DEPENDS)); - retval[3].setDisplayName(getResources().getString( - getClass(),ACSTargetElement.IF)); - retval[4].setDisplayName(getResources().getString( - getClass(),ACSTargetElement.UNLESS)); - retval[5].setDisplayName(getResources().getString( - getClass(),ACSTargetElement.XML_STRING)); - - setSortingOrder(retval); - } - catch(IntrospectionException ex) { - ex.printStackTrace(); - throw new Error(ex.toString()); - } - - return retval; - } - - - /** Customizer for this bean info. */ - public static class Customizer extends DynamicCustomizer { - static { - PropertyEditorManager.registerEditor( - org.apache.tools.ant.gui.acs.ACSTargetElement.class, org.apache.tools.ant.gui.modules.edit.DependentTargetPropertyEditor.class); - } - - public Customizer() { - super(ACSTargetElement.class); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSTaskElement.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSTaskElement.java deleted file mode 100644 index 42ef9bc80..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSTaskElement.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import org.w3c.dom.Node; -import org.w3c.dom.NamedNodeMap; -import java.util.*; - -/** - * Element containing a property definition. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ACSTaskElement extends ACSTreeNodeElement { - /** Property name for the task type. */ - public static final String TASK_TYPE = "taskType"; - /** Property name for attributes. It's called "namedValues" so - * it doesn't collide with the Node.getAttributes() method. */ - public static final String NAMED_VALUES = "namedValues"; - - /** - * Default ctor. - * - */ - public ACSTaskElement() { - } - - /** - * Get the task type. - * - * @return Task type. - */ - public String getTaskType() { - return getTagName(); - } - - /** - * Set the task type. - * - * @param type Type name. - */ - public void setTaskType(String type) { - setTag(type); - } - - /** - * Get the attributes (named value mappings). This method is not named - * getAttributes() because there is already a method of that name in - * the Node interface. - * - * @return Name-value mappings. - */ - public Properties getNamedValues() { - Properties retval = new Properties(); - - NamedNodeMap attribs = getAttributes(); - for(int i = 0, len = attribs.getLength(); i < len; i++) { - Node n = attribs.item(i); - retval.setProperty(n.getNodeName(), n.getNodeValue()); - } - return retval; - } - - - /** - * Set the attributes. This method sets the Node attirbutes using - * the given Map containing name-value pairs. - * - * @param attributes New attribute set. - */ - public void setNamedValues(Properties props) { - // XXX this code really sucks. It is really annoying that the - // DOM interfaces don't have a general "setAttributes()" or - // "removeAllAttributes()" method, but instead make you - // remove each attribute individually, or require you to figure - // out what the differences are between the two. - - // Although this is very inefficient, I'm taking the conceptually - // simplistic approach to this and brute force removing the existing - // set and replacing it with a brand new set. If this becomes a - // performance concern (which I doubt it will) it can be optimized - // later. - - Properties old = getNamedValues(); - - Enumeration enum = old.propertyNames(); - while(enum.hasMoreElements()) { - String name = (String) enum.nextElement(); - removeAttribute(name); - } - - enum = props.propertyNames(); - while(enum.hasMoreElements()) { - String key = (String) enum.nextElement(); - setAttribute(key, props.getProperty(key)); - } - - firePropertyChange(NAMED_VALUES, old, props); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSTaskElementBeanInfo.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSTaskElementBeanInfo.java deleted file mode 100644 index 59a23ab79..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSTaskElementBeanInfo.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import org.apache.tools.ant.gui.customizer.DynamicCustomizer; -import java.beans.*; - -/** - * BeanInfo for the ACSTaskElement class. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ACSTaskElementBeanInfo extends BaseBeanInfo { - /** - * Default ctor. - * - */ - public ACSTaskElementBeanInfo() { - } - - /** - * Get the type that this BeanInfo represents. - * - * @return Type. - */ - public Class getType() { - return ACSTaskElement.class; - } - - /** - * Get the customizer type. - * - * @return Customizer type. - */ - public Class getCustomizerType() { - return Customizer.class; - } - - /** - * Get the property descriptors. - * - * @return Property descriptors. - */ - public PropertyDescriptor[] getPropertyDescriptors() { - PropertyDescriptor[] retval = null; - - try { - retval = new PropertyDescriptor[] { - new PropertyDescriptor(ACSTaskElement.TASK_TYPE, - ACSTaskElement.class, - "getTaskType", null), - new PropertyDescriptor(ACSTaskElement.NAMED_VALUES, - ACSTaskElement.class), - new PropertyDescriptor(ACSTaskElement.XML_STRING, - ACSTaskElement.class, - "getXMLString", null) - }; - - retval[0].setDisplayName(getResources().getString( - getClass(),ACSTaskElement.TASK_TYPE)); - retval[1].setDisplayName(getResources().getString( - getClass(),ACSTaskElement.NAMED_VALUES)); - retval[2].setDisplayName(getResources().getString( - getClass(),ACSTaskElement.XML_STRING)); - - setSortingOrder(retval); - } - catch(IntrospectionException ex) { - ex.printStackTrace(); - throw new Error(ex.toString()); - } - - return retval; - } - - /** Customizer for this bean info. */ - public static class Customizer extends DynamicCustomizer { - public Customizer() { - super(ACSTaskElement.class); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ACSTreeNodeElement.java b/src/antidote/org/apache/tools/ant/gui/acs/ACSTreeNodeElement.java deleted file mode 100644 index 70c1f020e..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ACSTreeNodeElement.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - - -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import com.sun.xml.tree.ElementNode; -import javax.swing.tree.TreeNode; -import java.util.*; - -/** - * Abstract base class for all ACSElement classes that are also tree node. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public abstract class ACSTreeNodeElement extends ACSElement { - -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/BaseBeanInfo.java b/src/antidote/org/apache/tools/ant/gui/acs/BaseBeanInfo.java deleted file mode 100644 index 5168351d9..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/BaseBeanInfo.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - -import org.apache.tools.ant.gui.core.ResourceManager; -import org.apache.tools.ant.gui.customizer.DynamicCustomizer; -import java.beans.*; -import javax.swing.ImageIcon; -import java.awt.Image; - -/** - * Abstract base class for ACS BeanInfo classes. - * - * @version $Revision$ - * @author Simeon Fitch - */ -abstract class BaseBeanInfo extends SimpleBeanInfo { - /** Property name for specifiying a sorting order. */ - public static final String SORT_ORDER = DynamicCustomizer.SORT_ORDER; - /** Resource provider for bean info. */ - private static ResourceManager _resources = new ResourceManager(); - - /** Icon for this. */ - private Image _icon = null; - - /** - * Default ctor. - * - */ - protected BaseBeanInfo() { - // Load the icon. - ImageIcon img = _resources.getImageIcon(getClass(), "icon"); - if(img != null) { - _icon = img.getImage(); - } - } - - /** - * Get the local resources. - * - * @return Resources. - */ - ResourceManager getResources() { - return _resources; - } - - /** - * Get the bean descriptor. - * - * @return Bean descriptor. - */ - public BeanDescriptor getBeanDescriptor() { - return new ACSBeanDescriptor(this); - } - - /** - * Get the icon for displaying this bean. - * - * @param kind Kind of icon. XXX currently ignored - * @return Image for bean, or null if none. - */ - public Image getIcon(int kind) { - // XXX kind is currently ignored. - return _icon; - } - - /** - * Set the sorting order property of the given objects based - * on the order that they appear in the array. - * - * @param vals FeatureDescriptors to set sorting order property for. - */ - protected void setSortingOrder(FeatureDescriptor[] vals) { - for(int i = 0; i < vals.length; i++) { - vals[i].setValue(SORT_ORDER, new Integer(i)); - } - } - - /** - * Get the type that this BeanInfo represents. - * - * @return Type. - */ - public abstract Class getType(); - - /** - * Get the type of the customizer to use. - * - * @return Customizer to use. - */ - public abstract Class getCustomizerType(); - - /** - * Gets the beans PropertyDescriptors. - * - * @return An array of PropertyDescriptors describing the editable - * properties supported by this bean. May return null if the - * information should be obtained by automatic analysis. - *

    - * If a property is indexed, then its entry in the result array will - * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor. - * A client of getPropertyDescriptors can use "instanceof" to check - * if a given PropertyDescriptor is an IndexedPropertyDescriptor. - */ - public abstract PropertyDescriptor[] getPropertyDescriptors(); - - -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ElementTreeModel.java b/src/antidote/org/apache/tools/ant/gui/acs/ElementTreeModel.java deleted file mode 100644 index ffe803463..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ElementTreeModel.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; - - -import javax.swing.tree.*; -import javax.swing.event.TreeModelListener; -import javax.swing.event.TreeModelEvent; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.apache.tools.ant.gui.acs.*; -import java.util.*; - -/** - * Provides a tree model view of the Project class. XXX This - * is a major hack right now that needs to be cleaned up. - * - * @version $Revision$ - * @author Simeon H.K. Fitch */ -public class ElementTreeModel implements TreeModel { - /** Root of the tree. */ - private ACSProjectElement _root = null; - /** List of listeners. */ - private List _listeners = new ArrayList(); - - public ElementTreeModel(ACSProjectElement root) { - _root = root; - } - - /** - * 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 _root; - } - - /** - * Gets the set of children that this tree model is interested in. - * NB: This is really inefficient, but may not be an issue given - * the number of times it is ultimately called. A profiler definately needs - * to be applied here. - * - * @param parent Parent to extract children from. - */ - private List getChildren(Node parent) { - NodeList children = parent.getChildNodes(); - int length = children.getLength(); - - List retval = new ArrayList(length); - for(int i = 0; i < length; i++) { - // XXX This is where we will eventually add dynamic filtering - // capabilities. - Node n = children.item(i); - if(n instanceof ACSTreeNodeElement) { - retval.add(n); - } - } - - return retval; - } - - /** - * Returns the child of parent at index index in the parent's - * child array. parent must be a node previously obtained from - * this data source. This should not return null if index - * is a valid index for parent (that is index >= 0 && - * index < getChildCount(parent)). - * - * @param parent a node in the tree, obtained from this data source - * @return the child of parent at index index - */ - public Object getChild(Object parent, int index) { - if(parent instanceof Node) { - Node n = (Node) parent; - List children = getChildren(n); - return children.get(index); - } - else { - return null; - } - } - - - /** - * Returns the number of children of parent. Returns 0 if the node - * is a leaf or if it has no children. parent 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 parent - */ - public int getChildCount(Object parent) { - if(parent instanceof Node) { - Node n = (Node) parent; - return getChildren(n).size(); - } - else { - return 0; - } - } - - /** - * Returns true if node is a leaf. It is possible for this method - * to return false even if node 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 node is a leaf - */ - public boolean isLeaf(Object node) { - if(node instanceof Node) { - Node n = (Node) node; - return getChildren(n).size() == 0; - } - else { - return true; - } - - } - - /** - * Returns the index of child in parent. - */ - public int getIndexOfChild(Object parent, Object child) { - if(parent instanceof Node && child instanceof Node) { - Node n = (Node) parent; - List children = getChildren(n); - int count = children.size(); - for(int i = 0; i < count; i++) { - if(children.get(i) == child) return i; - } - } - return -1; - } - - /** - * Messaged when the user has altered the value for the item identified - * by path to newValue. If newValue 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) { - // XXX What should the implementation be here? - fireNodeChanged((Node) path.getLastPathComponent()); - } - - - /** - * Adds a listener for the TreeModelEvent posted after the tree changes. - * - * @see #removeTreeModelListener - * @param l the listener to add - */ - public void addTreeModelListener(TreeModelListener l) { - _listeners.add(l); - } - - /** - * Removes a listener previously added with addTreeModelListener(). - * - * @see #addTreeModelListener - * @param l the listener to remove - */ - public void removeTreeModelListener(TreeModelListener l) { - _listeners.remove(l); - } - - /** - * Get the list of nodes from the root to the - * given node. - * - * @param startNode Node to get path for. - */ - public Node[] getPathToRoot(Node startNode) { - return getPathToRoot(startNode, 0); - } - - /** - * A recursive method for generating a list of nodes defining - * the path from the given node to the root. - * - * @param node Node to get path for. - * @param depth The number of calls taken towards the root. - */ - private Node[] getPathToRoot(Node node, int depth) { - Node[] retval = null; - - depth++; - if(node == _root || node.getParentNode() == null) { - retval = new Node[depth]; - } - else { - retval = getPathToRoot(node.getParentNode(), depth); - } - - retval[retval.length - depth] = node; - return retval; - } - - - /** - * Fire a node change event. - * - * @param node Node that changed. - */ - public void fireNodeChanged(Node node) { - TreeModelEvent event = new TreeModelEvent(this, getPathToRoot(node)); - - // XXX This doen't support modifying the list during dispatch... - Iterator it = _listeners.iterator(); - while(it.hasNext()) { - TreeModelListener l = (TreeModelListener) it.next(); - l.treeNodesChanged(event); - } - } - - /** - * Fire a node change event. - * - * @param node Node that changed. - */ - public void fireNodeAdded(Node node) { - Node parent = node.getParentNode(); - TreeModelEvent event = null; - if(parent == null) { - event = new TreeModelEvent(this, getPathToRoot(node)); - } - else { - Node[] path = getPathToRoot(parent); - int[] indicies = null; - Node[] children = new Node[] { node }; - - // XXX Right now we assume that the node was added at the end. - // This may not be the case in the future. - if(parent.getLastChild() == node) { - List filteredChildren = getChildren(parent); - indicies = new int[] { filteredChildren.indexOf(node) }; - } - else { - throw new UnsupportedOperationException( - "Haven't implemented non-append notification yet."); - } - - event = new TreeModelEvent(this, path, indicies, children); - } - - // XXX This doen't support modifying the list during dispatch... - Iterator it = _listeners.iterator(); - while(it.hasNext()) { - TreeModelListener l = (TreeModelListener) it.next(); - l.treeNodesInserted(event); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/ElementTreeSelectionModel.java b/src/antidote/org/apache/tools/ant/gui/acs/ElementTreeSelectionModel.java deleted file mode 100644 index 677fc7177..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/ElementTreeSelectionModel.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.acs; -import org.apache.tools.ant.gui.acs.ACSElement; -import org.apache.tools.ant.gui.acs.ACSTargetElement; - -import javax.swing.tree.DefaultTreeSelectionModel; -import javax.swing.tree.TreePath; -import java.util.*; - -/** - * Selection model for the currently selected targets. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ElementTreeSelectionModel extends DefaultTreeSelectionModel { - /** - * Default ctor. - * - */ - public ElementTreeSelectionModel() { - setSelectionMode(DISCONTIGUOUS_TREE_SELECTION); - } - - /** - * Convenience method for providing the set of currently selected - * elements. NB: It returns all of the nodes in the selection path, - * so the root node will be a selected element whenever a child is - * selected. - * - * @return the currently selected elements. - */ - public ACSElement[] getSelectedElements() { - TreePath[] path = getSelectionPaths(); - List values = new LinkedList(); - for(int i = 0; path != null && i < path.length; i++) { - TreePath curr = path[i]; - for(int j = 0; j < curr.getPathCount(); j++) { - Object item = curr.getPathComponent(j); - if(item instanceof ACSElement) { - values.add(item); - } - } - } - - ACSElement[] retval = new ACSElement[values.size()]; - values.toArray(retval); - return retval; - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/acs/acs-element.properties b/src/antidote/org/apache/tools/ant/gui/acs/acs-element.properties deleted file mode 100644 index 073d09725..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/acs-element.properties +++ /dev/null @@ -1,14 +0,0 @@ -# -# Property file mapping DOM nodes to Java class names. -# - -# The default element -*Element=org.apache.tools.ant.gui.acs.ACSDtdDefinedElement - -# Specific elements. -project=org.apache.tools.ant.gui.acs.ACSProjectElement -property=org.apache.tools.ant.gui.acs.ACSPropertyElement -target=org.apache.tools.ant.gui.acs.ACSTargetElement -task=org.apache.tools.ant.gui.acs.ACSTaskElement - - diff --git a/src/antidote/org/apache/tools/ant/gui/acs/package.html b/src/antidote/org/apache/tools/ant/gui/acs/package.html deleted file mode 100644 index 73f3f6e14..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/package.html +++ /dev/null @@ -1,9 +0,0 @@ -

    Ant Construction Set

    - -

    This package contains the tools for constructing and manipulating an Ant -build file

    - -

    NB: Requires the Java API for XML -Parsing from Sun.

    - - diff --git a/src/antidote/org/apache/tools/ant/gui/acs/project-ext.dtd b/src/antidote/org/apache/tools/ant/gui/acs/project-ext.dtd deleted file mode 100644 index abbac97e7..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/project-ext.dtd +++ /dev/null @@ -1,255 +0,0 @@ - - - - - -%share-file; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/antidote/org/apache/tools/ant/gui/acs/project.dtd b/src/antidote/org/apache/tools/ant/gui/acs/project.dtd deleted file mode 100644 index 84ae3aa07..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/project.dtd +++ /dev/null @@ -1,424 +0,0 @@ - - - - - - - -%share-file; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/antidote/org/apache/tools/ant/gui/acs/share.dtd b/src/antidote/org/apache/tools/ant/gui/acs/share.dtd deleted file mode 100644 index 48561105b..000000000 --- a/src/antidote/org/apache/tools/ant/gui/acs/share.dtd +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/antidote/org/apache/tools/ant/gui/command/AboutCmd.java b/src/antidote/org/apache/tools/ant/gui/command/AboutCmd.java deleted file mode 100644 index cfc1b4471..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/AboutCmd.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.About; -import java.awt.Window; -import java.awt.event.WindowEvent; - - -/** - * Handler for the About command. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class AboutCmd extends AbstractCommand { - - /** - * Standard constructor. - * - */ - public AboutCmd(AppContext context) { - super(context); - } - - /** - * Show the about box. - * - */ - public void run() { - new About(getContext()); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/AbstractCommand.java b/src/antidote/org/apache/tools/ant/gui/command/AbstractCommand.java deleted file mode 100644 index 20d21373f..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/AbstractCommand.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; - - -/** - * Convenience base class for Command implementations. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public abstract class AbstractCommand implements Command { - /** Application context. */ - private AppContext _context = null; - - /** - * Default ctor. - * - */ - protected AbstractCommand(AppContext context) { - _context = context; - } - - /** - * Get the application context that was provided to setContext(); - * - * @return Application context. - */ - protected AppContext getContext() { - return _context; - } - - /** - * Run the command. From interface Runnable. - * - */ - public abstract void run(); - -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/BuildCmd.java b/src/antidote/org/apache/tools/ant/gui/command/BuildCmd.java deleted file mode 100644 index 3be775e49..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/BuildCmd.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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. -q * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.ErrorEvent; -import org.apache.tools.ant.gui.acs.ACSProjectElement; -import org.apache.tools.ant.gui.acs.ACSTargetElement; -import org.apache.tools.ant.gui.event.ShowConsoleEvent; - -/** - * Starts an Ant build. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class BuildCmd extends AbstractCommand { - - /** Project to build. */ - private ACSProjectElement _project = null; - /** Targets to build. */ - private ACSTargetElement[] _targets = null; - - /** - * Standard ctor. - * - */ - public BuildCmd(AppContext context) { - super(context); - } - - /** - * Set the specific project to build (instead of the default). - * - * @param project Project to build. - */ - public void setProject(ACSProjectElement project) { - _project = project; - } - - /** - * Set the specific targets to build (instead of the default). - * - * @param targets Array of targets to build. - */ - public void setTargets(ACSTargetElement[] targets) { - _targets = targets; - } - - /** - * Start the Ant build. - * - */ - public void run() { - - // Show the build console - getContext().getEventBus().postEvent( - new ShowConsoleEvent(getContext())); - - if(_project == null) { - _project = getContext().getSelectionManager().getSelectedProject(); - } - - if(_targets == null) { - _targets = getContext().getSelectionManager().getSelectedTargets(); - } - - if(_project != null) { - try { - getContext().getProjectManager().build(_project, _targets); - } - catch(Throwable ex) { - getContext().getEventBus().postEvent( - new ErrorEvent(getContext(), ex)); - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/ChangeLookAndFeelCmd.java b/src/antidote/org/apache/tools/ant/gui/command/ChangeLookAndFeelCmd.java deleted file mode 100644 index 68a35d6d3..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/ChangeLookAndFeelCmd.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.util.ChangeLookAndFeel; - -/** - * ChangeLookAndFeel command. - * - * @version $Revision$ - * @author Erik Meade - * @author Simeon Fitch - */ -public class ChangeLookAndFeelCmd extends AbstractCommand { - /** - * Standard ctor. - * - */ - public ChangeLookAndFeelCmd(AppContext context) { - super(context); - } - - /** - * Successfully do nothing. - * - */ - public void run() { - new ChangeLookAndFeel(getContext()); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/CloseCmd.java b/src/antidote/org/apache/tools/ant/gui/command/CloseCmd.java deleted file mode 100644 index fa050b15b..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/CloseCmd.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.ProjectClosedEvent; -import org.apache.tools.ant.gui.event.ProjectSelectedEvent; -import org.apache.tools.ant.gui.acs.ACSProjectElement; - - -/** - * Handler for the close command. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class CloseCmd extends AbstractCommand { - - /** Project to close. */ - private ACSProjectElement _project = null; - - /** - * Standard constructor. - * - */ - public CloseCmd(AppContext context) { - super(context); - } - - /** - * Set the specific project to close (instead of the default). - * - * @param project Project to close. - */ - public void setProject(ACSProjectElement project) { - _project = project; - } - - /** - * Send a close event to the parent window. - * - */ - public void run() { - if(_project == null) { - _project = getContext().getSelectionManager().getSelectedProject(); - } - - if(_project != null) { - getContext().getProjectManager().close(_project); - getContext().getEventBus().postEvent( - new ProjectClosedEvent(getContext())); - - ACSProjectElement[] open = - getContext().getProjectManager().getOpen(); - if(open != null && open.length > 0) { - getContext().getEventBus().postEvent( - new ProjectSelectedEvent(getContext(), open[0])); - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/Command.java b/src/antidote/org/apache/tools/ant/gui/command/Command.java deleted file mode 100644 index 30ef35eaf..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/Command.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; - - - -/** - * Interface for commands. - * Details TBD - * - * @version $Revision$ - * @author Simeon Fitch - */ -public interface Command extends Runnable { - /** - * Run the command. From interface Runnable. - * - */ - void run(); -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/DeleteElementCmd.java b/src/antidote/org/apache/tools/ant/gui/command/DeleteElementCmd.java deleted file mode 100644 index 10a02d8c2..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/DeleteElementCmd.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import java.util.EventObject; -import javax.swing.JOptionPane; -import org.w3c.dom.Node; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.DeleteElementEvent; -import org.apache.tools.ant.gui.acs.*; - -/** - * Command for removing the selected element. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class DeleteElementCmd extends AbstractCommand { - - /** - * Standard ctor. - * - * @param context Application context. - */ - public DeleteElementCmd(AppContext context) { - super(context); - } - - /** - * Delete the selected element. - */ - public void run() { - - // Ask "Are you sure?" - int option = JOptionPane.showConfirmDialog(null, "Are You Sure?", - "Confirm Delete", JOptionPane.YES_NO_OPTION); - - if (option == JOptionPane.YES_OPTION) { - // Find the element to remove - ACSElement[] vals = getContext().getSelectionManager(). - getSelectedElements(); - if(vals != null && vals.length > 0) { - Node item = vals[vals.length - 1]; - - // Find the parent and remove the element. - Node parent = item.getParentNode(); - parent.removeChild(item); - - // Notify the tree the element was removed. - DeleteElementEvent event = new DeleteElementEvent( - getContext(), (ACSElement) parent); - getContext().getEventBus().postEvent(event); - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/DisplayErrorCmd.java b/src/antidote/org/apache/tools/ant/gui/command/DisplayErrorCmd.java deleted file mode 100644 index d66f79443..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/DisplayErrorCmd.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.util.StackFrame; -import javax.swing.*; -import java.awt.FlowLayout; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** - * Command for displaying an arbitrary error message to the user. - * - * @version $Revision$ - * @author Simeon H.K. Fitch - */ -public class DisplayErrorCmd extends AbstractCommand { - /** Text description of error. */ - private String _message = null; - /** Throwable associated with the error. */ - private Throwable _ex = null; - - /** - * Standard ctor. - * - * @param context Application context. - */ - public DisplayErrorCmd(AppContext context) { - this(context, null, null); - } - - /** - * No Throwable constructor. - * - * @param context Application context. - * @param message Error message. - */ - public DisplayErrorCmd(AppContext context, String message) { - this(context, message, 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) { - super(context); - _message = message; - _ex = ex; - } - - /** - * Set the error message. - * - * @param message Error message. - */ - public void setMessage(String message) { - _message = message; - } - - /** - * Set the throwable associated with the error. - * - * @param ex Throwable associated with the error. - */ - public void setThrowable(Throwable ex) { - _ex = ex; - } - - /** - * Display the error. - * - */ - public void run() { - String title = getContext().getResources(). - getString(getClass(), "title"); - - JOptionPane.showMessageDialog( - getContext().getParentFrame(), new MsgPanel(), - title, JOptionPane.ERROR_MESSAGE); - } - - // Panel for assembling the error information. - private class MsgPanel extends JPanel implements ActionListener { - public MsgPanel() { - setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - add(new JLabel(_message)); - if(_ex != null) { - add(new JLabel(_ex.getMessage())); - JButton b = new JButton(getContext().getResources(). - getString(DisplayErrorCmd.class, - "expand")); - b.addActionListener(this); - add(Box.createVerticalStrut(20)); - add(b); - } - } - // Called when the user clicks the expand button. - public void actionPerformed(ActionEvent e) { - JComponent source = (JComponent) e.getSource(); - JComponent parent = (JComponent) source.getParent(); - parent.remove(source); - JTextArea text = new JTextArea(); - text.setEditable(false); - text.setText(StackFrame.toString(_ex)); - parent.add(new JScrollPane(text)); - SwingUtilities.windowForComponent(parent).pack(); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/EmacsNotifyCmd.java b/src/antidote/org/apache/tools/ant/gui/command/EmacsNotifyCmd.java deleted file mode 100644 index 38813ebbb..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/EmacsNotifyCmd.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.ide.EmacsNotifier; - -/** - * Toggle on or off the sending of error events to emacs so that - * it can display the source of the error. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class EmacsNotifyCmd extends AbstractCommand { - /** A global notifier can be used as it stores no state. */ - private static EmacsNotifier _notifier = new EmacsNotifier(); - - /** - * Standard ctor. - * - * @param context Application context. - */ - public EmacsNotifyCmd(AppContext context) { - super(context); - } - - /** - * Turn on or off the notifying of emacs. - * - */ - public void run() { - if(getContext().getProjectManager(). - isRegisteredBuildListener(_notifier)) { - getContext().getProjectManager().removeBuildListener(_notifier); - } - else { - getContext().getProjectManager().addBuildListener(_notifier); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/ExitCmd.java b/src/antidote/org/apache/tools/ant/gui/command/ExitCmd.java deleted file mode 100644 index 774225e10..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/ExitCmd.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.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$ - * @author Simeon Fitch - */ -public class ExitCmd extends AbstractCommand { - /** - * Standard constructor. - * - * @param context Application context. - */ - public ExitCmd(AppContext context) { - super(context); - } - - /** - * Send a close event to the parent window. - * - */ - public void run() { - // Manually send a window close event to the window. - WindowUtils.sendCloseEvent(getContext().getParentFrame()); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/LoadFileCmd.java b/src/antidote/org/apache/tools/ant/gui/command/LoadFileCmd.java deleted file mode 100644 index bf1289fde..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/LoadFileCmd.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.ErrorEvent; -import org.apache.tools.ant.gui.event.NewProjectEvent; -import org.apache.tools.ant.gui.acs.ACSProjectElement; -import java.io.File; -import java.io.IOException; - -/** - * Command for reading in a build file and initializing the data model. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class LoadFileCmd extends AbstractCommand { - /** The file to load. */ - private File _file = null; - - /** - * Standard ctor. - * - * @param context Application context. - */ - public LoadFileCmd(AppContext context) { - super(context); - } - - /** - * Set the file to load. - * - * @param file File to load. - */ - public void setFile(File file) { - _file = file; - } - - /** - * Open the file and load it. - * - */ - public void run() { - if(!_file.exists()) { - String message = getContext().getResources().getMessage( - getClass(), "noFile", new Object[] { _file.toString() }); - - getContext().getEventBus(). - postEvent(new ErrorEvent(getContext(), message)); - } - else { - try { - ACSProjectElement project = - getContext().getProjectManager().open(_file); - getContext().getEventBus().postEvent( - new NewProjectEvent(getContext(), project)); - } - catch(Exception ex) { - String message = getContext().getResources().getMessage( - getClass(), "loadError", - new Object[] { _file.toString() }); - - getContext().getEventBus(). - postEvent(new ErrorEvent(getContext(), message, ex)); - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/NewElementCmd.java b/src/antidote/org/apache/tools/ant/gui/command/NewElementCmd.java deleted file mode 100644 index f5480278c..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/NewElementCmd.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import java.util.EventObject; -import javax.swing.AbstractButton; -import javax.swing.Action; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.NewBaseElementEvent; -import org.apache.tools.ant.gui.event.RefreshDisplayEvent; -import org.apache.tools.ant.gui.acs.*; -import org.apache.tools.ant.gui.util.WindowUtils; -import org.apache.tools.ant.gui.core.AntAction; - -/** - * Command for creating a new propertyh. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class NewElementCmd extends AbstractCommand { - /** New count for this session. Used to create default names, - * numbered as a convenience. */ - private static int _count = 1; - private EventObject _event = null; - - /** - * Standard ctor. - * - * @param context Application context. - */ - public NewElementCmd(AppContext context, EventObject event) { - super(context); - _event = event; - } - - /** - * Creates a new xml element based on the button which - * was pressed. The button text may contain the name - * of the new element or a dialog box is presented which - * asks the user for the element type. - */ - public void run() { - - // Find which element is selected. - ACSElement[] vals = getContext().getSelectionManager(). - getSelectedElements(); - if(vals == null || vals.length == 0) { - return; - } - - // Find the text of the button which was pressed - // to determine the type of element to create. - Object source = _event.getSource(); - if (!(source instanceof AbstractButton)) { - return; - } - AbstractButton button = (AbstractButton) source; - String name = button.getText(); - - // Get the AntAction - String cmdStr = button.getActionCommand(); - AntAction antAction = getContext().getActions().getAction(cmdStr); - if (antAction == null) { - return; - } - - ACSElement e = vals[vals.length - 1]; - - // Should we prompt the user use the element type? - if (antAction.getName().equals(name)) { - - // Display the dialog box. - ACSDtdDefinedElement dtde = (ACSDtdDefinedElement) e; - NewElementDlg dlg = new NewElementDlg( - getContext().getParentFrame(), true); - dlg.setLists( - dtde.getPossibleChildren(ACSDocumentType.CORE_ELEMENT), - dtde.getPossibleChildren(ACSDocumentType.OPTIONAL_ELEMENT) ); - dlg.pack(); - WindowUtils.centerWindow(dlg); - dlg.setTitle("Select the new element type"); - dlg.setVisible(true); - - // Get the element type - if (dlg.getCancel()) { - name = ""; - } else { - name = dlg.getElementName(); - } - } - - if (name.length() > 0) { - // Create the new element - ACSElement retval = - ACSFactory.getInstance().createElement(e, name); - getContext().getEventBus().postEvent( - new NewBaseElementEvent(getContext(), retval)); - } else { - // Request a refresh so the popup menu is removed - // from the display. - getContext().getEventBus().postEvent( - new RefreshDisplayEvent(getContext())); - } - } -} - - - diff --git a/src/antidote/org/apache/tools/ant/gui/command/NewElementDlg.java b/src/antidote/org/apache/tools/ant/gui/command/NewElementDlg.java deleted file mode 100644 index 792ae7a1e..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/NewElementDlg.java +++ /dev/null @@ -1,429 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.gui.command; -import javax.swing.*; -import java.util.List; -import java.util.ArrayList; -import org.apache.tools.ant.gui.util.Collections; - -/** - * A Dialog which asks for a new xml element's type. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class NewElementDlg extends javax.swing.JDialog { - // Dialog's components - private javax.swing.JPanel _southPanel; - private javax.swing.JPanel _buttonPanel; - private javax.swing.JButton _buttonOK; - private javax.swing.JButton _buttonCancel; - private javax.swing.JCheckBox _optionalButton; - private javax.swing.JPanel _selectPanel; - private javax.swing.JPanel _panelData; - private javax.swing.JLabel _label; - private javax.swing.JTextField _elementText; - private javax.swing.JScrollPane _listScrollPane; - private javax.swing.JList _elementList; - /** set to true if cancel is pressed */ - private boolean _cancel = true; - /** holds the element type */ - private String _elementName; - /** list of core tasks */ - private List _coreElements; - /** list of optional tasks */ - private List _optionalElements; - /** list of tasks to display */ - private List _elements; - - /** - * Creates new form NewElementDlg - */ - public NewElementDlg(java.awt.Frame parent, boolean modal) { - super(parent, modal); - initComponents(); - enableButtons(); - } - - /** - * Fills the listbox with the input list. - */ - public void setLists(String[] coreElements, String[] optionalElements) { - - // Are there any items to display? - if ( (coreElements == null || coreElements.length == 0) && - (optionalElements == null || optionalElements.length == 0 ) ) { - - // Hide the list - _listScrollPane.setVisible(false); - _optionalButton.setVisible(false); - } else { - - // Are there any core elements? - if (coreElements == null) { - _coreElements = new ArrayList(); - - // Display the optional elements - _optionalButton.setSelected(true); - _optionalButton.setVisible(false); - } else { - // Create a sorted list of the core elements - List temp = Collections.fill(null, coreElements); - java.util.Collections.sort(temp); - _coreElements = temp; - } - - // Are there any optional elements? - if (optionalElements == null) { - _optionalElements = new ArrayList(); - - // Display the core elements - _optionalButton.setSelected(false); - _optionalButton.setVisible(false); - } else { - // Create a sorted list of the optional elements - List temp = Collections.fill(null, optionalElements); - java.util.Collections.sort(temp); - _optionalElements = temp; - } - - // Are the lists the same? - if (_optionalElements.containsAll(_coreElements) && - _coreElements.containsAll(_optionalElements) ) { - - // Hide the button - _optionalButton.setVisible(false); - } - } - enableButtons(); - } - - /** - * Returns true if cancel was pressed - */ - public boolean getCancel() { - return _cancel; - } - - /** - * Returns the entered element type - */ - public String getElementName() { - return _elementName; - } - - /** - * Enable or disable buttons - */ - private void enableButtons() { - - // Enable the OK button? - if (isInputValid()) { - _buttonOK.setEnabled(true); - } else { - _buttonOK.setEnabled(false); - } - - // Display the core or optional elements? - Object oldList = _elements; - if (_optionalButton.isSelected()) { - _elements = _optionalElements; - } else { - _elements = _coreElements; - } - - // Did the list change? - if (oldList != _elements) { - _elementList.setListData(_elements.toArray()); - } - } - - /** - * Returns true if the user input is valid. - */ - private boolean isInputValid() { - return ( isXMLName( _elementText.getText() ) ); - } - - /** - * Returns true if the value is a legal XML name. - * - * @param value the string being tested - */ - public boolean isXMLName (String value) - { - if (value == null || value.length() == 0) - return false; - - char c = value.charAt (0); - if (!isLetter (c) && c != '_' && c != ':') - return false; - for (int i = 1; i < value.length (); i++) - if (!isNameChar (value.charAt (i))) - return false; - return true; - } - - /** - * Returns true if the character is allowed to be a non-initial - * character in an XML name. - */ - public boolean isNameChar (char c) - { - if (isLetter (c)) - return true; - else if (c == '>') - return false; - else if (c >= '0' && c <= '9') - return true; - else if (c == '.' || c == '-' || c == '_' || c == ':') - return true; - else - return false; - } - - /** - * Returns true if the character is a letter. - */ - public boolean isLetter (char c) - { - if (c >= 'a' && c <= 'z') - return true; - if (c >= 'A' && c <= 'Z') - return true; - - return false; - } - - /** - * This method is called from within the constructor to - * initialize the form. - */ - private void initComponents() { - _southPanel = new javax.swing.JPanel(); - _buttonPanel = new javax.swing.JPanel(); - _buttonOK = new javax.swing.JButton(); - _buttonCancel = new javax.swing.JButton(); - _selectPanel = new javax.swing.JPanel(); - _panelData = new javax.swing.JPanel(); - _label = new javax.swing.JLabel(); - _elementText = new javax.swing.JTextField(); - _listScrollPane = new javax.swing.JScrollPane(); - _elementList = new javax.swing.JList(); - _optionalButton = new javax.swing.JCheckBox( - "show optional elements", false); - getContentPane().setLayout(new java.awt.BorderLayout(10, 10)); - addWindowListener(new java.awt.event.WindowAdapter() { - public void windowClosing(java.awt.event.WindowEvent evt) { - closeDialog(evt); - } - } - ); - - _southPanel.setLayout(new java.awt.FlowLayout(2, 2, 0)); - _southPanel.setPreferredSize(new java.awt.Dimension(156, 50)); - _southPanel.setMinimumSize(new java.awt.Dimension(154, 50)); - - _buttonPanel.setLayout(new java.awt.FlowLayout(1, 2, 0)); - _buttonPanel.setPreferredSize(new java.awt.Dimension(146, 50)); - _buttonPanel.setMinimumSize(new java.awt.Dimension(150, 50)); - _buttonPanel.setAlignmentY(0.0F); - _buttonPanel.setAlignmentX(0.0F); - - _buttonOK.setText("OK"); - _buttonOK.setPreferredSize(new java.awt.Dimension(50, 30)); - _buttonOK.setMaximumSize(new java.awt.Dimension(50, 30)); - _buttonOK.setMargin(new java.awt.Insets(10, 10, 10, 10)); - _buttonOK.setMinimumSize(new java.awt.Dimension(50, 30)); - _buttonOK.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - clickOK(evt); - } - } - ); - _buttonPanel.add(_buttonOK); - _buttonCancel.setText("Cancel"); - _buttonCancel.setPreferredSize(new java.awt.Dimension(70, 30)); - _buttonCancel.setMaximumSize(new java.awt.Dimension(60, 30)); - _buttonCancel.setMargin(new java.awt.Insets(10, 10, 10, 10)); - _buttonCancel.setMinimumSize(new java.awt.Dimension(60, 30)); - _buttonCancel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - clickCancel(evt); - } - } - ); - _buttonPanel.add(_buttonCancel); - _southPanel.add(_buttonPanel); - getContentPane().add(_southPanel, java.awt.BorderLayout.SOUTH); - _selectPanel.setLayout(new java.awt.BorderLayout(10, 10)); - _selectPanel.setBorder(new javax.swing.border.EtchedBorder()); - _label.setText("Element Type:"); - _label.setAlignmentX(0.5F); - _panelData.add(_label); - - - _elementText.setPreferredSize(new java.awt.Dimension(110, 25)); - _elementText.setMargin(new java.awt.Insets(2, 2, 2, 2)); - _elementText.setMinimumSize(new java.awt.Dimension(14, 25)); - _elementText.addKeyListener(new java.awt.event.KeyAdapter() { - public void keyReleased(java.awt.event.KeyEvent evt) { - _elementTextKeyReleased(evt); - } - } - ); - _panelData.add(_elementText); - - _selectPanel.add(_panelData, java.awt.BorderLayout.SOUTH); - - _elementList.setMaximumSize(new java.awt.Dimension(100, 20)); - _elementList.setMinimumSize(new java.awt.Dimension(10, 10)); - _elementList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - itemSelected(evt); - } - } - ); - _elementList.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - itemMouseClicked(evt); - } - } - ); - _listScrollPane.setViewportView(_elementList); - - _optionalButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); - _optionalButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - enableButtons(); - } - } - ); - - _selectPanel.add(_optionalButton, java.awt.BorderLayout.NORTH); - _selectPanel.add(_listScrollPane, java.awt.BorderLayout.CENTER); - getContentPane().add(_selectPanel, java.awt.BorderLayout.CENTER); - pack(); - } - - /** Called when a key is released */ - private void _elementTextKeyReleased(java.awt.event.KeyEvent evt) { - enableButtons(); - } - - /** Called when an item is selected from the list */ - private void itemSelected(javax.swing.event.ListSelectionEvent evt) { - // Update the text field - _elementText.setText((String) _elementList.getSelectedValue()); - enableButtons(); - } - - /** Called when the list is clicked */ - private void itemMouseClicked(java.awt.event.MouseEvent evt) { - - int count = evt.getClickCount(); - Object obj = _elementList.getSelectedValue(); - - // Double click on an item? - if (count == 2 && obj != null) { - - // Update the text field - _elementText.setText((String) _elementList.getSelectedValue()); - - // Process like OK was pressed - if (isInputValid()) { - clickOK(null); - } - } - } - - /** Called when the Cancel button is pressed */ - private void clickCancel(java.awt.event.ActionEvent evt) { - - // Make us invisible - setVisible(false); - dispose(); - - // Set the cancel flag - _cancel = true; - } - - /** Called when the OK button is pressed */ - private void clickOK(java.awt.event.ActionEvent evt) { - - // Make us invisible - setVisible(false); - dispose(); - - // Return selected item. - _cancel = false; - _elementName = _elementText.getText(); - } - - /** Closes the dialog */ - private void closeDialog(java.awt.event.WindowEvent evt) { - setVisible(false); - dispose(); - } - - /** - * Test the dialog - * - * @param args the command line arguments - */ - public static void main(String args[]) { - new NewElementDlg(new javax.swing.JFrame(), true).show(); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/NewProjectCmd.java b/src/antidote/org/apache/tools/ant/gui/command/NewProjectCmd.java deleted file mode 100644 index f43d78e7c..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/NewProjectCmd.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.NewProjectEvent; -import org.apache.tools.ant.gui.acs.ACSProjectElement; - -/** - * Command for creating a new project. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class NewProjectCmd extends AbstractCommand { - /** New project count for this session. Used to create default names, - * numbered as a convenience. */ - private static int _count = 1; - - /** - * Standard ctor. - * - * @param context Application context. - */ - public NewProjectCmd(AppContext context) { - super(context); - } - - /** - * Create a new project and make it active. - * - */ - public void run() { - ACSProjectElement project = - getContext().getProjectManager().createNew(); - project.setName(getContext().getResources(). - getString(getClass(), "defName") + " " + _count++); - getContext().getEventBus().postEvent( - new NewProjectEvent(getContext(), project)); - - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/NewPropertyCmd.java b/src/antidote/org/apache/tools/ant/gui/command/NewPropertyCmd.java deleted file mode 100644 index ee20902d2..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/NewPropertyCmd.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.NewPropertyEvent; -import org.apache.tools.ant.gui.acs.*; - -/** - * Command for creating a new propertyh. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class NewPropertyCmd extends AbstractCommand { - /** New count for this session. Used to create default names, - * numbered as a convenience. */ - private static int _count = 1; - - /** - * Standard ctor. - * - * @param context Application context. - */ - public NewPropertyCmd(AppContext context) { - super(context); - } - - /** - * Create a new property and make it active. - * - */ - public void run() { - ACSElement[] vals = getContext().getSelectionManager(). - getSelectedElements(); - if(vals != null && vals.length > 0) { - ACSPropertyElement retval = - ACSFactory.getInstance().createProperty(vals[vals.length - 1]); - getContext().getEventBus().postEvent( - new NewPropertyEvent(getContext(), retval)); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/NewTargetCmd.java b/src/antidote/org/apache/tools/ant/gui/command/NewTargetCmd.java deleted file mode 100644 index 3487d7eba..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/NewTargetCmd.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.NewTargetEvent; -import org.apache.tools.ant.gui.acs.*; - -/** - * Command for creating a new target. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class NewTargetCmd extends AbstractCommand { - /** New project count for this session. Used to create default names, - * numbered as a convenience. */ - private static int _count = 1; - - /** - * Standard ctor. - * - * @param context Application context. - */ - public NewTargetCmd(AppContext context) { - super(context); - } - - /** - * Create a new target and make it active. - * - */ - public void run() { - ACSProjectElement project = getContext().getSelectionManager(). - getSelectedProject(); - ACSTargetElement retval = - ACSFactory.getInstance().createTarget(project); - retval.setName(getContext().getResources(). - getString(getClass(), "defName") + " " + _count++); - getContext().getEventBus().postEvent( - new NewTargetEvent(getContext(), retval)); - - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/NewTaskCmd.java b/src/antidote/org/apache/tools/ant/gui/command/NewTaskCmd.java deleted file mode 100644 index e392fdcf9..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/NewTaskCmd.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.NewTaskEvent; -import org.apache.tools.ant.gui.acs.*; - -/** - * Command for creating a new task. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class NewTaskCmd extends AbstractCommand { - /** New count for this session. Used to create default names, - * numbered as a convenience. */ - private static int _count = 1; - - /** - * Standard ctor. - * - * @param context Application context. - */ - public NewTaskCmd(AppContext context) { - super(context); - } - - /** - * Create a new task and make it active. - * - */ - public void run() { - ACSTargetElement[] targets = getContext().getSelectionManager(). - getSelectedTargets(); - if(targets != null && targets.length > 0) { - ACSTaskElement retval = - ACSFactory.getInstance().createTask(targets[0]); - retval.setTaskType("javac"); - getContext().getEventBus().postEvent( - new NewTaskEvent(getContext(), retval)); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/NoOpCmd.java b/src/antidote/org/apache/tools/ant/gui/command/NoOpCmd.java deleted file mode 100644 index fc898fd8d..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/NoOpCmd.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; - -/** - * NoOp command. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class NoOpCmd extends AbstractCommand { - /** - * Standard ctor. - * - * @param context Application context. - */ - public NoOpCmd(AppContext context) { - super(context); - } - - /** - * Successfully do nothing. - * - */ - public void run() {} -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/OpenCmd.java b/src/antidote/org/apache/tools/ant/gui/command/OpenCmd.java deleted file mode 100644 index 192e3784c..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/OpenCmd.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.OpenRequestEvent; -import org.apache.tools.ant.gui.core.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$ - * @author Simeon Fitch - */ -public class OpenCmd extends AbstractCommand { - /** - * Standard ctor. - * - * @param context Application context. - */ - public OpenCmd(AppContext context) { - super(context); - } - - /** - * 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 run() { - FileFilter filter = new XMLFileFilter(getContext().getResources()); - - JFileChooser chooser = new JFileChooser(); - chooser.addChoosableFileFilter(filter); - int val = chooser.showOpenDialog(getContext().getParentFrame()); - if(val == JFileChooser.APPROVE_OPTION) { - File selected = chooser.getSelectedFile(); - getContext().getEventBus().postEvent( - new OpenRequestEvent(getContext(), selected)); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/SaveAsCmd.java b/src/antidote/org/apache/tools/ant/gui/command/SaveAsCmd.java deleted file mode 100644 index 4059cd16a..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/SaveAsCmd.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.ErrorEvent; -import org.apache.tools.ant.gui.acs.ACSProjectElement; -import java.io.*; -import org.apache.tools.ant.gui.core.XMLFileFilter; -import javax.swing.JFileChooser; -import javax.swing.filechooser.FileFilter; -import javax.swing.JOptionPane; -import java.net.URL; -import java.net.MalformedURLException; - - -/** - * Command for doing a "Save as" type of save. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class SaveAsCmd extends AbstractCommand { - /** File to save to. */ - private URL _location = null; - /** Project to save. */ - private ACSProjectElement _project = null; - - /** - * Standard ctor. - * - * @param context Application context. - */ - public SaveAsCmd(AppContext context) { - super(context); - } - - /** - * Set the location to save to - * - * @param location location to save to. - */ - public void setLocation(URL location) { - _location = location; - } - - /** - * Set the specific project to save (instead of the default). - * - * @param project Project to save. - */ - public void setProject(ACSProjectElement project) { - _project = project; - } - - - /** - * Save the project to the current file name. - * - */ - public void run() { - FileFilter filter = new XMLFileFilter(getContext().getResources()); - - if(_project == null) { - _project = getContext().getSelectionManager().getSelectedProject(); - } - - if(_project != null) { - // If no location is specified, then this truly is a SaveAs - // command. Provide the user the UI to select the output. - if(_location == null) { - JFileChooser chooser = new JFileChooser(); - chooser.addChoosableFileFilter(filter); - int val = chooser.showSaveDialog( - getContext().getParentFrame()); - if(val == JFileChooser.APPROVE_OPTION) { - File file = chooser.getSelectedFile(); - if(file.exists()) { - String title = getContext().getResources(). - getString(SaveCmd.class, "title"); - String message = getContext().getResources(). - getMessage(SaveCmd.class, "overwrite", - new Object[] { file.toString()}); - val = JOptionPane.showConfirmDialog( - getContext().getParentFrame(), message, title, - JOptionPane.YES_NO_OPTION); - // If cancelled unset file. - if(val != JOptionPane.YES_OPTION) { - return; - } - } - try { - _location = new URL( - "file", null, file.getAbsolutePath()); - } - catch(MalformedURLException ex) { - // Shouldn't happen. Save will just not - // happen. - ex.printStackTrace(); - } - } - } - - // If a location is now available, do the save operation. - if(_location != null) { - try { - getContext().getProjectManager().saveAs( - _project, _location); - } - catch(IOException ex) { - String message = getContext().getResources().getMessage( - SaveCmd.class, "saveError", - new Object[] { _location.toString() }); - - getContext().getEventBus(). - postEvent(new ErrorEvent(getContext(), message, ex)); - } - } - } - else { - // We shouldn't ever get here. - String message = getContext().getResources().getString( - SaveCmd.class, "noProject"); - - getContext().getEventBus(). - postEvent(new ErrorEvent(getContext(), message)); - - } - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/SaveCmd.java b/src/antidote/org/apache/tools/ant/gui/command/SaveCmd.java deleted file mode 100644 index e46df9029..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/SaveCmd.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.acs.ACSProjectElement; - -/** - * Command to execute the saving of the current build file. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class SaveCmd extends SaveAsCmd { - - /** - * Standard ctor. - * - * @param context Application context. - */ - public SaveCmd(AppContext context) { - super(context); - ACSProjectElement project = - getContext().getSelectionManager().getSelectedProject(); - if(project != null) { - setLocation(project.getLocation()); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/command/ShowOrHideConsoleCmd.java b/src/antidote/org/apache/tools/ant/gui/command/ShowOrHideConsoleCmd.java deleted file mode 100644 index 70aa16754..000000000 --- a/src/antidote/org/apache/tools/ant/gui/command/ShowOrHideConsoleCmd.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.command; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.*; -import java.awt.*; -import javax.swing.*; - -/** - * Toggles the display of the console window - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class ShowOrHideConsoleCmd extends AbstractCommand { - /** Always show the console */ - boolean _alwaysShow = false; - - /** - * Standard ctor. - * - * @param context Application context. - */ - public ShowOrHideConsoleCmd(AppContext context) { - super(context); - _alwaysShow = false; - } - - /** - * Standard ctor. - * - * @param context Application context. - */ - public ShowOrHideConsoleCmd(AppContext context, boolean alwaysShow) { - super(context); - _alwaysShow = alwaysShow; - } - - - /** - * If the console pane is visible, hide it. - * If the console pane is not visible, show it. - */ - public void run() { - JComponent component = (JComponent) findComponent("Console"); - JSplitPane pane = (JSplitPane) component.getParent(); - if (_alwaysShow) { - if (component.getHeight() == 0) { - pane.setDividerLocation(pane.getLastDividerLocation()); - } - } else { - if (component.getHeight() == 0) { - pane.setDividerLocation(pane.getLastDividerLocation()); - } else { - pane.setDividerLocation(1.0); - } - } - } - - /** - * Starting from the top Frame, find the - * first child window with the input name. - * - * @param name The name of the Component - */ - private Component findComponent(String name) { - JFrame frame = (JFrame) getContext().getParentFrame(); - JRootPane root = frame.getRootPane(); - return findChild(root.getContentPane(), name); - } - - /** - * Search the Container for a Component - * with the input name. The search is recursive. - * - * @param container The Container to search - * @param name The name of the Component - */ - private Component findChild(Container container, String name) { - Component[] components = container.getComponents(); - for (int i = 0; i < components.length; i++) { - Component component = components[i]; - if ( name.equals(component.getName()) ) { - return component; - } - if (component instanceof java.awt.Container) { - Component test = findChild( - (java.awt.Container) component, name); - if (test != null) { - return test; - } - } - } - return null; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/core/ActionManager.java b/src/antidote/org/apache/tools/ant/gui/core/ActionManager.java deleted file mode 100644 index 0b245d55f..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/ActionManager.java +++ /dev/null @@ -1,424 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -import org.apache.tools.ant.gui.event.*; -import org.apache.tools.ant.gui.command.Command; -import org.apache.tools.ant.gui.util.CheckableButtonModel; -import javax.swing.*; -import javax.accessibility.*; -import java.util.*; -import java.beans.*; -import java.lang.reflect.Constructor; - -/** - * Manager of antidote actions. Receives its configuration from the action - * ResourceBundle. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ActionManager { - /** Parameters for the Command constructor. */ - private static final Class[] COMMAND_CTOR_PARAMS = { AppContext.class }; - private static final Class[] COMMAND_CTOR_PARAMS_WITH_EVENT = - { AppContext.class, EventObject.class }; - - /** Externalized resources. */ - private ResourceManager _resources = null; - - /** 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; - /** Class for storing the event type to action type - * mapping for setting enabled state. */ - private EventToActionMapper _mapper = null; - - - /** - * Standard ctor. - * - * @param bus Event bus to post events to. - * @param resources Location of resources. - */ - public ActionManager(EventBus bus, ResourceManager resources) { - _bus = bus; - _resources = resources; - bus.addMember(EventBus.RESPONDING, new Enabler()); - - _mapper = new EventToActionMapper(); - - // Configure the set of actions. - String[] names = _resources.getStringArray("actions"); - _actionIDs = new String[names.length]; - for(int i = 0; i < _actionIDs.length; i++) { - _actionIDs[i] = names[i]; - AntAction action = new AntAction(_resources, _bus, _actionIDs[i]); - _actions.put(_actionIDs[i], action); - - // For each action we need to add the reverse event trigger - // lookup. - _mapper.addAction(action); - } - } - - /** - * 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); - - // XXX should be in config file - menu.setMnemonic(name.charAt(0)); - - // XXX need to i18n here... - if(name.equalsIgnoreCase("help")) { - try { - retval.setHelpMenu(menu); - } - catch(Error err) { - // Catch the "not implemented" error in - // some (all?) Swing implementations - retval.add(menu); - } - } - else { - 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); - } - - // See if we should add a separator. - if(action.isPreceededBySeparator() && - menu.getMenuComponentCount() > 0) { - menu.addSeparator(); - } - - if(!action.isToggle()) { - JMenuItem item = menu.add(action); - item.setAccelerator(action.getAccelerator()); - addNiceStuff(item, action); - } - else { - JCheckBoxMenuItem b = - new JCheckBoxMenuItem(action.getName()); - b.setActionCommand(action.getID()); - b.addActionListener(action); - - action.addPropertyChangeListener( - new PropertyWatcher(b)); - - // XXX eck. This is a 1.3 feature. Fix ME! - // Need to provide binding between action and widget. -// b.setAction(action); - addNiceStuff(b, action); - menu.add(b); - } - - } - } - - 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 the action is hidden do not display it. - if(action.isHidden()) { - continue; - } - - // 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); - - // Watch for CHECKED changes - action.addPropertyChangeListener( - new PropertyWatcher(button)); - - if(action.isToggle()) { - ButtonModel model = new CheckableButtonModel(); - button.setModel(model); - } - - addNiceStuff(button, action); - } - } - - return retval; - } - - /** - * Create a popup menu with the given actionIDs. - * XXX check this for object leak. Does the button - * get added to the action as a listener? There are also some - * changes to this behavior in 1.3. - * - * @param actionIDs List of action IDs for actions - * to appear in popup menu. - * @param defaultID Use this action ID if the item - * from the list is not found. - * @return Popup menu to display. - */ - public JPopupMenu createPopup(String[] actionIDs, String defaultID) { - - JPopupMenu retval = new JPopupMenu(); - - for(int i = 0; i < actionIDs.length; i++) { - AntAction action = (AntAction) _actions.get(actionIDs[i]); - - // If the ID is not found, use the default. - if (action == null && defaultID != null) { - action = (AntAction) _actions.get(defaultID); - AbstractButton button = retval.add(action); - - // Set the button text to the action ID. - button.setText(actionIDs[i]); - addNiceStuff(button, action); - } else { - if(action.isPopupPreceededBySeparator() && - retval.getComponentCount() > 0) { - retval.addSeparator(); - } - - AbstractButton button = retval.add(action); - addNiceStuff(button, action); - } - } - - return retval; - } - - /** - * Get the command assocaited with the Action with the given id. - * - * @param actionID Id of action to get command for. - * @return Command associated with action, or null if none available. - */ - public Command getActionCommand(String actionID, - AppContext context, - EventObject event) { - Command retval = null; - AntAction action = (AntAction) _actions.get(actionID); - if(action != null) { - Class clazz = action.getCommandClass(); - if(clazz != null) { - try { - Constructor ctor = - clazz.getConstructor(COMMAND_CTOR_PARAMS); - retval = (Command) ctor.newInstance( - new Object[] { context }); - } - catch(Exception ex) { - try { - Constructor ctor = clazz.getConstructor( - COMMAND_CTOR_PARAMS_WITH_EVENT); - retval = (Command) ctor.newInstance( - new Object[] { context, event }); - } - catch (Exception ex2) { - // XXX log me. - ex.printStackTrace(); - } - } - } - } - return retval; - } - - - /** - * Get the Action with the given id. - * - * @param actionID Id of action to get command for. - * @return AntAction associated with the given id. - */ - public AntAction getAction(String actionID) { - return (AntAction) _actions.get(actionID); - } - - /** - * Add tool tip, Mnemonic, etc. - * - * @param button Button to work on. - * @param action Associated action. - */ - private void addNiceStuff(AbstractButton button, AntAction action) { - // Set the action command so that it is consitent - // no matter what language the display is in. - button.setActionCommand(action.getID()); - - // XXX this should be moved to the config file. - String label = button.getText(); - if(label != null) { - button.setMnemonic(label.charAt(0)); - } - - String tip = action.getShortDescription(); - if(tip != null) { - button.setToolTipText(tip); - } - } - - - /** Class for updating the enabled status of icons based - * on the events seen. */ - private class Enabler 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; - } - - /** - * Receives all events. - * - * @param event Event to post. - * @return true if event should be propogated, false if - * it should be cancelled. - */ - public boolean eventPosted(EventObject event) { - _mapper.applyEvent(event); - return true; - } - } - - /** 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 true; - } - } - - /** Class which's hooks the action to toggle buttons. */ - private static class PropertyWatcher implements PropertyChangeListener { - private AbstractButton _target; - - /** - * Standard ctor. - * - * @param target Button to update - */ - public PropertyWatcher(AbstractButton target) { - _target = target; - } - - /** - * Change the Selected stated of the button if the CHECKED - * property is set on the action - * - * @param event Event to test. - */ - public void propertyChange(PropertyChangeEvent e) { - String propertyName = e.getPropertyName(); - if (propertyName.equals(AccessibleState.CHECKED.toString())) { - Boolean newValue = (Boolean) e.getNewValue(); - _target.setSelected(newValue.booleanValue()); - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/core/AntAction.java b/src/antidote/org/apache/tools/ant/gui/core/AntAction.java deleted file mode 100644 index e1eb5301d..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/AntAction.java +++ /dev/null @@ -1,369 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -import javax.swing.*; -import javax.accessibility.*; -import java.net.URL; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.beans.*; -import java.util.*; - -import org.apache.tools.ant.gui.event.EventBus; - -/** - * Class representing an action in the Antidote application. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public 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"; - public static final String POPUP_SEPARATOR = "popupSeparator"; - public static final String ACCELERATOR = "accelerator"; - public static final String ENABLED = "enabled"; - public static final String ENABLE_ON = "enableOn"; - public static final String DISABLE_ON = "disableOn"; - public static final String TOGGLE = "toggle"; - public static final String CHECKED_TRUE_ON = "checkedTrueOn"; - public static final String CHECKED_FALSE_ON = "checkedFalseOn"; - public static final String COMMAND = "command"; - public static final String HIDDEN = "hidden"; - - /** Property resources. */ - private ResourceManager _resources = null; - /** Event bus. */ - private EventBus _bus = null; - /** Unique id. */ - private String _id = null; - - /** Events that the action should cause transition to the - * enabled(true) state. */ - private Class[] _enableOn = null; - /** Events that the action should cause transition to the - * enabled(false) state. */ - private Class[] _disableOn = null; - /** Events that the action should cause transition to the - * checked state. */ - private Class[] _checkedTrueOn = null; - /** Events that the action should cause transition to the - * not checked state. */ - private Class[] _checkedFalseOn = null; - /** Flag indicating toggle action. */ - private boolean _toggle = false; - - /** - * Standard ctor. - * - * @param id Unique id for the action - */ - public AntAction(ResourceManager resources, EventBus bus, String id) { - - _resources = resources; - _bus = bus; - _id = id; - putValue(NAME, getString("name")); - putValue(SHORT_DESCRIPTION, getString("shortDescription")); - putValue(PARENT_MENU_NAME, getString(PARENT_MENU_NAME)); - putValue(SEPARATOR, getString(SEPARATOR)); - putValue(POPUP_SEPARATOR, getString(POPUP_SEPARATOR)); - putValue(HIDDEN, getString(HIDDEN)); - - - // Set the default enabled state. - String enabled = getString(ENABLED); - if(enabled != null) { - setEnabled(Boolean.valueOf(enabled).booleanValue()); - } - - // Set an accellerator if any. - String accelerator = getString(ACCELERATOR); - if(accelerator != null) { - putValue(ACCELERATOR, KeyStroke.getKeyStroke(accelerator)); - } - - // Check to see if action is a toggle action. - String toggle = getString(TOGGLE); - if(toggle != null) { - _toggle = Boolean.valueOf(toggle).booleanValue(); - } - - // See if there is a command associated with the action. - String command = getString(COMMAND); - if(command != null) { - try { - Class cmd = Class.forName(command); - putValue(COMMAND, cmd); - } - catch(Exception ex) { - // XXX log me. - ex.printStackTrace(); - } - } - - // Add an icon if any (which means it'll show up on the tool bar). - String iconName = getString("icon"); - if(iconName != null) { - putValue(SMALL_ICON, _resources.loadImageIcon(iconName)); - } - - _enableOn = resolveClasses(getString(ENABLE_ON)); - _disableOn = resolveClasses(getString(DISABLE_ON)); - _checkedTrueOn = resolveClasses(getString(CHECKED_TRUE_ON)); - _checkedFalseOn = resolveClasses(getString(CHECKED_FALSE_ON)); - } - - /** - * Convenience method for looking put a resource with the name - * "id.key". Will return null if the resource doesn't exist. - * - * @param key Key name for the action. - * @return String resource for composite key, or null if not found. - */ - private String getString(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; - } - - - /** - * Parse out the list of classes from the given string and - * resolve them into classes. - * - * @param classNames Comma delimited list of class names. - */ - private Class[] resolveClasses(String classNames) { - if(classNames == null) return null; - - StringTokenizer tok = new StringTokenizer(classNames, ", "); - Vector vals = new Vector(); - while(tok.hasMoreTokens()) { - String name = tok.nextToken(); - try { - vals.addElement(Class.forName(name)); - } - catch(ClassNotFoundException ex) { - //XXX log me. - System.err.println( - "Warning: the event class " + name + - " was not found. Please check config file."); - } - } - - Class[] retval = new Class[vals.size()]; - vals.copyInto(retval); - return retval; - } - - /** - * 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); - } - - /** - * Determine if a separator should appear before the action - * when the popup menu is created. - * - * @return True if add separator, false otherwise. - */ - public boolean isPopupPreceededBySeparator() { - return Boolean.valueOf( - String.valueOf(getValue(POPUP_SEPARATOR))).booleanValue(); - } - - /** - * Determine if the action is hidden and should not - * be displayed from a button. - * - * @return True the action is hidden. - */ - public boolean isHidden() { - return Boolean.valueOf( - String.valueOf(getValue(HIDDEN))).booleanValue(); - } - - /** - * Get the accelerator keystroke. - * - * @return Accelerator - */ - public KeyStroke getAccelerator() { - return (KeyStroke) getValue(ACCELERATOR); - } - - - /** - * Get the event types which should cause this to go to the - * enabled state. - * - */ - public Class[] getEnableOnEvents() { - return _enableOn; - } - - /** - * Get the event types which should cause this to go to - * this disabled state. - * - */ - public Class[] getDisableOnEvents() { - return _disableOn; - } - - /** - * Get the event types which should cause this to go to the - * checked state. - */ - public Class[] getCheckedTrueOnEvents() { - return _checkedTrueOn; - } - - /** - * Get the event types which should cause this to go to the - * not checked state. - */ - public Class[] getCheckedFalseOnEvents() { - return _checkedFalseOn; - } - - /** - * True if this is a toggle action, false otherwise. - * - * @return True if this is a toggle action, false otherwise. - */ - public boolean isToggle() { - return _toggle; - } - - - /** - * Get the assciated command class. - * - * @return Command class. - */ - public Class getCommandClass() { - return (Class) getValue(COMMAND); - } - - /** - * Pass the action on to the EventBus. - * - * @param e Event to forward. - */ - public void actionPerformed(ActionEvent e) { - _bus.postEvent(e); - } -} - diff --git a/src/antidote/org/apache/tools/ant/gui/core/AntModule.java b/src/antidote/org/apache/tools/ant/gui/core/AntModule.java deleted file mode 100644 index 9543d491a..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/AntModule.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -import javax.swing.JComponent; -import javax.swing.BorderFactory; - -/** - * Abstract base class for a "module", which is really anything that - * can send or receive events, or edit or view the model. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public abstract class AntModule extends JComponent { - - /** The application context. */ - private AppContext _context = null; - - /** - * Default constructor. - */ - protected AntModule() { - // Create a dummy border so that the widget will at least have a - // minimal display in a bean environment. - setBorder(BorderFactory.createTitledBorder(getClass().getName())); - } - - /** - * This method is called after instantiation when the application context - * is available for constructing the class' display. Think of this in - * a similar manner to Applet.init() or Servlet.init(). It should - * immediately call #setContext() with the given parameter. - * - * @param context Valid application context providing - * all required resources. - */ - public abstract void contextualize(AppContext context); - - /** - * Set the application context. - * - * @param context Application context. - */ - protected void setContext(AppContext context) { - _context = context; - setBorder(_context == null ? null : - BorderFactory.createTitledBorder(getName())); - } - - /** - * Get the application context. - * - * @return Application context. - */ - public AppContext getContext() { - if(_context == null) { - throw new IllegalStateException( - "The AppContext has not been set."); - } - return _context; - } - /** - * Get the name of the editor. - * - * @return Editor's name. - */ - public String getName() { - return getContext().getResources().getString(getClass(), "name"); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/core/AppContext.java b/src/antidote/org/apache/tools/ant/gui/core/AppContext.java deleted file mode 100644 index 556c02993..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/AppContext.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; -import org.apache.tools.ant.BuildListener; -import org.apache.tools.ant.gui.event.*; -import org.apache.tools.ant.gui.acs.ACSProjectElement; -import org.apache.tools.ant.gui.acs.ACSTargetElement; -import java.awt.Frame; -import java.util.*; - -/** - * A container for the state information for the application. Provides - * a centeralized place to gain access to resources and data. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class AppContext { - /** Event bus. */ - private EventBus _eventBus = new EventBus(); - /** Application resources. */ - private ResourceManager _resources = new ResourceManager(); - /** The project manager. */ - private ProjectManager _projectManager = new ProjectManager(); - /** Thing that keeps track of the current selection state. */ - private SelectionManager _selectionManager = new SelectionManager(); - - /** Application actions. */ - private ActionManager _actions = - new ActionManager(_eventBus, new ResourceManager( - "org.apache.tools.ant.gui.resources.action")); - - /** Parent frame used in various operations. XXX what do we do - * in the applet context. */ - private Frame _parentFrame = null; - - /** - * Constructor of apps that don't have a graphical - * component (e.g. web based). - * - */ - public AppContext() { - this(null); - } - - /** - * Standard constructor. - * - * @param parent Parent frame. XXX may go away. - */ - public AppContext(Frame parent) { - _parentFrame = parent; - BuildEventForwarder handler = new BuildEventForwarder(this); - _projectManager.addBuildListener(handler); - _eventBus.addMember(EventBus.MONITORING, _selectionManager); - } - - /** - * Get the parent frame. XXX may change... - * - * @return Parent frame. - */ - public Frame getParentFrame() { - return _parentFrame; - } - - /** - * 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 project manager. - * - * @return Project manager. - */ - public ProjectManager getProjectManager() { - return _projectManager; - } - - /** - * Get the selection manager. - * - * @return Selection manager. - */ - public SelectionManager getSelectionManager() { - return _selectionManager; - } -} - - diff --git a/src/antidote/org/apache/tools/ant/gui/core/BuildEventForwarder.java b/src/antidote/org/apache/tools/ant/gui/core/BuildEventForwarder.java deleted file mode 100644 index b59bbfa0f..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/BuildEventForwarder.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -import org.apache.tools.ant.gui.event.*; -import org.apache.tools.ant.BuildListener; -import org.apache.tools.ant.BuildEvent; - -/** - * BuildListener for forwarding events to the EventBus. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class BuildEventForwarder implements BuildListener { - - /** Application context. */ - private AppContext _context = null; - - public BuildEventForwarder(AppContext context) { - _context = context; - } - - /** - * Fired before any targets are started. - */ - public void buildStarted(BuildEvent event){ - postEvent(event, BuildEventType.BUILD_STARTED); - // We doubly post this event. - _context.getEventBus().postEvent( - new BuildStartedEvent(_context, event)); - } - - /** - * Fired after the last target has finished. This event - * will still be thrown if an error occured during the build. - * - * @see BuildEvent#getException() - */ - public void buildFinished(BuildEvent event) { - postEvent(event, BuildEventType.BUILD_FINISHED); - // We doubly post this event. - _context.getEventBus().postEvent( - new BuildFinishedEvent(_context, event)); - } - - /** - * Fired when a target is started. - * - * @see BuildEvent#getTarget() - */ - public void targetStarted(BuildEvent event) { - postEvent(event, BuildEventType.TARGET_STARTED); - } - - /** - * Fired when a target has finished. This event will - * still be thrown if an error occured during the build. - * - * @see BuildEvent#getException() - */ - public void targetFinished(BuildEvent event) { - postEvent(event, BuildEventType.TARGET_FINISHED); - } - - /** - * Fired when a task is started. - * - * @see BuildEvent#getTask() - */ - public void taskStarted(BuildEvent event) { - postEvent(event, BuildEventType.TASK_STARTED); - } - - /** - * Fired when a task has finished. This event will still - * be throw if an error occured during the build. - * - * @see BuildEvent#getException() - */ - public void taskFinished(BuildEvent event) { - postEvent(event, BuildEventType.TASK_FINISHED); - } - - /** - * Fired whenever a message is logged. - * - * @see BuildEvent#getMessage() - * @see BuildEvent#getPriority() - */ - public void messageLogged(BuildEvent event) { - postEvent(event, BuildEventType.MESSAGE_LOGGED); - } - - /** - * Forward the event. - * - * @param event Event to forward. - * @param type Description of how the event came in. - */ - private void postEvent(BuildEvent event, BuildEventType type) { - _context.getEventBus().postEvent( - new AntBuildEvent(_context, event, type)); - } - - -} diff --git a/src/antidote/org/apache/tools/ant/gui/core/EventDebugMonitor.java b/src/antidote/org/apache/tools/ant/gui/core/EventDebugMonitor.java deleted file mode 100644 index 2bad9878f..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/EventDebugMonitor.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -import org.apache.tools.ant.gui.event.BusMember; -import org.apache.tools.ant.gui.event.BusFilter; -import java.util.EventObject; - -/** - * Class that prints all events to stderr. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class EventDebugMonitor implements BusMember { - - /** Filter for all events. */ - private final Filter _filter = new Filter(); - - /** - * Defatult ctor. - * - */ - public EventDebugMonitor() { - } - - /** - * 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. - * @return true if event should be propogated, false if - * it should be cancelled. - */ - public boolean eventPosted(EventObject event) { - System.err.println(event); - return true; - } - - /** Filter for all events. */ - private static class Filter implements BusFilter { - public boolean accept(EventObject event) { - return true; - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/core/EventResponder.java b/src/antidote/org/apache/tools/ant/gui/core/EventResponder.java deleted file mode 100644 index 66545bbeb..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/EventResponder.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -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.*; - -/** - * The purpose of this class is to watch for events that require some sort - * of action, like opening a file. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public 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. - * @return true if event should be propogated, false if - * it should be cancelled. - */ - public boolean eventPosted(EventObject event) { - String command = ((ActionEvent)event).getActionCommand(); - Command cmd = - _context.getActions().getActionCommand(command, _context, event); - if(cmd != null) { - cmd.run(); - return false; - } - else { - // XXX log me. - System.err.println("Unhandled action: " + command); - // XXX temporary. - new DisplayErrorCmd( - _context, - "Sorry. \"" + command + - "\" not implemented yet. Care to help out?").run(); - return true; - } - } - } - - /** 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. - * @return true if event should be propogated, false if - * it should be cancelled. - */ - public boolean eventPosted(EventObject event) { - AntEvent e = (AntEvent) event; - Command cmd = e.createDefaultCmd(); - cmd.run(); - return cmd instanceof NoOpCmd; - } - } - - /** Filter for ant events. */ - private static class AntFilter implements BusFilter { - public boolean accept(EventObject event) { - return event instanceof AntEvent; - } - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/core/EventToActionMapper.java b/src/antidote/org/apache/tools/ant/gui/core/EventToActionMapper.java deleted file mode 100644 index 0a30c2362..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/EventToActionMapper.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -import java.util.*; -import javax.accessibility.AccessibleState; - -/** - * The purpose of this class is to manage the - * mappings between event type and action enabled state. - * - * @version $Revision$ - * @author Simeon Fitch - */ -class EventToActionMapper { - - /** Lookup for enable(true) events. Key is event type, value is - * a list of actions that are changed by the event. */ - private Map _enableOn = new HashMap(); - /** Lookup for enable(false) events. Key is event type, value is - * a list of actions that are changed by the event. */ - private Map _disableOn = new HashMap(); - /** Lookup for CHECK(true) events. Key is event type, value is - * a list of actions that are changed by the event. */ - private Map _checkedTrueOn = new HashMap(); - /** Lookup for CHECK(false) events. Key is event type, value is - * a list of actions that are changed by the event. */ - private Map _checkedFalseOn = new HashMap(); - - - /** - * Defaul ctor. - * - */ - public EventToActionMapper() { - } - - /** - * Add an action. - * - * @param action Action to add. - */ - public void addAction(AntAction action) { - putAction(action, action.getEnableOnEvents(), _enableOn); - putAction(action, action.getDisableOnEvents(), _disableOn); - putAction(action, action.getCheckedTrueOnEvents(), _checkedTrueOn); - putAction(action, action.getCheckedFalseOnEvents(), _checkedFalseOn); - } - - /** - * For the given action store it in the event type mapping - * for each of the given types. - * - * @param action Action to store. - * @param clazzes Array of types to store it under. - * @param storage The place to store the association. - */ - private void putAction(AntAction action, Class[] clazzes, Map storage) { - if(clazzes == null) return; - - for(int i = 0; i < clazzes.length; i++) { - List values = (List) storage.get(clazzes[i]); - if(values == null) { - values = new ArrayList(1); - storage.put(clazzes[i], values); - } - - values.add(action); - } - } - /** - * For the given event change the state of any actions that - * have been registered as needing a transition as a result of - * the event. - * - * @param event The event to apply. - */ - public void applyEvent(EventObject event) { - if(event == null) return; - - List vals = null; - - vals = (List) _enableOn.get(event.getClass()); - changeState(vals, true); - - vals = (List) _disableOn.get(event.getClass()); - changeState(vals, false); - - vals = (List) _checkedTrueOn.get(event.getClass()); - changeChecked(vals, true); - - vals = (List) _checkedFalseOn.get(event.getClass()); - changeChecked(vals, false); - } - - /** - * Set the enabled state of the given actions. - * - * @param actions List of AntActions to set state for. - * @param state The state to set them to. - */ - private void changeState(List actions, boolean state) { - if(actions == null) return; - - for(int i = 0, len = actions.size(); i < len; i++) { - AntAction action = (AntAction) actions.get(i); - action.setEnabled(state); - } - } - - /** - * Set the CHECKED property of the given actions. - * - * @param actions List of AntActions to set checked properties for. - * @param checked The checked value to set them to. - */ - private void changeChecked(List actions, boolean checked) { - if(actions == null) return; - - for(int i = 0, len = actions.size(); i < len; i++) { - AntAction action = (AntAction) actions.get(i); - action.putValue(AccessibleState.CHECKED.toString(), - new Boolean(checked)); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/core/ProjectManager.java b/src/antidote/org/apache/tools/ant/gui/core/ProjectManager.java deleted file mode 100644 index 226bbf052..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/ProjectManager.java +++ /dev/null @@ -1,384 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -import org.apache.tools.ant.BuildListener; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.ProjectHelper; -import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.gui.acs.*; -import org.apache.tools.ant.gui.event.BuildEventType; -import java.io.*; -import java.net.URL; -import java.net.URLConnection; -import java.util.*; - -/** - * This class is responsible for managing the currently open projects, - * and the loading of new projects. - * - * XXX need to add property change listeners support. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ProjectManager { - - /** Set of open projects. */ - private List _projects = new ArrayList(1); - /** List of build listeners to register when build starts. */ - private List _buildListeners = new LinkedList(); - /** The current thread executing a build. */ - private Thread _buildThread = null; - - public ProjectManager() { - } - - /** - * Get all the open projects. - * - * @return an array of all open projects. - */ - public ACSProjectElement[] getOpen() { - ACSProjectElement[] retval = new ACSProjectElement[_projects.size()]; - _projects.toArray(retval); - return retval; - } - - /** - * Save the given project. - * - * @param project Project to save. - */ - public void save(ACSProjectElement project) throws IOException { - saveAs(project, null); - } - - - /** - * Save the given project to the given location. - * - * @param project Project to save. - * @param location Location to save to. - */ - public void saveAs(ACSProjectElement project, URL location) - throws IOException { - - if(location == null) { - location = project.getLocation(); - } - if(location == null) { - // This shouldn't happen. - throw new IOException("Logic error: Save location mising."); - } - - Writer out = null; - try { - // XXX for some reason the URLConnection for protocol type "file" - // doesn't support output (at least that is what the exception - // says. I don't know if I'm doing something wrong or not, but - // since we need to handle files differently (which is fine - // right now since files are all we really support anyway. - if(location.getProtocol().equals("file")) { - out = new FileWriter(location.getFile()); - } - else { - // XXX This is here for future support of FTP/HTTP and - // the like. JDBC will have to be dealt with differently. - URLConnection connection = location.openConnection(); - connection.setDoInput(false); - connection.setDoOutput(true); - out = new OutputStreamWriter(connection.getOutputStream()); - } - - // Persist the project. - project.write(out); - out.flush(); - project.setLocation(location); - } - finally { - try { out.close(); } catch(Exception ex) {} - } - } - - /** - * Open the project persisted at the given location - * - * @param location Location of project file. - * @return Successfully loaded project. - * @throws IOException thrown if there is a problem opening the project. - */ - public ACSProjectElement open(File location) throws IOException { - return open(new URL("file", null, location.getPath())); - } - - /** - * Open the project persisted at the given location - * - * @param location Location of project file. - * @return Successfully loaded project. - * @throws IOException thrown if there is a problem opening the project. - */ - public ACSProjectElement open(URL location) throws IOException { - ACSProjectElement retval = null; - retval = ACSFactory.getInstance().load(location); - retval.setLocation(location); - _projects.add(retval); - return retval; - } - - /** - * Create a new, unpopulated project. - * - * @return Unpopulated project. - */ - public ACSProjectElement createNew() { - ACSProjectElement retval = ACSFactory.getInstance().createProject(); - _projects.add(retval); - return retval; - } - - /** - * Remove the given project from the set of active projects. - * - * @param project Project to close. - */ - public void close(ACSProjectElement project) { - _projects.remove(project); - } - - /** - * Build the project with the given target (or the default target - * if none is selected. Build occurs on a separate thread, so method - * returns immediately. - * - * @param project Project to build. - * @param targets Targets to build in project. - */ - public void build(ACSProjectElement project, ACSTargetElement[] targets) - throws BuildException { - _buildThread = new Thread(new BuildRunner(project, targets)); - _buildThread.start(); - } - - /** - * Add a build listener. - * - * @param l Listener to add. - */ - public void addBuildListener(BuildListener l) { - synchronized(_buildListeners) { - _buildListeners.add(l); - } - } - - /** - * Remove a build listener. - * - * @param l Listener to remove. - */ - public void removeBuildListener(BuildListener l) { - synchronized(_buildListeners) { - _buildListeners.remove(l); - } - } - - /** - * Determine if the given BuildListener is registered. - * - * @param l Listener to test for. - * @return True if listener has been added, false if unknown. - */ - public boolean isRegisteredBuildListener(BuildListener l) { - synchronized(_buildListeners) { - return _buildListeners.contains(l); - } - } - - /** - * Get the set of current build listeners. - * - * @return Set of current build listeners. - */ - public BuildListener[] getBuildListeners() { - synchronized(_buildListeners) { - BuildListener[] retval = new BuildListener[_buildListeners.size()]; - _buildListeners.toArray(retval); - return retval; - } - } - - /** Class for executing the build in a separate thread. */ - private class BuildRunner implements Runnable { - /** The project to execute build on. */ - private ACSProjectElement _project = null; - /** Targets to build. */ - private ACSTargetElement[] _targets = null; - /** The Ant core representation of a project. */ - private Project _antProject = null; - - /** - * Standard ctor. - * - * @param project Project to execute build on. - * @param targets Targets to build. - */ - public BuildRunner(ACSProjectElement project, - ACSTargetElement[] targets) throws BuildException { - _project = project; - _targets = targets; - - URL location = _project.getLocation(); - if(location == null) { - // XXX this needs to be changed so that if the project is - // not saved, or the persistence mechanism is remote - // then a temporary version is saved first. - throw new BuildException("Project must be saved first"); - } - - // XXX hopefully we will eventually be able to save - // project files to any type of URL. Right now the Ant core - // only supports Files. - if(!location.getProtocol().equals("file")) { - throw new IllegalArgumentException( - "The Ant core only supports building from locally " + - "stored build files."); - } - - File f = new File(location.getFile()); - - _antProject = new Project(); - _antProject.init(); - // XXX there is a bunch of stuff in the class - // org.apache.tools.ant.Main that needs to be - // refactored 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. JAVA_HOME may have to be set, - // as well as checking the .ant.properties - _antProject.setUserProperty( - "ant.file" , f.getAbsolutePath()); - ProjectHelper.configureProject(_antProject, f); - } - - /** - * Convenience method for causeing the project to fire a build event. - * Implemented because the corresponding method in the Project class - * is not publically accessible. - * - * @param event Event to fire. - */ - private void fireBuildEvent(BuildEvent event, BuildEventType type) { - Enumeration enum = _antProject.getBuildListeners().elements(); - while(enum.hasMoreElements()) { - BuildListener l = (BuildListener) enum.nextElement(); - type.fireEvent(event, l); - } - } - - /** - * Run the build. - * - */ - public void run() { - synchronized(_antProject) { - // Add the build listeners - BuildListener[] listeners = getBuildListeners(); - for(int i = 0; i < listeners.length; i++) { - _antProject.addBuildListener(listeners[i]); - } - - try { - - fireBuildEvent(new BuildEvent( - _antProject), BuildEventType.BUILD_STARTED); - - - Vector targetNames = new Vector(); - if(_targets == null || _targets.length == 0) { - targetNames.add(_antProject.getDefaultTarget()); - } - else { - for(int i = 0; i < _targets.length; i++) { - targetNames.add(_targets[i].getName()); - } - } - - // Execute build on selected targets. XXX It would be - // nice if the Project API supported passing in target - // objects rather than String names. - _antProject.executeTargets(targetNames); - } - catch(BuildException ex) { - BuildEvent errorEvent = new BuildEvent(_antProject); - errorEvent.setException(ex); - errorEvent.setMessage(ex.getMessage(), Project.MSG_ERR); - fireBuildEvent(errorEvent, BuildEventType.MESSAGE_LOGGED); - } - finally { - fireBuildEvent(new BuildEvent( - _antProject), BuildEventType.BUILD_FINISHED); - - // Remove the build listeners. - for(int i = 0; i < listeners.length; i++) { - _antProject.removeBuildListener(listeners[i]); - } - } - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/core/ProjectSelectionMenu.java b/src/antidote/org/apache/tools/ant/gui/core/ProjectSelectionMenu.java deleted file mode 100644 index a3b83f69d..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/ProjectSelectionMenu.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -import org.apache.tools.ant.gui.event.*; -import org.apache.tools.ant.gui.acs.ACSProjectElement; -import javax.swing.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.*; -import java.beans.PropertyChangeEvent; - -/** - * Specialization of JMenu providing selectability of the currently - * open projects. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ProjectSelectionMenu extends JMenu { - /** Application context. */ - private AppContext _context = null; - /** Current set of menus. */ - private Map _menus = new HashMap(); - - - /** - * Standard ctor. - * - * @param context Application context. - */ - public ProjectSelectionMenu(AppContext context) { - super(context.getResources().getString( - ProjectSelectionMenu.class, "name"), true); - _context = context; - _context.getEventBus().addMember( - EventBus.MONITORING, new ProjectListener()); - setMnemonic(getText().charAt(0)); - } - - /** - * Replace or add the JMenu called "Projects" with this. - * - * @param menuBar Menu bar to insert into. - */ - public void insertInto(JMenuBar menuBar) { - // Iterate of the menu items looking for the one with the same name - // as ours. - int count = menuBar.getComponentCount(); - for(int i = 0; i < count; i++) { - JMenuItem menu = (JMenuItem) menuBar.getComponent(i); - if(menu.getText().equals(getText())) { - menuBar.remove(menu); - menuBar.add(this, i); - return; - } - } - - // Getting here we didn't find a menu with the same name. - add(this); - } - - - /** Listener for updating the contents of the menu. */ - private class ProjectListener implements BusMember { - /** Event filter. */ - private final Filter _filter = new Filter(); - /** Action handler. */ - private final ActionHandler _handler = new ActionHandler(); - /** - * 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. - * @return true if event should be propogated, false if - * it should be cancelled. - */ - public boolean eventPosted(EventObject event) { - // Clear out our existing members - removeAll(); - _menus.clear(); - - ACSProjectElement[] projects = - _context.getProjectManager().getOpen(); - for(int i = 0; i < projects.length; i++) { - JMenuItem menu = new JMenuItem(projects[i].getName()); - menu.addActionListener(_handler); - _menus.put(menu, projects[i]); - add(menu); - } - return true; - } - } - - /** Filter for project related events. */ - private static class Filter implements BusFilter { - public boolean accept(EventObject event) { - // We want events related to projects. - return event instanceof ProjectSelectedEvent || - event instanceof ProjectClosedEvent || - (event instanceof PropertyChangeEvent && - ((PropertyChangeEvent)event).getSource() - instanceof ACSProjectElement); - } - } - - /** Handler for selecting the project. */ - private class ActionHandler implements ActionListener { - public void actionPerformed(ActionEvent e) { - ACSProjectElement project = - (ACSProjectElement) _menus.get(e.getSource()); - _context.getEventBus().postEvent( - new ProjectSelectedEvent(_context, project)); - } - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/core/ResourceManager.java b/src/antidote/org/apache/tools/ant/gui/core/ResourceManager.java deleted file mode 100644 index 16ff059d9..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/ResourceManager.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -import java.util.*; -import java.text.MessageFormat; -import javax.swing.ImageIcon; -import java.net.URL; -import java.io.File; - -/** - * Singleton class for accessing various resources by the application. - * Relies on the resource bundles for resource values. - * - * @version $Revision$ - * @author Simeon H.K. Fitch - */ -public class ResourceManager { - - /** Path to default resources. */ - private static final String RESOURCE_PKG = - "org.apache.tools.ant.gui.resources"; - /** Path to default resources. */ - private static final String DEF_PROPERTIES = - RESOURCE_PKG + ".antidote"; - - /** Image path. */ - private static final String IMG_PATH = - '/' + RESOURCE_PKG.replace('.', '/'); - - /** Resources to reference. */ - private ResourceBundle _resources = null; - - /** - * Default ctor. Uses the default properties file for antidote. - * - */ - public ResourceManager() { - this(DEF_PROPERTIES); - } - - /** - * Standard ctor. - * - * @param propName Fully qualified name of the resources to use. - */ - public ResourceManager(String propName) { - _resources = ResourceBundle.getBundle(propName); - } - - /** - * 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) { - name = name == null ? "" : name; - - return clazz == null ? name : clazz.getName() + "." + name; - } - - /** - * Get non-qualified String resource. - * - * @param name Name of the resource. - * @return Value of the resource. - */ - public String getString(String name) { - return getString(null, name); - } - - /** - * 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(name == null) { - return null; - } - - try { - return _resources.getString(getKey(clazz, name)); - } - catch(MissingResourceException ex) { - return null; - } - } - - /** - * Get a non-qualified array of string resources for the given class. - * - * @param name Name of the string resource. - * @return Array of string resources for the given class. - */ - public String[] getStringArray(String name) { - return getStringArray(null, 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(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) { - try { - return _resources.getStringArray(key); - } - catch(MissingResourceException ex) { - return null; - } - } - 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; - } - } - - /** - * Get the boolean resource for the given name. Case - * insensitive values of "yes" or "true" evaluate to TRUE. - * All others, including undefined resources evaluate to FALSE. - * - * @param name Name of the boolean resource. - * @return True if defined as true, false otherwise. - */ - public boolean getBoolean(String name) { - return getBoolean(null, name); - } - - /** - * Get the boolean resource for the given class. Case - * insensitive values of "yes" or "true" evaluate to TRUE. - * All others, including undefined resources evaluate to FALSE. - * - * @param clazz Class to get resource for. - * @param name Name of the boolean resource. - * @return True if defined as true, false otherwise. - */ - public boolean getBoolean(Class clazz, String name) { - if(name == null) { - return false; - } - - String key = getKey(clazz, name); - - String value = ""; - try { - value = _resources.getString(key); - } - catch(MissingResourceException ex) { - return false; - } - - return value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes"); - } - - /** - * Get the non-qualified Class type resource for the given key. - * - * @param name Name of the resourdce. - * @return Class associated with the key name. - */ - public Class getClass(String name) - throws ClassNotFoundException { - return getClass(null, name); - } - - /** - * Get the Class type resource for the given class and key name. - * - * @param clazz Class requesting the resource. - * @param name Name of the resource. - * @return Class associated with the key name. - */ - public Class getClass(Class clazz, String name) - throws ClassNotFoundException { - - String key = getKey(clazz, name); - try { - String value = _resources.getString(key); - return Class.forName(value); - } - catch(MissingResourceException ex) { - return null; - } - - } - - - /** - * Generate a localized message using the given set of arguments to - * format the message with. - * - * @param name Name of the message. - * @param arguments Arguments to the message. - * @return The formatted message. - */ - public String getMessage(String name, Object[] arguments) { - return getMessage(null, name, arguments); - } - - /** - * 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 Name of the message. - * @param arguments Arguments to the message. - * @return The formatted message. - */ - public String getMessage(Class clazz, String name, Object[] arguments) { - String format = getString(clazz, name); - return MessageFormat.format(format, arguments); - } - - /** - * Get the image as an ImageIcon assigned to the given class with the - * given key. - * - * @param clazz The class to load icon for. - * @param key The key for looking up the icon. - * @return Image as an ImageIcon, or null if not found. - */ - public ImageIcon getImageIcon(Class clazz, String key) { - return loadImageIcon(getString(clazz, key)); - } - - /** - * Get the image as an ImageIcon with the given file name. - * For example "open.gif". The image is loaded from the resources package. - * - * @param fileName Image file to load. - * @return Image as an ImageIcon, or null if not found. - */ - public ImageIcon loadImageIcon(String fileName) { - if(fileName == null) return null; - - ImageIcon icon = null; - URL location = getClass().getResource(IMG_PATH + "/" + fileName); - if(location != null) { - icon = new ImageIcon(location); - } - return icon; - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/core/SelectionManager.java b/src/antidote/org/apache/tools/ant/gui/core/SelectionManager.java deleted file mode 100644 index ca24214aa..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/SelectionManager.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -import org.apache.tools.ant.gui.event.*; -import org.apache.tools.ant.gui.command.*; -import org.apache.tools.ant.gui.acs.*; -import java.util.EventObject; -import java.awt.event.ActionEvent; -import javax.swing.*; - -/** - * State management class for keeping track of what build file elements are - * currently selected. It monitors the EventBus for selection events and - * Records the current state. It should be registered with the EventBus - * at the MONITORING level. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class SelectionManager implements BusMember { - /** The filter for getting the correct events.*/ - private final Filter _filter = new Filter(); - - /** The currently selected project. */ - private ACSProjectElement _project = null; - /** The current set of selected targets. */ - private ACSTargetElement[] _targets = null; - /** The current set of selected elements. */ - private ACSElement[] _elements = null; - - public SelectionManager() { - } - - /** - * 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; - } - - - /** - * Get the currently selected project. - * - * @return Current project. - */ - public ACSProjectElement getSelectedProject() { - return _project; - } - - /** - * Get the selected elements that are targets. - * - */ - public ACSTargetElement[] getSelectedTargets() { - return _targets; - } - - /** - * Get the selected elements. - * - */ - public ACSElement[] getSelectedElements() { - return _elements; - } - - /** - * Called when an event is to be posed to the member. - * - * @param event Event to post. - * @return true if event should be propogated, false if - * it should be cancelled. - */ - public boolean eventPosted(EventObject event) { - _elements = ((ElementSelectionEvent)event).getSelectedElements(); - - if(event instanceof TargetSelectionEvent) { - _targets = ((TargetSelectionEvent)event).getSelectedTargets(); - } - else if(event instanceof ProjectSelectedEvent) { - _project = ((ProjectSelectedEvent)event).getSelectedProject(); - } - return true; - } - - /** Filter for ElementSelectionEvent objects. */ - private static class Filter implements BusFilter { - public boolean accept(EventObject event) { - return event instanceof ElementSelectionEvent; - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/core/XMLFileFilter.java b/src/antidote/org/apache/tools/ant/gui/core/XMLFileFilter.java deleted file mode 100644 index 795f9d8f9..000000000 --- a/src/antidote/org/apache/tools/ant/gui/core/XMLFileFilter.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.core; - -import javax.swing.filechooser.FileFilter; -import java.io.File; - -/** - * FileFilter for showing only XML files. - * - * @version $Revision$ - * @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; - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/.wrapper b/src/antidote/org/apache/tools/ant/gui/customizer/.wrapper deleted file mode 100755 index 5995815e9..000000000 --- a/src/antidote/org/apache/tools/ant/gui/customizer/.wrapper +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# Wrapper script for launching Java files without having to type the -# package prefix. To use make a link to this file with the same name -# as the class you want to run. - -# Edit this line to represent the package that your class belongs to. -PACKAGE=org.apache.tools.ant.gui.customizer - -# Set your application's classpath here. -CLASSPATH=$HOME/build/antidote/classes:$HOME/build/ant/lib/ant.jar - -# Compose the fully qualified class name. -START=$PACKAGE.`basename $0` - -# Java runtime path. -EXE=/usr/java1.3/bin/java - -# Set any runtime options here -OPTS="-classpath $CLASSPATH" - -# Turn the JIT off if the variable "DEBUG" is set in the environment. -if [ ! -z $DEBUG ]; then - OPTS="$OPTS -Djava.compiler=NONE" -fi - -# Launch the program. -#echo $EXE $OPTS $START $* -exec $EXE $OPTS $START $* diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/AbstractPropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/customizer/AbstractPropertyEditor.java deleted file mode 100644 index 1feb702a8..000000000 --- a/src/antidote/org/apache/tools/ant/gui/customizer/AbstractPropertyEditor.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.customizer; - -import java.beans.*; -import java.awt.Graphics; -import java.awt.Component; -import java.awt.Rectangle; -import java.awt.Dimension; -import javax.swing.JComponent; -import java.awt.event.FocusEvent; -import java.awt.event.FocusAdapter; - -/** - * Abstract base class for the custom type property editors. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public abstract class AbstractPropertyEditor implements PropertyEditor { - - /** Bean property change property name. */ - public static final String BEAN_PROP = "BeanEditorProperty"; - /** Event listener support. */ - private PropertyChangeSupport _listeners = new PropertyChangeSupport(this); - - /** - * Default constructor. - * - */ - protected AbstractPropertyEditor() { - } - - /** - * Paint a representation of the value into a given area of screen - * real estate. Note that the propertyEditor is responsible for doing - * its own clipping so that it fits into the given rectangle. - *

    - * If the PropertyEditor doesn't honor paint requests (see isPaintable) - * this method should be a silent noop. - *

    - * The given Graphics object will have the default font, color, etc of - * the parent container. The PropertyEditor may change graphics attributes - * such as font and color and doesn't need to restore the old values. - * - * @param gfx Graphics object to paint into. - * @param box Rectangle within graphics object into which we should paint. - */ - public void paintValue(Graphics gfx, Rectangle box) { - Object o = getValue(); - String s = o == null ? "" : o.toString(); - gfx.drawString(s, box.x, box.y); - } - - - /** - * Fire a property change event to listeners. - * - * @param oldValue Old value. - * @param newValue New value. - */ - public void firePropertyChange(Object oldValue, Object newValue) { - _listeners.firePropertyChange(BEAN_PROP, oldValue, newValue); - } - - /** - * Add a property change listener. XXX This may cause undesired - * side affects with merging property changes with JPanel class. - * Need to test for a while. - * - * @param l Change listener. - */ - public void addPropertyChangeListener(PropertyChangeListener l) { - _listeners.addPropertyChangeListener(l); - } - - /** - * Remove a property change listener. - * - * @param l Change listener. - */ - public void removePropertyChangeListener(PropertyChangeListener l) { - _listeners.removePropertyChangeListener(l); - } - - /** - * @return True if the class will honor the paintValue method. - */ - public boolean isPaintable() { - return true; - } - - /** - * If the property value must be one of a set of known tagged values, - * then this method should return an array of the tags. This can - * be used to represent (for example) enum values. If a PropertyEditor - * supports tags, then it should support the use of setAsText with - * a tag value as a way of setting the value and the use of getAsText - * to identify the current value. - * - * @return The tag values for this property. May be null if this - * property cannot be represented as a tagged value. - * - */ - public String[] getTags() { - return null; - } - - /** - * A PropertyEditor may choose to make available a full custom Component - * that edits its property value. It is the responsibility of the - * PropertyEditor to hook itself up to its editor Component itself and - * to report property value changes by firing a PropertyChange event. - *

    - * The higher-level code that calls getCustomEditor may either embed - * the Component in some larger property sheet, or it may put it in - * its own individual dialog, or ... - * - * @return A java.awt.Component that will allow a human to directly - * edit the current property value. May be null if this is - * not supported. - */ - public Component getCustomEditor() { - return getChild(); - } - - /** - * @return True if the propertyEditor can provide a custom editor. - */ - public boolean supportsCustomEditor() { - return true; - } - - /** - * This method is intended for use when generating Java code to set - * the value of the property. It should return a fragment of Java code - * that can be used to initialize a variable with the current property - * value. - *

    - * Example results are "2", "new Color(127,127,34)", "Color.orange", etc. - * - * @return A fragment of Java code representing an initializer for the - * current value. - */ - public String getJavaInitializationString() { - return ""; - } - - /** - * Get the child editing component. - * - * @return Child editing component. - */ - protected abstract Component getChild(); - - /** Helper class for detecting changes and generating change events - * on a focus lost event. */ - protected static class FocusHandler extends FocusAdapter { - /** Last value of the editor. */ - private Object _value = null; - /** Editor of interest. */ - private AbstractPropertyEditor _editor = null; - - /** - * Standard constructor. - * - * @param editor Editor of interest. - */ - public FocusHandler(AbstractPropertyEditor editor) { - _editor = editor; - } - - /** - * Called when focus is gained. - * - * @param e Focus event. - */ - public void focusGained(FocusEvent e) { - _value = _editor.getValue(); - } - - /** - * Called when focus is lost. Checks to see if value changed and - * fires a change event if needed. - * - * @param e Focus event. - */ - public void focusLost(FocusEvent e) { - if((_value != null && !_value.equals(_editor.getValue())) || - (_value == null && _editor.getValue() != null)) { - _editor.firePropertyChange(_value, _editor.getValue()); - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/DoublePropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/customizer/DoublePropertyEditor.java deleted file mode 100644 index 560de00d5..000000000 --- a/src/antidote/org/apache/tools/ant/gui/customizer/DoublePropertyEditor.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.customizer; - -import javax.swing.*; -import java.awt.Component; - -/** - * Custom property editor for editing double values. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class DoublePropertyEditor extends AbstractPropertyEditor { - /** Editing widget. */ - private JTextField _widget = null; - - /** - * Default ctor. - * - */ - public DoublePropertyEditor() { - _widget = new JTextField(); - _widget.addFocusListener(new FocusHandler(this)); - } - - /** - * Get the child editing component. Uses JComponent so we can have tool - * tips, etc. - * - * @return Child editing component. - */ - protected Component getChild() { - return _widget; - } - - /** - * This method is intended for use when generating Java code to set - * the value of the property. It should return a fragment of Java code - * that can be used to initialize a variable with the current property - * value. - *

    - * Example results are "2", "new Color(127,127,34)", "Color.orange", etc. - * - * @return A fragment of Java code representing an initializer for the - * current value. - */ - public String getJavaInitializationString() { - return "new Double(" + getAsText() + ")"; - } - - /** - * Set (or change) the object that is to be edited. Builtin types such - * as "int" must be wrapped as the corresponding object type such as - * "java.lang.Integer". - * - * @param value The new target object to be edited. Note that this - * object should not be modified by the PropertyEditor, rather - * the PropertyEditor should create a new object to hold any - * modified value. - */ - public void setValue(Object value) { - Object old = _widget.getText(); - if(!(value instanceof Double)) { - value = new Double(0); - } - - _widget.setText(value.toString()); - } - - /** - * @return The value of the property. Builtin types such as "int" will - * be wrapped as the corresponding object type such as "java.lang.Integer". - */ - public Object getValue() { - Double retval = null; - try { - retval = new Double(_widget.getText()); - } - catch(NumberFormatException ex) { - retval = new Double(0); - _widget.setText(retval.toString()); - } - return retval; - } - - /** - * Set the property value by parsing a given String. May raise - * java.lang.IllegalArgumentException if either the String is - * badly formatted or if this kind of property can't be expressed - * as text. - * @param text The string to be parsed. - */ - public void setAsText(String text) { - Object old = _widget.getText(); - Double val = null; - try { - val = new Double(text); - } - catch(NumberFormatException ex) { - val = new Double(0); - } - text = val.toString(); - _widget.setText(text); - } - - /** - * @return The property value as a human editable string. - *

    Returns null if the value can't be expressed - * as an editable string. - *

    If a non-null value is returned, then the PropertyEditor should - * be prepared to parse that string back in setAsText(). - */ - public String getAsText() { - return _widget.getText(); - } -} - - diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/DynamicCustomizer.java b/src/antidote/org/apache/tools/ant/gui/customizer/DynamicCustomizer.java deleted file mode 100644 index b374ceb06..000000000 --- a/src/antidote/org/apache/tools/ant/gui/customizer/DynamicCustomizer.java +++ /dev/null @@ -1,608 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.customizer; - -import org.apache.tools.ant.gui.util.LabelFieldGBC; -import java.lang.reflect.*; -import java.beans.*; -import javax.swing.*; -import java.util.*; -import java.io.File; -import java.awt.*; - -/** - * Widget for dynamically constructing a property editor based on the - * an Object's BeanInfo. Essentially a property sheet. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class DynamicCustomizer extends JPanel implements Customizer, Scrollable { - static { - PropertyEditorManager.registerEditor( - String.class, StringPropertyEditor.class); - PropertyEditorManager.registerEditor( - String[].class, StringArrayPropertyEditor.class); - PropertyEditorManager.registerEditor( - int.class, IntegerPropertyEditor.class); - PropertyEditorManager.registerEditor( - Integer.class, IntegerPropertyEditor.class); - PropertyEditorManager.registerEditor( - double.class, DoublePropertyEditor.class); - PropertyEditorManager.registerEditor( - Double.class, DoublePropertyEditor.class); - PropertyEditorManager.registerEditor( - Properties.class, PropertiesPropertyEditor.class); - PropertyEditorManager.registerEditor( - File.class, FilePropertyEditor.class); - PropertyEditorManager.registerEditor( - Object.class, ObjectPropertyEditor.class); - } - - /** Property name that PropertyDescriptors can save in their property - * dictionaries for for specifiying a display sorting order. The value - * sould be of type Integer. */ - public static final String SORT_ORDER = "sortOrder"; - - /** The type that this editor instance can handle. */ - private Class _type = null; - /** The value currently being edited. */ - private Object _value = null; - /** Mapping from PropertyDescriptor to PropertyEditor. */ - private Map _prop2Editor = new HashMap(); - /** Mapping from PropertyEditor to field PropertyDescriptor. */ - private Map _editor2Prop = new HashMap(); - /** Listener for receiving change events from the editors. */ - private EditorChangeListener _eListener = new EditorChangeListener(); - /** Read-only flag. */ - private boolean _readOnly = false; - /** List of property change listeners interested when the bean - * being edited has been changed. */ - private java.util.List _changeListeners = new LinkedList(); - /** Flag to trun off event propogation. */ - private boolean _squelchChangeEvents = false; - - /** - * Standard constructor. - * - * @param type Type that you are going to be creating and editor for. - */ - public DynamicCustomizer(Class type) { - this(type, false); - } - - /** - * Standard constructor. - * - * @param type Type that you are going to be creating and editor for. - * @param readOnly Set to true to create a read-only customizer. - */ - public DynamicCustomizer(Class type, boolean readOnly) { - super(new GridBagLayout()); - _readOnly = readOnly; - _type = type; - - LabelFieldGBC gbc = new LabelFieldGBC(); - try { - BeanInfo info = Introspector.getBeanInfo(type); - // Set up pretty display stuff. - setBorder(BorderFactory.createTitledBorder( - info.getBeanDescriptor().getDisplayName())); - setToolTipText(info.getBeanDescriptor().getShortDescription()); - - // Get the properties and sort them. - PropertyDescriptor[] props = info.getPropertyDescriptors(); - Arrays.sort(props, new PropertyComparator()); - for(int i = 0; i < props.length; i++) { - // Ignore the "class" property, if it is provided. - if(props[i].getName().equals("class")) continue; - // Create a label for the field. - JLabel label = new JLabel(props[i].getDisplayName() + ":"); - - // Lookup the editor. - PropertyEditor editor = getEditorForProperty(props[i]); - - // Add a listener to the editor so we know when to update - // the bean's fields. - editor.addPropertyChangeListener(_eListener); - - // XXX What we need to do right here is provide a component - // that makes use of the "paintable" capability of the editor. - Component comp = editor.getCustomEditor(); - if(comp == null) { - comp = new JLabel(""); - ((JLabel)comp).setBorder(BorderFactory.createEtchedBorder()); - } - - // See if it is a read-only property. If so, then just - // display it. - if(_readOnly || props[i].getWriteMethod() == null) { - comp.setEnabled(false); - } - - // Setup the accellerator key. - label.setLabelFor(comp); - label.setDisplayedMnemonic(label.getText().charAt(0)); - - // Set the tool tip text, if any. - String tip = props[i].getShortDescription(); - if(tip != null) { - label.setToolTipText(tip); - if(comp instanceof JComponent) { - ((JComponent)comp).setToolTipText(tip); - } - } - - // Add the label and fields. - add(label, gbc.forLabel()); - add(comp, gbc.forField()); - - // Set the mappings between editor and property, etc. for - // quick lookup later. - _prop2Editor.put(props[i], editor); - _editor2Prop.put(editor, props[i]); - } - // Filler... - add(new JLabel(), gbc.forLastLabel()); - - } - catch(Exception ex) { - ex.printStackTrace(); - } - } - - - /** - * Set the object to be edited. - * - * @param value The object to be edited. - */ - public void setObject(Object value) { - if(!(_type.isInstance(value))) { - throw new IllegalArgumentException( - value.getClass() + " is not of type " + _type); - } - _value = value; - - // Disable event generation. - _squelchChangeEvents = true; - - // Iterate over each property, doing a lookup on the associated editor - // and setting the editor's value to the value of the property. - Iterator it = _prop2Editor.keySet().iterator(); - while(it.hasNext()) { - PropertyDescriptor desc = (PropertyDescriptor) it.next(); - PropertyEditor editor = (PropertyEditor) _prop2Editor.get(desc); - Method reader = desc.getReadMethod(); - if(reader != null) { - try { - Object val = reader.invoke(_value, null); - editor.setValue(val); - } - catch(IllegalAccessException ex) { - ex.printStackTrace(); - } - catch(InvocationTargetException ex) { - ex.getTargetException().printStackTrace(); - } - } - } - - // Enable event generation. - _squelchChangeEvents = false; - - } - - /** - * Get the appropriate editor for the given property. - * - * @param prop Property to get editor for. - * @return Editor to use, or null if none found. - */ - private PropertyEditor getEditorForProperty(PropertyDescriptor prop) { - PropertyEditor retval = null; - Class type = prop.getPropertyEditorClass(); - if(type != null) { - try { - retval = (PropertyEditor) type.newInstance(); - } - catch(Exception ex) { - ex.printStackTrace(); - } - } - // Handle case where there is no special editor - // associated with the property. In that case we ask the - // PropertyEditor manager for the editor registered for the - // given property type. - if(retval == null) { - Class t = prop.getPropertyType(); - if(t != null) { - retval = PropertyEditorManager.findEditor(t); - } - } - - // In the worse case we resort to the generic editor for Object types. - if(retval == null) { - retval = PropertyEditorManager.findEditor(Object.class); - } - - return retval; - } - - /** - * Add the given listener. Will receive a change event for - * changes to the bean being edited. - * - * @param l Listner to add. - */ - public void addPropertyChangeListener(PropertyChangeListener l) { - _changeListeners.add(l); - } - - - /** - * Remove the given property change listener. - * - * @param l Listener to remove. - */ - public void removePropertyChangeListener(PropertyChangeListener l) { - _changeListeners.remove(l); - } - - /** - * Fire a property change event to each listener. - * - * @param bean Bean being edited. - * @param propName Name of the property. - * @param oldValue Old value. - * @param newValue New value. - */ - protected void firePropertyChange(Object bean, String propName, - Object oldValue, Object newValue) { - - PropertyChangeEvent e = new PropertyChangeEvent( - bean, propName, oldValue, newValue); - - Iterator it = _changeListeners.iterator(); - while(it.hasNext()) { - PropertyChangeListener l = (PropertyChangeListener) it.next(); - l.propertyChange(e); - } - } - - /** - * Returns the preferred size of the viewport for a view component. - * For example the preferredSize of a JList component is the size - * required to acommodate all of the cells in its list however the - * value of preferredScrollableViewportSize is the size required for - * JList.getVisibleRowCount() rows. A component without any properties - * that would effect the viewport size should just return - * getPreferredSize() here. - * - * @return The preferredSize of a JViewport whose view is this Scrollable. - * @see JViewport#getPreferredSize - */ - public Dimension getPreferredScrollableViewportSize() { - Dimension size = getPreferredSize(); - Dimension retval = new Dimension(); - retval.width = size.width > 600 ? 600 : size.width; - retval.height = size.height > 400 ? 400 : size.height; - return retval; - } - - - /** - * Components that display logical rows or columns should compute - * the scroll increment that will completely expose one new row - * or column, depending on the value of orientation. Ideally, - * components should handle a partially exposed row or column by - * returning the distance required to completely expose the item. - *

    - * Scrolling containers, like JScrollPane, will use this method - * each time the user requests a unit scroll. - * - * @param visibleRect The view area visible within the viewport - * @param orientation Either SwingConstants.VERTICAL or - * SwingConstants.HORIZONTAL. - * @param direction Less than zero to scroll up/left, - * greater than zero for down/right. - * @return The "unit" increment for scrolling in the specified direction - * @see JScrollBar#setUnitIncrement - */ - public int getScrollableUnitIncrement(Rectangle visibleRect, - int orientation, int direction) { - return 1; - } - - - /** - * Components that display logical rows or columns should compute - * the scroll increment that will completely expose one block - * of rows or columns, depending on the value of orientation. - *

    - * Scrolling containers, like JScrollPane, will use this method - * each time the user requests a block scroll. - * - * @param visibleRect The view area visible within the viewport - * @param orientation Either SwingConstants.VERTICAL or - * SwingConstants.HORIZONTAL. - * @param direction Less than zero to scroll up/left, - * greater than zero for down/right. - * @return The "block" increment for scrolling in the specified direction. - * @see JScrollBar#setBlockIncrement - */ - public int getScrollableBlockIncrement(Rectangle visibleRect, - int orientation, int direction) { - return orientation == SwingConstants.VERTICAL ? - visibleRect.height / 2 : visibleRect.width / 2; - } - - - /** - * Return true if a viewport should always force the width of this - * Scrollable to match the width of the viewport. For example a noraml - * text view that supported line wrapping would return true here, since it - * would be undesirable for wrapped lines to disappear beyond the right - * edge of the viewport. Note that returning true for a Scrollable - * whose ancestor is a JScrollPane effectively disables horizontal - * scrolling. - *

    - * Scrolling containers, like JViewport, will use this method each - * time they are validated. - * - * @return True if a viewport should force the Scrollables - * width to match its own. - */ - public boolean getScrollableTracksViewportWidth() { - return true; - } - - /** - * Return true if a viewport should always force the height of this - * Scrollable to match the height of the viewport. For example a - * columnar text view that flowed text in left to right columns - * could effectively disable vertical scrolling by returning - * true here. - *

    - * Scrolling containers, like JViewport, will use this method each - * time they are validated. - * - * @return True if a viewport should force the Scrollables - * height to match its own. - */ - public boolean getScrollableTracksViewportHeight() { - return false; - } - - - /** Class for receiving change events from the PropertyEditor objects. */ - private class EditorChangeListener implements PropertyChangeListener { - public void propertyChange(PropertyChangeEvent e) { - if(_squelchChangeEvents) return; - - PropertyEditor editor = (PropertyEditor) e.getSource(); - PropertyDescriptor prop = - (PropertyDescriptor) _editor2Prop.get(editor); - Method writer = prop.getWriteMethod(); - if(writer != null) { - try { - Object[] params = { editor.getValue() }; - writer.invoke(_value, params); - setObject(_value); - firePropertyChange( - _value, prop.getName(), null, editor.getValue()); - } - catch(IllegalAccessException ex) { - ex.printStackTrace(); - } - catch(InvocationTargetException ex) { - ex.getTargetException().printStackTrace(); - } - } - } - } - - - /** Comparator for sorting PropertyDescriptor values. */ - private static class PropertyComparator implements Comparator { - public int compare(Object o1, Object o2) { - PropertyDescriptor p1 = (PropertyDescriptor)o1; - PropertyDescriptor p2 = (PropertyDescriptor)o2; - - Integer i1 = (Integer) p1.getValue(SORT_ORDER); - Integer i2 = (Integer) p2.getValue(SORT_ORDER); - - if(i1 == null && i2 == null) { - return p1.getName().compareTo(p2.getName()); - } - else if(i1 != null) { - return i1.compareTo(i2); - } - else { - return i2.compareTo(i1) * -1; - } - } - } - - - /*----------------------------------------------------------------------*/ - - /** Class for testing this. */ - private static class TestClass implements Cloneable { - private String _String = "This string is my name."; - private String[] _StringArray = { "one", "two", "three" }; - private int _int = Integer.MIN_VALUE; - private Integer _Integer = new Integer(Integer.MAX_VALUE); - private double _double = Double.MIN_VALUE; - private Double _Double = new Double(Double.MAX_VALUE); - private Properties _Properties = System.getProperties(); - private File _File = new File("/"); - private Object _Object = new Font("Monospaced", Font.PLAIN, 12); - private JButton _button = new JButton("I'm a button!"); - - public void setName(String string) { - _String = string; - } - public String getName() { - return _String; - } - - public void setStringArray(String[] array) { - _StringArray = array; - } - public String[] getStringArray() { - return _StringArray; - } - - public void setInt(int val) { - _int = val; - } - public int getInt() { - return _int; - } - - public void setInteger(Integer val) { - _Integer = val; - } - public Integer getInteger() { - return _Integer; - } - - public void setDoub(double val) { - _double = val; - } - public double getDoub() { - return _double; - } - - public void setDouble(Double val) { - _Double = val; - } - public Double getDouble() { - return _Double; - } - - public void setProperties(Properties props) { - _Properties = props; - } - public Properties getProperties() { - return _Properties; - } - - public void setFile(File f) { - _File = f; - } - public File getFile() { - return _File; - } - - public void setButton(JButton button) { - _button = button; - } - - public JButton getButton() { - return _button; - } - - public void setObject(Object o) { - _Object = o; - } - - public Object getObject() { - return _Object; - } - - public Object clone() { - try { - return super.clone(); - } - catch(CloneNotSupportedException ex) { - return null; - } - } - } - - - /** - * Test code. - * - * @param args First arg is the class name to create - */ - public static void main(String[] args) { - - try { - Class type = null; - Object instance = null; - if(args.length > 0) { - type = Class.forName(args[0]); - instance = type.newInstance(); - } - else { - type = TestClass.class; - instance = new TestClass(); - ((TestClass)instance).setObject(new TestClass()); - } - - JFrame f = new JFrame(type.getName()); - DynamicCustomizer custom = new DynamicCustomizer(type); - custom.setObject(instance); - f.getContentPane().add(new JScrollPane(custom)); - f.pack(); - f.setVisible(true); - } - catch(Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/FilePropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/customizer/FilePropertyEditor.java deleted file mode 100644 index 1b6758a96..000000000 --- a/src/antidote/org/apache/tools/ant/gui/customizer/FilePropertyEditor.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.customizer; - -import javax.swing.*; -import javax.swing.filechooser.FileFilter; -import java.awt.Component; -import java.awt.BorderLayout; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import javax.swing.border.BevelBorder; -import java.io.File; - - -/** - * Custom property editor for File types. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class FilePropertyEditor extends AbstractPropertyEditor { - /** Area for typing in the file name. */ - private JTextField _widget = null; - /** Container for the editor. */ - private JPanel _container = null; - /** File filter to use. */ - private FileFilter _filter = null; - - /** - * Default ctor. - * - */ - public FilePropertyEditor() { - _container = new JPanel(new BorderLayout()); - - _widget = new JTextField(); - - _widget.addFocusListener(new FocusHandler(this)); - - _container.add(_widget, BorderLayout.CENTER); - - JButton b = new JButton("Browse..."); - b.addActionListener(new ActionHandler()); - _container.add(b, BorderLayout.EAST); - } - - /** - * Get the child editing component. Uses JComponent so we can have tool - * tips, etc. - * - * @return Child editing component. - */ - protected Component getChild() { - return _container; - } - - /** - * File filter to use with chooser. - * - * @param filter File filter. - */ - public void setFileFilter(FileFilter filter) { - _filter = filter; - } - - /** - * This method is intended for use when generating Java code to set - * the value of the property. It should return a fragment of Java code - * that can be used to initialize a variable with the current property - * value. - *

    - * Example results are "2", "new Color(127,127,34)", "Color.orange", etc. - * - * @return A fragment of Java code representing an initializer for the - * current value. - */ - public String getJavaInitializationString() { - return "new File(" + getAsText() + ")"; - } - - /** - * Set (or change) the object that is to be edited. Builtin types such - * as "int" must be wrapped as the corresponding object type such as - * "java.lang.Integer". - * - * @param value The new target object to be edited. Note that this - * object should not be modified by the PropertyEditor, rather - * the PropertyEditor should create a new object to hold any - * modified value. - */ - public void setValue(Object value) { - if(value == null) { - value = new File(""); - } - - if(!(value instanceof File)) { - throw new IllegalArgumentException( - value.getClass().getName() + " is not of type File"); - } - - Object old = _widget.getText(); - - _widget.setText(((File)value).getPath()); - } - - /** - * @return The value of the property. Builtin types - * such as "int" will be wrapped as the corresponding - * object type such as "java.lang.Integer". */ - public Object getValue() { - File retval = null; - retval = new File(_widget.getText()); - return retval; - } - - /** - * Set the property value by parsing a given String. May raise - * java.lang.IllegalArgumentException if either the String is - * badly formatted or if this kind of property can't be expressed - * as text. - * @param text The string to be parsed. - */ - public void setAsText(String text) throws IllegalArgumentException { - File f = new File(text); - _widget.setText(f.getPath()); - } - - /** - * @return The property value as a human editable string. - *

    Returns null if the value can't be expressed - * as an editable string. - *

    If a non-null value is returned, then the PropertyEditor should - * be prepared to parse that string back in setAsText(). - */ - public String getAsText() { - return new File(_widget.getText()).getAbsolutePath(); - } - - /** Handler for presses of the browse button. */ - private class ActionHandler implements ActionListener { - public void actionPerformed(ActionEvent e) { - JFileChooser chooser = null; - chooser = new JFileChooser(); - chooser.setSelectedFile((File) getValue()); - - - _filter = (_filter == null ? - chooser.getAcceptAllFileFilter() : _filter); - chooser.setFileFilter(_filter); - chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - if(chooser.showDialog(getChild(), "Select") == - JFileChooser.APPROVE_OPTION) { - Object oldValue = getValue(); - Object newValue = chooser.getSelectedFile(); - - setValue(newValue); - firePropertyChange(oldValue, newValue); - } - } - } - -} - - diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/IntegerPropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/customizer/IntegerPropertyEditor.java deleted file mode 100644 index 587a98906..000000000 --- a/src/antidote/org/apache/tools/ant/gui/customizer/IntegerPropertyEditor.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.customizer; - -import javax.swing.*; -import java.awt.Component; - -/** - * Custom property editor for integer types. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class IntegerPropertyEditor extends AbstractPropertyEditor { - /** Editing widget. */ - private JTextField _widget = null; - - /** - * Default ctor. - * - */ - public IntegerPropertyEditor() { - _widget = new JTextField(); - _widget.addFocusListener(new FocusHandler(this)); - } - - /** - * Get the child editing component. Uses JComponent so we can have tool - * tips, etc. - * - * @return Child editing component. - */ - protected Component getChild() { - return _widget; - } - - /** - * This method is intended for use when generating Java code to set - * the value of the property. It should return a fragment of Java code - * that can be used to initialize a variable with the current property - * value. - *

    - * Example results are "2", "new Color(127,127,34)", "Color.orange", etc. - * - * @return A fragment of Java code representing an initializer for the - * current value. - */ - public String getJavaInitializationString() { - return "new Integer(" + getAsText() + ")"; - } - - /** - * Set (or change) the object that is to be edited. Builtin types such - * as "int" must be wrapped as the corresponding object type such as - * "java.lang.Integer". - * - * @param value The new target object to be edited. Note that this - * object should not be modified by the PropertyEditor, rather - * the PropertyEditor should create a new object to hold any - * modified value. - */ - public void setValue(Object value) { - Object old = _widget.getText(); - if(!(value instanceof Integer)) { - value = new Integer(0); - } - - _widget.setText(value.toString()); - } - - /** - * @return The value of the property. Builtin types such as "int" will - * be wrapped as the corresponding object type such as "java.lang.Integer". - */ - public Object getValue() { - Integer retval = null; - try { - retval = new Integer(_widget.getText()); - } - catch(NumberFormatException ex) { - retval = new Integer(0); - _widget.setText(retval.toString()); - } - return retval; - } - - /** - * Set the property value by parsing a given String. May raise - * java.lang.IllegalArgumentException if either the String is - * badly formatted or if this kind of property can't be expressed - * as text. - * @param text The string to be parsed. - */ - public void setAsText(String text) { - Object old = _widget.getText(); - Integer val = null; - try { - val = new Integer(text); - } - catch(NumberFormatException ex) { - val = new Integer(0); - } - text = val.toString(); - _widget.setText(text); - } - - /** - * @return The property value as a human editable string. - *

    Returns null if the value can't be expressed - * as an editable string. - *

    If a non-null value is returned, then the PropertyEditor should - * be prepared to parse that string back in setAsText(). - */ - public String getAsText() { - return _widget.getText(); - } - - -} - - diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/ObjectPropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/customizer/ObjectPropertyEditor.java deleted file mode 100644 index 4b6965da8..000000000 --- a/src/antidote/org/apache/tools/ant/gui/customizer/ObjectPropertyEditor.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.customizer; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.lang.reflect.Method; -import javax.swing.border.BevelBorder; - -/** - * Custom property editor for generic Object types. Useful for - * complex objects where using the DynamicCustomizer may be useful. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ObjectPropertyEditor extends AbstractPropertyEditor { - /** Area for typing in the file name. */ - private JTextField _widget = null; - /** Container for the editor. */ - private JPanel _container = null; - /** The current object value. */ - private Object _value = null; - /** The editing button. */ - private JButton _button = null; - /** Flag to indicate that cancellation of editing is supported. */ - private boolean _supportCancel = true; - /** Original value. Only used if _supportCancel is true. */ - private Object _original = null; - - /** - * Default ctor. - * - */ - public ObjectPropertyEditor() { - _container = new JPanel(new BorderLayout()); - - _widget = new JTextField(25); - _widget.setEditable(false); - _widget.addFocusListener(new FocusHandler(this)); - _widget.setBorder( - BorderFactory.createBevelBorder(BevelBorder.LOWERED)); - - _container.add(_widget, BorderLayout.CENTER); - - _button = new JButton("Edit..."); - _button.addActionListener(new ActionHandler()); - _container.add(_button, BorderLayout.EAST); - } - - /** - * Get the child editing component. Uses JComponent so we can have tool - * tips, etc. - * - * @return Child editing component. - */ - protected Component getChild() { - return _container; - } - - - /** - * This method is intended for use when generating Java code to set - * the value of the property. It should return a fragment of Java code - * that can be used to initialize a variable with the current property - * value. - *

    - * Example results are "2", "new Color(127,127,34)", "Color.orange", etc. - * - * @return A fragment of Java code representing an initializer for the - * current value. - */ - public String getJavaInitializationString() { - return null; - } - - /** - * Set (or change) the object that is to be edited. Builtin types such - * as "int" must be wrapped as the corresponding object type such as - * "java.lang.Integer". - * - * @param value The new target object to be edited. Note that this - * object should not be modified by the PropertyEditor, rather - * the PropertyEditor should create a new object to hold any - * modified value. - * @exception IllegalArgumentException thrown if value can't be cloned. - */ - public void setValue(Object value) { - - if(_supportCancel && value != _value) { - try { - _value = makeClone(value); - } - catch(CloneNotSupportedException ex){ - // If cloning doesn't work then we can't support a "cancel" - // option on the editing dialog. - _supportCancel = false; - } - _original = value; - } - - _value = value; - - _button.setEnabled(_value != null); - - _widget.setText(getAsString(_value)); - } - - /** - * Convert the given value into some appropriate string. NB: This method - * can be continually improved to be made more and more smart over time. - * - * @param value Value to convert. - * @return String value to display. - */ - private String getAsString(Object value) { - String retval = null; - if(value == null) { - retval = ""; - } - - // We try to be smart by querying for various, logical string - // representation of the value. - if(retval == null) { - try { - Method m = value.getClass().getMethod("getName", null); - retval = (String) m.invoke(value, null); - } - catch(Exception ex) { - } - } - if(retval == null) { - try { - Method m = value.getClass().getMethod("getLabel", null); - retval = (String) m.invoke(value, null); - } - catch(Exception ex) { - } - - } - if(retval == null) { - try { - Method m = value.getClass().getMethod("getText", null); - retval = (String) m.invoke(value, null); - } - catch(Exception ex) { - } - } - - if(retval == null) { - retval = value.toString(); - } - - if(retval.length() > 256) { - retval = retval.substring(0, 253) + "..."; - } - - return retval; - } - - /** - * Attampt to make a clone of the given value. - * - * @param value Value to clone. - * @return Cloned value, or null if value given was null. - * @exception IllegalArgumentException thrown if value can't be cloned. - */ - private Object makeClone(Object value) throws CloneNotSupportedException { - Object retval = null; - if(value != null) { - try { - Method m = value.getClass().getMethod("clone", null); - retval = m.invoke(value, null); - } - catch(Throwable ex) { - throw new CloneNotSupportedException( - "This editor only supports types that have publically " + - "accessible clone() methods.\n" + - value.getClass().getName() + - " does not have such a method."); - } - } - return retval; - } - - /** - * @return The value of the property. Builtin types - * such as "int" will be wrapped as the corresponding - * object type such as "java.lang.Integer". */ - public Object getValue() { - return _value; - } - - /** - * Set the property value by parsing a given String. May raise - * java.lang.IllegalArgumentException if either the String is - * badly formatted or if this kind of property can't be expressed - * as text. - * @param text The string to be parsed. - */ - public void setAsText(String text) throws IllegalArgumentException { - throw new IllegalArgumentException("String conversion not supported."); - } - - /** - * @return The property value as a human editable string. - *

    Returns null if the value can't be expressed - * as an editable string. - *

    If a non-null value is returned, then the PropertyEditor should - * be prepared to parse that string back in setAsText(). - */ - public String getAsText() { - return null; - } - - /** Handler for presses of the edit button. */ - private class ActionHandler implements ActionListener { - public void actionPerformed(ActionEvent e) { - if(_value == null) return; - Class type = _value.getClass(); - DynamicCustomizer c = new DynamicCustomizer(type); - c.setObject(_value); - - int returnVal = JOptionPane.OK_OPTION; - if(_supportCancel) { - returnVal = JOptionPane.showConfirmDialog( - getChild(), new JScrollPane(c), "Editing...", - JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); - } - else { - JOptionPane.showMessageDialog( - getChild(), new JScrollPane(c), "Editing...", - JOptionPane.PLAIN_MESSAGE); - returnVal = JOptionPane.OK_OPTION; - } - - if(returnVal == JOptionPane.OK_OPTION) { - Object oldValue = _original; - Object newValue = _value; - - setValue(newValue); - firePropertyChange(oldValue, newValue); - } - else { - try { - _value = makeClone(_original); - } - catch(CloneNotSupportedException ex) { - // XXX log me. Shouldn't have gotten here as - // the test for cloneability should have already been done. - ex.printStackTrace(); - _supportCancel = false; - } - } - } - } - -} - - diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/PropertiesPropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/customizer/PropertiesPropertyEditor.java deleted file mode 100644 index 94743595d..000000000 --- a/src/antidote/org/apache/tools/ant/gui/customizer/PropertiesPropertyEditor.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.customizer; - -import javax.swing.*; -import javax.swing.table.AbstractTableModel; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.BorderLayout; -import java.util.*; - -/** - * Custom property editor for the Properties class. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class PropertiesPropertyEditor extends AbstractPropertyEditor { - /** Recommended size for widgets inside a JScrollPane, as communicated - * through the setPreferredScrollableViewportSize() method. */ - protected static final Dimension VIEWPORT_SIZE = new Dimension(200, 50); - - /** Container. */ - private JPanel _widget = null; - /* The current properties being edited. */ - private Properties _properties = null; - /** The table editor for the properties. */ - private JTable _table = null; - - /** - * Default ctor. - * - */ - public PropertiesPropertyEditor() { - _widget = new JPanel(new BorderLayout()); - _widget.addFocusListener(new FocusHandler(this)); - - _table = new JTable(); - _table.setPreferredScrollableViewportSize(VIEWPORT_SIZE); - JScrollPane scroller = new JScrollPane(_table); - _widget.add(BorderLayout.CENTER, scroller); - } - - /** - * Get the child editing component. Uses JComponent so we can have tool - * tips, etc. - * - * @return Child editing component. - */ - protected Component getChild() { - return _widget; - } - - /** - * This method is intended for use when generating Java code to set - * the value of the property. It should return a fragment of Java code - * that can be used to initialize a variable with the current property - * value. - *

    - * Example results are "2", "new Color(127,127,34)", "Color.orange", etc. - * - * @return A fragment of Java code representing an initializer for the - * current value. - */ - public String getJavaInitializationString() { - return "new Properties()"; - } - - /** - * Set (or change) the object that is to be edited. Builtin types such - * as "int" must be wrapped as the corresponding object type such as - * "java.lang.Integer". - * - * @param value The new target object to be edited. Note that this - * object should not be modified by the PropertyEditor, rather - * the PropertyEditor should create a new object to hold any - * modified value. - */ - public void setValue(Object value) { - if(value == null) { - value = new Properties(); - } - - if(!(value instanceof Properties)) { - throw new IllegalArgumentException( - value.getClass().getName() + " is not of type Properties."); - } - - Object old = _properties; - _properties = (Properties) ((Properties) value).clone(); - - PropertiesTableModel model = new PropertiesTableModel(); - _table.setModel(model); - _table.clearSelection(); - } - - /** - * @return The value of the property. Builtin types - * such as "int" will be wrapped as the corresponding - * object type such as "java.lang.Integer". - */ - public Object getValue() { - return _properties; - } - - /** - * Set the property value by parsing a given String. May raise - * java.lang.IllegalArgumentException if either the String is - * badly formatted or if this kind of property can't be expressed - * as text. - * @param text The string to be parsed. - */ - public void setAsText(String text) throws IllegalArgumentException { - throw new IllegalArgumentException("Cannot be expressed as a String"); - } - - /** - * @return The property value as a human editable string. - *

    Returns null if the value can't be expressed - * as an editable string. - *

    If a non-null value is returned, then the PropertyEditor should - * be prepared to parse that string back in setAsText(). - */ - public String getAsText() { - return null; - } - - /** Table model view of the Properties object. */ - private class PropertiesTableModel extends AbstractTableModel { - private static final int NAME = 0; - private static final int VALUE = 1; - - private List _keys = null; - - public PropertiesTableModel() { - // We need to store the property keys in an array - // so that the ordering is preserved. - _keys = new ArrayList(_properties.keySet()); - Collections.sort(_keys); - } - - /** - * Get the number of rows. - * - * @return Number of rows. - */ - public int getRowCount() { - return _properties.size() + 1; - } - - /** - * Get the number of columns. - * - * @return 2 - */ - public int getColumnCount() { - return 2; - } - - /** - * Get the editing and display class of the given column. - * - * @return String.class - */ - public Class getColumnClass(int column) { - return String.class; - } - - /** - * Get the header name of the column. - * - * @param column Column index. - * @return Name of the column. - */ - public String getColumnName(int column) { - // XXX fix me. - return column == NAME ? "Name" : "Value"; - } - - /** - * Determine if the given cell is editable. - * - * @param row Cell row. - * @param column Cell column. - * @return true - */ - public boolean isCellEditable(int row, int column) { - return true; - } - - /** - * Get the object at the given table coordinates. - * - * @param row Table row. - * @param column Table column. - * @return Object at location, or null if none. - */ - public Object getValueAt(int row, int column) { - if(row < _properties.size()) { - switch(column) { - case NAME: - return _keys.get(row); - case VALUE: - return _properties.getProperty((String)_keys.get(row)); - } - } - return null; - } - /** - * Set the table value at the given location. - * - * @param value Value to set. - * @param row Row. - * @param column Column. - */ - public void setValueAt(Object value, int row, int column) { - String k = null; - String v = null; - - String currKey = (String) getValueAt(row, NAME); - switch(column) { - case NAME: - k = String.valueOf(value); - if(row < _keys.size()) { - _keys.set(row, k); - } - else { - _keys.add(k); - } - String currValue = null; - if(currKey != null) { - currValue = _properties.getProperty(currKey); - _properties.remove(currKey); - } - v = currValue == null ? "" : currValue; - break; - case VALUE: - v = String.valueOf(value); - k = currKey; - if(k == null || k.length() == 0) { - k = "key-for-" + v; - } - break; - } - - if(k.length() > 0) { - _properties.setProperty(k, v); - } - - fireTableRowsUpdated(row, row); - // Fire change in outer class. - firePropertyChange(null, _properties); - } - } -} - - diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/StringArrayPropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/customizer/StringArrayPropertyEditor.java deleted file mode 100644 index fa17dfe23..000000000 --- a/src/antidote/org/apache/tools/ant/gui/customizer/StringArrayPropertyEditor.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.customizer; - -import javax.swing.*; -import javax.swing.border.BevelBorder; -import java.awt.Component; -import java.util.StringTokenizer; - -/** - * Custom property editor for String arrays. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class StringArrayPropertyEditor extends AbstractPropertyEditor { - private JTextField _widget = null; - - /** - * Default ctor. - * - */ - public StringArrayPropertyEditor() { - _widget = new JTextField() ; - _widget.setBorder( - BorderFactory.createBevelBorder(BevelBorder.LOWERED)); - _widget.addFocusListener(new FocusHandler(this)); - } - - /** - * Get the child editing component. Uses JComponent so we can have tool - * tips, etc. - * - * @return Child editing component. - */ - protected Component getChild() { - return _widget; - } - - /** - * This method is intended for use when generating Java code to set - * the value of the property. It should return a fragment of Java code - * that can be used to initialize a variable with the current property - * value. - *

    - * Example results are "2", "new Color(127,127,34)", "Color.orange", etc. - * - * @return A fragment of Java code representing an initializer for the - * current value. - */ - public String getJavaInitializationString() { - return getAsText(); - } - - /** - * Set (or change) the object that is to be edited. Builtin types such - * as "int" must be wrapped as the corresponding object type such as - * "java.lang.Integer". - * - * @param value The new target object to be edited. Note that this - * object should not be modified by the PropertyEditor, rather - * the PropertyEditor should create a new object to hold any - * modified value. - */ - public void setValue(Object value) { - if(value == null) { - value = new String[0]; - } - if(!(value instanceof String[])) { - throw new IllegalArgumentException( - "Value must be of type String[]."); - } - String old = _widget.getText(); - - String[] vals = (String[]) value; - StringBuffer buf = new StringBuffer(); - - for(int i = 0; i < vals.length; i++) { - buf.append(vals[i]); - if(i < vals.length - 1) { - buf.append(", "); - } - } - _widget.setText(buf.toString()); - } - - /** - * @return The value of the property. Builtin types such as "int" will - * be wrapped as the corresponding object type such as "java.lang.Integer". - */ - public Object getValue() { - String vals = _widget.getText(); - StringTokenizer tok = new StringTokenizer(vals,","); - String[] retval = new String[tok.countTokens()]; - for(int i = 0; i < retval.length; i++) { - retval[i] = tok.nextToken().trim(); - } - - return retval; - } - - /** - * Set the property value by parsing a given String. May raise - * java.lang.IllegalArgumentException if either the String is - * badly formatted or if this kind of property can't be expressed - * as text. - * @param text The string to be parsed. - */ - public void setAsText(String text) throws IllegalArgumentException { - Object old = _widget.getText(); - _widget.setText(text); - } - - /** - * @return The property value as a human editable string. - *

    Returns null if the value can't be expressed - * as an editable string. - *

    If a non-null value is returned, then the PropertyEditor should - * be prepared to parse that string back in setAsText(). - */ - public String getAsText() { - return _widget.getText(); - } - - -} - - diff --git a/src/antidote/org/apache/tools/ant/gui/customizer/StringPropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/customizer/StringPropertyEditor.java deleted file mode 100644 index 00b756298..000000000 --- a/src/antidote/org/apache/tools/ant/gui/customizer/StringPropertyEditor.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.customizer; - -import javax.swing.*; -import java.awt.Component; -import javax.swing.border.BevelBorder; - -/** - * Custom property editor for string types. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class StringPropertyEditor extends AbstractPropertyEditor { - private JTextArea _widget = null; - - /** - * Default ctor. - * - */ - public StringPropertyEditor() { - _widget = new JTextArea() { - public boolean isManagingFocus() { - return false; - } - }; - - _widget.setLineWrap(true); - _widget.addFocusListener(new FocusHandler(this)); - _widget.setBorder( - BorderFactory.createBevelBorder(BevelBorder.LOWERED)); - } - - /** - * Get the child editing component. Uses JComponent so we can have tool - * tips, etc. - * - * @return Child editing component. - */ - protected Component getChild() { - return _widget; - } - - /** - * This method is intended for use when generating Java code to set - * the value of the property. It should return a fragment of Java code - * that can be used to initialize a variable with the current property - * value. - *

    - * Example results are "2", "new Color(127,127,34)", "Color.orange", etc. - * - * @return A fragment of Java code representing an initializer for the - * current value. - */ - public String getJavaInitializationString() { - return getAsText(); - } - - /** - * Set (or change) the object that is to be edited. Builtin types such - * as "int" must be wrapped as the corresponding object type such as - * "java.lang.Integer". - * - * @param value The new target object to be edited. Note that this - * object should not be modified by the PropertyEditor, rather - * the PropertyEditor should create a new object to hold any - * modified value. - */ - public void setValue(Object value) { - if(value == null) { - value = ""; - } - - Object old = _widget.getText(); - _widget.setText(String.valueOf(value)); - } - - /** - * @return The value of the property. Builtin types - * such as "int" will be wrapped as the corresponding - * object type such as "java.lang.Integer". */ - public Object getValue() { - String retval = _widget.getText(); - return retval; - } - - /** - * Set the property value by parsing a given String. May raise - * java.lang.IllegalArgumentException if either the String is - * badly formatted or if this kind of property can't be expressed - * as text. - * @param text The string to be parsed. - */ - public void setAsText(String text) throws IllegalArgumentException { - Object old = _widget.getText(); - _widget.setText(text); - } - - /** - * @return The property value as a human editable string. - *

    Returns null if the value can't be expressed - * as an editable string. - *

    If a non-null value is returned, then the PropertyEditor should - * be prepared to parse that string back in setAsText(). - */ - public String getAsText() { - return _widget.getText(); - } - - -} - - diff --git a/src/antidote/org/apache/tools/ant/gui/event/AntBuildEvent.java b/src/antidote/org/apache/tools/ant/gui/event/AntBuildEvent.java deleted file mode 100644 index 29828d45b..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/AntBuildEvent.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.gui.util.StackFrame; -import org.apache.tools.ant.gui.command.Command; -import org.apache.tools.ant.gui.command.NoOpCmd; -import org.apache.tools.ant.gui.core.AppContext; -import java.util.EventObject; - -/** - * Wrapper event for the events generated during an Ant build. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class AntBuildEvent extends AntEvent { - - /** The original event we are wrapping. */ - private BuildEvent _buildEvent = null; - /** The type of event we are wrapping. */ - private BuildEventType _type = null; - - /** - * Standard ctor. - * - * @param context application context. - */ - public AntBuildEvent(AppContext context, - BuildEvent buildEvent, BuildEventType type) { - super(context); - _buildEvent = buildEvent; - _type = type; - - if(_buildEvent == null || _type == null) { - throw new IllegalArgumentException("Null parameter passed"); - } - } - - /** - * Get the wrapped build event. - * - * @return Build event. - */ - public BuildEvent getEvent() { - return _buildEvent; - } - - /** - * Get the build event type. - * - * @return Event type. - */ - public BuildEventType getType() { - return _type; - } - - /** - * Create a string representation of this. - * - * @return String representation. - */ - public String toString() { - StringBuffer buf = new StringBuffer(); - - if(_buildEvent.getMessage() != null) { - buf.append(_buildEvent.getMessage()); - buf.append('\n'); - } - - if(_buildEvent.getException() != null) { - buf.append(StackFrame.toString(_buildEvent.getException())); - } - - return buf.toString(); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/AntEvent.java b/src/antidote/org/apache/tools/ant/gui/event/AntEvent.java deleted file mode 100644 index eb0873e19..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/AntEvent.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -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.core.AppContext; -import java.util.EventObject; - -/** - * Base class for all Ant specific events. Details TBD. - * - * @version $Revision$ - * @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 getContext() { - return (AppContext) getSource(); - } - - - /** - * Override to create the appropriate default response - * command to this event. - * - * @return Command representing an appropriate response to this event. - */ - public Command createDefaultCmd() { - return new NoOpCmd(getContext()); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/BuildEventType.java b/src/antidote/org/apache/tools/ant/gui/event/BuildEventType.java deleted file mode 100644 index f04e04e23..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/BuildEventType.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.BuildListener; -import org.apache.tools.ant.BuildEvent; -import java.lang.reflect.Method; - -/** - * Enumeration class of the different contexts in which Ant will generate - * a BuildEvent. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class BuildEventType { - /** Enum value. */ - private int _value = 0; - - /** - * Standard ctor. - * - * @param value Index value. - */ - private BuildEventType(int value) { - _value = value; - } - - /** - * Get the enumeration value. - * - * @return - */ - public int getValue() { - return _value; - } - - /** - * Pseudo abstract method for firing an event to a build listener - * based on our enumation value. I overridded by the individual instances. - * - * @param e Event to fire. - * @param l Listener to send event to. - */ - public void fireEvent(BuildEvent e, BuildListener l) { - try { - Method method = - BuildListener.class.getMethod(_methodNameMap[_value], - _listenerMethodParam); - method.invoke(l, new Object[] { e }); - } - catch(Exception ex) { - // XXX log me. - ex.printStackTrace(); - } - } - - /** - * Get the enumeration value with the given index value. - * - * @param value Index value. - * @return Enumeration value. - */ - public static BuildEventType fromInt(int value) { - return _objectMap[value]; - } - - /** - * Determine if the given object is logically equal to this one. - * - * @param o Object to compare to - * @return True if equal, false otherwise. - */ - public boolean equals(Object o) { - if(o instanceof BuildEventType) { - return ((BuildEventType)o)._value == _value; - } - return false; - } - /** - * Generate a hash value. - * - * @return Hash value. - */ - public int hashValue() { - return _value; - } - - /** - * Provide a string representation of this. - * - * @return String representation. - */ - public String toString() { - return _stringMap[_value]; - } - - - /* Index values. */ - public static final int BUILD_STARTED_VAL = 0; - public static final int BUILD_FINISHED_VAL = 1; - public static final int TARGET_STARTED_VAL = 2; - public static final int TARGET_FINISHED_VAL = 3; - public static final int TASK_STARTED_VAL = 4; - public static final int TASK_FINISHED_VAL = 5; - public static final int MESSAGE_LOGGED_VAL = 6; - - /* Enumeration values. */ - public static final BuildEventType BUILD_STARTED = - new BuildEventType(BUILD_STARTED_VAL); - public static final BuildEventType BUILD_FINISHED = - new BuildEventType(BUILD_FINISHED_VAL); - public static final BuildEventType TARGET_STARTED = - new BuildEventType(TARGET_STARTED_VAL); - public static final BuildEventType TARGET_FINISHED = - new BuildEventType(TARGET_FINISHED_VAL); - public static final BuildEventType TASK_STARTED = - new BuildEventType(TASK_STARTED_VAL); - public static final BuildEventType TASK_FINISHED = - new BuildEventType(TASK_FINISHED_VAL); - public static final BuildEventType MESSAGE_LOGGED = - new BuildEventType(MESSAGE_LOGGED_VAL); - - /** Index to object mapping. */ - private static final BuildEventType[] _objectMap = { - BUILD_STARTED, - BUILD_FINISHED, - TARGET_STARTED, - TARGET_FINISHED, - TASK_STARTED, - TASK_FINISHED, - MESSAGE_LOGGED - }; - - /** String map. XXX needs to be localized. */ - private static final String[] _stringMap = { - "Build Started", - "Build Finished", - "Target Started", - "Target Finished", - "Task Started", - "Task Finished", - "Message Logged" - }; - - /** Map of corresponding method names in the BuildListener intereface. */ - private static final String[] _methodNameMap = { - "buildStarted", - "buildFinished", - "targetStarted", - "targetFinished", - "taskStarted", - "taskFinished", - "messageLogged" - }; - - private static final Class[] _listenerMethodParam = { BuildEvent.class }; -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/BuildFinishedEvent.java b/src/antidote/org/apache/tools/ant/gui/event/BuildFinishedEvent.java deleted file mode 100644 index 110f7d53d..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/BuildFinishedEvent.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.gui.core.AppContext; - - -/** - * Build finished. This event is a duplication of the information posted as - * an AntBuildEvent when a build finishes. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class BuildFinishedEvent extends AntEvent { - - /** The originating event from Ant. */ - private BuildEvent _orig = null; - - /** - * Standard ctor. - * - * @param context The application context. - * @param orig The originating event. - */ - public BuildFinishedEvent(AppContext context, BuildEvent orig) { - super(context); - _orig = orig; - } - - /** - * Get the originating event. - * - * @return Originating event. - */ - public BuildEvent getBuildEvent() { - return _orig; - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/BuildStartedEvent.java b/src/antidote/org/apache/tools/ant/gui/event/BuildStartedEvent.java deleted file mode 100644 index aa5a12326..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/BuildStartedEvent.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.gui.core.AppContext; - - -/** - * Build started. This event is a duplication of the information posted as - * an AntBuildEvent when a build starts. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class BuildStartedEvent extends AntEvent { - - /** The originating event from Ant. */ - private BuildEvent _orig = null; - - /** - * Standard ctor. - * - * @param context The application context. - * @param orig The originating event. - */ - public BuildStartedEvent(AppContext context, BuildEvent orig) { - super(context); - _orig = orig; - } - - /** - * Get the originating event. - * - * @return Originating event. - */ - public BuildEvent getBuildEvent() { - return _orig; - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/BusFilter.java b/src/antidote/org/apache/tools/ant/gui/event/BusFilter.java deleted file mode 100644 index 9cd182768..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/BusFilter.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -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$ - * @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. - */ - boolean accept(EventObject event); -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/BusMember.java b/src/antidote/org/apache/tools/ant/gui/event/BusMember.java deleted file mode 100644 index e2fd1275e..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/BusMember.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -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$ - * @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. - */ - BusFilter getBusFilter(); - - /** - * Called when an event is to be posed to the member. - * - * @param event Event to post. - * @return true if event should be propogated, false if - * it should be cancelled. - */ - boolean eventPosted(EventObject event); - -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/ConsoleNotVisibleEvent.java b/src/antidote/org/apache/tools/ant/gui/event/ConsoleNotVisibleEvent.java deleted file mode 100644 index 60d69f67d..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/ConsoleNotVisibleEvent.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; - -import org.apache.tools.ant.gui.core.*; - -/** - * Event fired when the console pane is not visible - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class ConsoleNotVisibleEvent extends AntEvent { - /** - * Standard ctor. - * - * @param context application context. - */ - public ConsoleNotVisibleEvent(AppContext context) { - super(context); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/ConsoleVisibleEvent.java b/src/antidote/org/apache/tools/ant/gui/event/ConsoleVisibleEvent.java deleted file mode 100644 index 5b0f70f10..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/ConsoleVisibleEvent.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; - -import org.apache.tools.ant.gui.core.*; - -/** - * Event fired when the console pane is visible - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class ConsoleVisibleEvent extends AntEvent { - /** - * Standard ctor. - * - * @param context application context. - */ - public ConsoleVisibleEvent(AppContext context) { - super(context); - } -} \ No newline at end of file diff --git a/src/antidote/org/apache/tools/ant/gui/event/DeleteElementEvent.java b/src/antidote/org/apache/tools/ant/gui/event/DeleteElementEvent.java deleted file mode 100644 index 1803e6cba..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/DeleteElementEvent.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.acs.ACSProjectElement; -import org.apache.tools.ant.gui.acs.ACSElement; - -/** - * FIX UP Nick - */ -public class DeleteElementEvent extends AntEvent { - - ACSElement _element = null; - - /** - * Standard ctor. - * - * @param context application context. - */ - public DeleteElementEvent(AppContext context,ACSElement e) { - super(context); - if(e == null) { - throw new IllegalArgumentException("A deleted element can't be null."); - } - _element = e; - } - - /** - * Get the newly added project. - * - * @return New project. - */ - public ACSElement getDeletedElement() { - return _element; - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/DtdDefinedElementSelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/DtdDefinedElementSelectionEvent.java deleted file mode 100644 index 73f3d7336..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/DtdDefinedElementSelectionEvent.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.acs.ACSElement; -import org.apache.tools.ant.gui.acs.ACSDtdDefinedElement; -import org.apache.tools.ant.gui.core.AppContext; - -/** - * Event indicating that a DtdDefined element was selected. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class DtdDefinedElementSelectionEvent extends ElementSelectionEvent { - /** - * Standard ctor. - * - * @param context application context. - * @param selected the selected Elements. - */ - public DtdDefinedElementSelectionEvent(AppContext context,ACSElement[] selected) { - super(context, selected); - } - - /** - * Get the selected properties. - */ - public ACSDtdDefinedElement[] getSelectedProperties() { - return (ACSDtdDefinedElement[]) getFiltered(ACSDtdDefinedElement.class); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/ElementSelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/ElementSelectionEvent.java deleted file mode 100644 index 0aa5faeee..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/ElementSelectionEvent.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.acs.*; -import org.apache.tools.ant.gui.command.Command; -import org.apache.tools.ant.gui.command.DisplayErrorCmd; -import org.apache.tools.ant.gui.core.AppContext; - -import java.lang.reflect.Array; -import java.util.*; - -/** - * Event indicating that the current set of selected targets has changed. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ElementSelectionEvent extends AntEvent { - - /** New set of selected elements. */ - private ACSElement[] _selected = null; - - /** - * Standard ctor. - * - * @param context application context. - * @param selected the selected Elements. - */ - protected ElementSelectionEvent(AppContext context, - ACSElement[] selected) { - super(context); - _selected = selected; - } - - /** - * Current set of selected elements. - * - * @return selected element set. - */ - public ACSElement[] getSelectedElements() { - return _selected; - } - - - /** - * Get only those events of a specific type. - * - * @param type Specific type to get values for, or null if none. - */ - protected ACSElement[] getFiltered(Class type) { - ACSElement[] retval = null; - List vals = new ArrayList(1); - if(_selected != null) { - for(int i = 0; i < _selected.length; i++) { - if(type.isInstance(_selected[i])) { - vals.add(_selected[i]); - } - } - } - - if(vals.size() > 0) { - retval = (ACSElement[]) Array.newInstance(type, vals.size()); - vals.toArray(retval); - } - return retval; - } - - /** - * Factory method for creating the appropriate specialization of this - * for communicating an element selection. - * - * @param context App context. - * @param selected The set of selected events. The last elemetn in the - * array is used to determine the specialization of this - * that should be returned. - * @return Event to communicate selection to. - */ - public static ElementSelectionEvent createEvent(AppContext context, - ACSElement[] selected) { - ElementSelectionEvent retval = null; - - if(selected != null && selected.length > 0) { - Class type = selected[selected.length - 1].getClass(); - if(ACSTargetElement.class.isAssignableFrom(type)) { - retval = new TargetSelectionEvent(context, selected); - } - else if(ACSTaskElement.class.isAssignableFrom(type)) { - retval = new TaskSelectionEvent(context, selected); - } - else if(ACSPropertyElement.class.isAssignableFrom(type)) { - retval = new PropertySelectionEvent(context, selected); - } - else if(ACSProjectElement.class.isAssignableFrom(type)) { - retval = new ProjectSelectedEvent( - context, (ACSProjectElement) selected[0]); - } - else if(ACSDtdDefinedElement.class.isAssignableFrom(type)) { - retval = new DtdDefinedElementSelectionEvent( - context, selected); - } - else { - // For elements without a specific event - // type just send and instance of this. - retval = new ElementSelectionEvent(context, selected); - } - } - else { - retval = new NullSelectionEvent(context); - } - - return retval; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/ErrorEvent.java b/src/antidote/org/apache/tools/ant/gui/event/ErrorEvent.java deleted file mode 100644 index dba93c9fe..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/ErrorEvent.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.core.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$ - * @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() { - Command retval = new DisplayErrorCmd(getContext(), _message, _ex); - return retval; - } - - /** - * 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(); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/EventBus.java b/src/antidote/org/apache/tools/ant/gui/event/EventBus.java deleted file mode 100644 index d37f83954..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/EventBus.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; - -import java.util.*; -import javax.swing.SwingUtilities; -/** - * 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.
    - * - * NB: This class is overly simple right now, but will eventually - * be expanded to do better event filtering, interrupt levels, etc. - * - * @version $Revision$ - * @author Simeon Fitch -*/ -public class EventBus { - /** 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 = 1; - /** The default "monitoring" interrupt level, used by members who - * are only listeners/monitors of events. */ - public static final int MONITORING = 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) { - EventDispatcher disp = new EventDispatcher(event); - - // Events need to be dispatched on the AWTEvent thread, as the UI - // components assume that. - if(SwingUtilities.isEventDispatchThread()) { - disp.run(); - } - else { - SwingUtilities.invokeLater(disp); - } - } - - /** Class that performs the duty of dispatching events to the members. */ - private class EventDispatcher implements Runnable { - /** Event to dispatch. */ - private EventObject _event = null; - - /** - * Standard ctor. - * - * @param event Event to dispatch. - */ - public EventDispatcher(EventObject event) { - _event = event; - } - - /** - * Perform dispatching. - * - */ - public void run() { - synchronized(_memberSet) { - outerLoop: - 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)) { - // If false then callee canceled the event - // propogation. - if(!next.eventPosted(_event)) { - break outerLoop; - } - } - } - } - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/NewBaseElementEvent.java b/src/antidote/org/apache/tools/ant/gui/event/NewBaseElementEvent.java deleted file mode 100644 index a45113c5f..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/NewBaseElementEvent.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.acs.ACSProjectElement; -import org.apache.tools.ant.gui.acs.ACSElement; - -/** - * Event indicating that a new node was added. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class NewBaseElementEvent extends AntEvent implements NewElementEvent { - - ACSElement _element = null; - - /** - * Standard ctor. - * - * @param context application context. - */ - public NewBaseElementEvent(AppContext context,ACSElement e) { - super(context); - if(e == null) { - throw new IllegalArgumentException("A new element can't be null."); - } - _element = e; - } - - /** - * Get the element. - * - * @return New project. - */ - public ACSElement getNewElement() { - return _element; - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/NewElementEvent.java b/src/antidote/org/apache/tools/ant/gui/event/NewElementEvent.java deleted file mode 100644 index 2b8474ade..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/NewElementEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.acs.ACSElement; -/** - * Tag interface for indicating that an event is related to creating new - * build definition elements. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public interface NewElementEvent { - /** - * Get the element that has been added. - * - * @return New element. - */ - ACSElement getNewElement(); -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/NewProjectEvent.java b/src/antidote/org/apache/tools/ant/gui/event/NewProjectEvent.java deleted file mode 100644 index 8515110eb..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/NewProjectEvent.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.acs.ACSProjectElement; -import org.apache.tools.ant.gui.acs.ACSElement; - -/** - * Event providing notification that a new project has been - * created or opened and selected. NB: Still not convinced that - * subclassing ProjectSelectedEvent is the correct thing to - * do, but it saves some time right now. It basically - * assumes that any new project added to the project manager - * is then selected. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class NewProjectEvent extends ProjectSelectedEvent - implements NewElementEvent { - - /** - * Standard ctor. - * - * @param context application context. - */ - public NewProjectEvent( - AppContext context, ACSProjectElement project) { - super(context, project); - if(project == null) { - throw new IllegalArgumentException("A new project can't be null."); - } - } - - /** - * Get the newly added project. - * - * @return New project. - */ - public ACSElement getNewElement() { - return getSelectedProject(); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/NewPropertyEvent.java b/src/antidote/org/apache/tools/ant/gui/event/NewPropertyEvent.java deleted file mode 100644 index 08a169dd4..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/NewPropertyEvent.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.acs.ACSElement; -import org.apache.tools.ant.gui.acs.ACSPropertyElement; -import org.apache.tools.ant.gui.core.AppContext; - -/** - * Event fired when a new property is created. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class NewPropertyEvent extends PropertySelectionEvent - implements NewElementEvent { - - /** - * Standard ctor. - * - * @param context application context. - * @param prop the new property. - */ - public NewPropertyEvent(AppContext context, - ACSPropertyElement prop) { - super(context, new ACSElement[] { prop }); - if(prop == null) { - throw new IllegalArgumentException( - "A new property can't be null."); - } - } - - /** - * Get the newly added task. - * - * @return New task. - */ - public ACSElement getNewElement() { - return getSelectedProperties()[0]; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/NewTargetEvent.java b/src/antidote/org/apache/tools/ant/gui/event/NewTargetEvent.java deleted file mode 100644 index 75a099a7c..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/NewTargetEvent.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.acs.ACSElement; -import org.apache.tools.ant.gui.acs.ACSTargetElement; -import org.apache.tools.ant.gui.core.AppContext; - -/** - * Event fired when a new target is created. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class NewTargetEvent extends TargetSelectionEvent - implements NewElementEvent { - - /** - * Standard ctor. - * - * @param context application context. - * @param target the new target. - */ - public NewTargetEvent(AppContext context, - ACSTargetElement target) { - super(context, new ACSElement[] { target }); - if(target == null) { - throw new IllegalArgumentException("A new target can't be null."); - } - } - - /** - * Get the newly added target. - * - * @return New target. - */ - public ACSElement getNewElement() { - return getSelectedTargets()[0]; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/NewTaskEvent.java b/src/antidote/org/apache/tools/ant/gui/event/NewTaskEvent.java deleted file mode 100644 index 72a20ee03..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/NewTaskEvent.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.acs.ACSElement; -import org.apache.tools.ant.gui.acs.ACSTaskElement; -import org.apache.tools.ant.gui.core.AppContext; - -/** - * Event fired when a new target is created. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class NewTaskEvent extends TaskSelectionEvent - implements NewElementEvent { - - /** - * Standard ctor. - * - * @param context application context. - * @param target the new task. - */ - public NewTaskEvent(AppContext context, - ACSTaskElement task) { - super(context, new ACSElement[] { task }); - if(task == null) { - throw new IllegalArgumentException("A new task can't be null."); - } - } - - /** - * Get the newly added task. - * - * @return New task. - */ - public ACSElement getNewElement() { - return getSelectedTasks()[0]; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/NullSelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/NullSelectionEvent.java deleted file mode 100644 index 7439fd8dc..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/NullSelectionEvent.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.acs.ACSElement; -import org.apache.tools.ant.gui.core.AppContext; - -/** - * Event fired when no elements are selected. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class NullSelectionEvent extends ElementSelectionEvent { - /** - * Standard ctor. - * - * @param context application context. - * @param selected the selected Elements. - */ - public NullSelectionEvent(AppContext context) { - super(context, null); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/OpenRequestEvent.java b/src/antidote/org/apache/tools/ant/gui/event/OpenRequestEvent.java deleted file mode 100644 index 4f3cd60c4..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/OpenRequestEvent.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.core.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$ - * @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() { - LoadFileCmd load = new LoadFileCmd(getContext()); - load.setFile(_file); - return load; - } -} - - diff --git a/src/antidote/org/apache/tools/ant/gui/event/ProjectClosedEvent.java b/src/antidote/org/apache/tools/ant/gui/event/ProjectClosedEvent.java deleted file mode 100644 index a157cbd28..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/ProjectClosedEvent.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.core.AppContext; - - -/** - * Provides notification that the project was closed. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ProjectClosedEvent extends AntEvent { - - /** - * Standard ctor. - * - * @param context The application context. - */ - public ProjectClosedEvent(AppContext context) { - super(context); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/ProjectSelectedEvent.java b/src/antidote/org/apache/tools/ant/gui/event/ProjectSelectedEvent.java deleted file mode 100644 index 86dab9c51..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/ProjectSelectedEvent.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.acs.ACSProjectElement; -import org.apache.tools.ant.gui.acs.ACSElement; - -/** - * Event providing notification of a change in the currently selected project. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ProjectSelectedEvent extends ElementSelectionEvent { - /** The selected project. */ - private ACSProjectElement _project = null; - - /** - * Standard ctor. - * - * @param context application context. - */ - public ProjectSelectedEvent( - AppContext context, ACSProjectElement project) { - super(context, new ACSElement[] { project }); - _project = project; - } - - /** - * Get the selected project, or null if there are no - * open projects. - * - * @return Selected project, or null if no projects selected. - */ - public ACSProjectElement getSelectedProject() { - return _project; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/PropertySelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/PropertySelectionEvent.java deleted file mode 100644 index 5d2a53276..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/PropertySelectionEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.acs.ACSElement; -import org.apache.tools.ant.gui.acs.ACSPropertyElement; -import org.apache.tools.ant.gui.core.AppContext; - -/** - * Event fired when one or more tasks are selected. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class PropertySelectionEvent extends ElementSelectionEvent { - /** - * Standard ctor. - * - * @param context application context. - * @param selected the selected Elements. - */ - public PropertySelectionEvent(AppContext context, - ACSElement[] selected) { - super(context, selected); - } - - /** - * Get the selected properties. - * - */ - public ACSPropertyElement[] getSelectedProperties() { - return (ACSPropertyElement[]) getFiltered(ACSPropertyElement.class); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/RefreshDisplayEvent.java b/src/antidote/org/apache/tools/ant/gui/event/RefreshDisplayEvent.java deleted file mode 100644 index f6996d45b..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/RefreshDisplayEvent.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; - -import org.apache.tools.ant.gui.core.*; -import org.apache.tools.ant.gui.command.*; - -/** - * Request to show the console pane - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class RefreshDisplayEvent extends AntEvent { - /** - * Standard ctor. - * - * @param context application context. - */ - public RefreshDisplayEvent(AppContext context) { - super(context); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/ShowConsoleEvent.java b/src/antidote/org/apache/tools/ant/gui/event/ShowConsoleEvent.java deleted file mode 100644 index c1498ecea..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/ShowConsoleEvent.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; - -import org.apache.tools.ant.gui.core.*; -import org.apache.tools.ant.gui.command.*; - -/** - * Request to show the console pane - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class ShowConsoleEvent extends AntEvent { - /** - * Standard ctor. - * - * @param context application context. - */ - public ShowConsoleEvent(AppContext context) { - super(context); - } - - /** - * Create the appropriate response command to this event, which is to - * show the console pane. - * - * @return ShowOrHideConsoleCmd command. - */ - public Command createDefaultCmd() { - return new ShowOrHideConsoleCmd(getContext(), true); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/TargetSelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/TargetSelectionEvent.java deleted file mode 100644 index 8ae33e2a6..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/TargetSelectionEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.acs.ACSElement; -import org.apache.tools.ant.gui.acs.ACSTargetElement; -import org.apache.tools.ant.gui.core.AppContext; - -/** - * Event fired when one or more targets are selected. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class TargetSelectionEvent extends ElementSelectionEvent { - /** - * Standard ctor. - * - * @param context application context. - * @param selected the selected Elements. - */ - public TargetSelectionEvent(AppContext context, - ACSElement[] selected) { - super(context, selected); - } - - /** - * Get the selected targets. - * - */ - public ACSTargetElement[] getSelectedTargets() { - return (ACSTargetElement[]) getFiltered(ACSTargetElement.class); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/event/TaskSelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/TaskSelectionEvent.java deleted file mode 100644 index 69f703b20..000000000 --- a/src/antidote/org/apache/tools/ant/gui/event/TaskSelectionEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.acs.ACSElement; -import org.apache.tools.ant.gui.acs.ACSTaskElement; -import org.apache.tools.ant.gui.core.AppContext; - -/** - * Event fired when one or more tasks are selected. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class TaskSelectionEvent extends ElementSelectionEvent { - /** - * Standard ctor. - * - * @param context application context. - * @param selected the selected Elements. - */ - public TaskSelectionEvent(AppContext context, - ACSElement[] selected) { - super(context, selected); - } - - /** - * Get the selected tasks. - * - */ - public ACSTaskElement[] getSelectedTasks() { - return (ACSTaskElement[]) getFiltered(ACSTaskElement.class); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/ide/EmacsNotifier.java b/src/antidote/org/apache/tools/ant/gui/ide/EmacsNotifier.java deleted file mode 100644 index 6497cc22e..000000000 --- a/src/antidote/org/apache/tools/ant/gui/ide/EmacsNotifier.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.gui.ide; - -import org.apache.tools.ant.taskdefs.ExecTask; -import org.apache.tools.ant.Project; -import java.util.StringTokenizer; -import java.io.File; - -/** - * FileErrorNotifier specialization for sending file error - * messages to emacs via the emacsclient command. This - * command must be in the runtime path of the JVM for - * it to be found. - *

    Install the notifier by running Ant as follows:
    - * - *   ant -listener net.noemis.ant.EmacsNotifier - * - * - * @version $Revision$ - * @author Simeon H.K. Fitch */ -public class EmacsNotifier extends FileErrorNotifier { - /** Command to run to communicate with emacs. */ - // XXX This should only be a default. A property should be checked - // for the actual version. Should Project.getProperty() or - // Project.getUserProperty() be used??? - private static final String EMACS = "emacsclient"; - - /** - * Called when a message has been logged indicating that - * there is an error of some sort at the given file and - * line number. Sends a message bto emacs to make emacs - * visit the file and place the mark at the source of - * the error. - * - * @param file File containing the error. - * @param lineNum Line number of error. - */ - protected void fireFileErrorNotification( - Project project, File file, int lineNum) { - // Launch our command using the built in exec support. - ExecTask exec = (ExecTask) project.createTask("exec"); - // Construct the command to communicate with emacs. - // Command has the form: - // emacsclient [-n] [--no-wait] [+LINENUMBER] FILENAME - exec.setExecutable(EMACS); - exec.createArg().setValue("-n"); - exec.createArg().setValue("--no-wait"); - exec.createArg().setValue("+" + lineNum); - exec.createArg().setValue(file.toString()); - exec.setFailonerror(false); - exec.execute(); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/ide/FileErrorNotifier.java b/src/antidote/org/apache/tools/ant/gui/ide/FileErrorNotifier.java deleted file mode 100644 index 3f35ac42c..000000000 --- a/src/antidote/org/apache/tools/ant/gui/ide/FileErrorNotifier.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.gui.ide; - -import org.apache.tools.ant.BuildListener; -import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.Project; -import java.util.StringTokenizer; -import java.io.File; - -/** - * Abstract base class for BuildListener specializations interested - * in notification of build errors in source files. - * - * @version $Revision$ - * @author Simeon H.K. Fitch - */ -abstract class FileErrorNotifier implements BuildListener { - /** Command to run to communicate with emacs. */ - private static final String EMACS = "emacsclient"; - - /** - * Fired whenever a message is logged. Parses error messages looking - * for a filename and line number specification, which when found - * is then sent to the method fireFileErrorNotification() - * source of the error. Only the first error is processed. - * - * @param event Incoming event that is filtered for error messages. - */ - public void messageLogged(BuildEvent event) { - if(event.getPriority() == Project.MSG_ERR || - event.getPriority() == Project.MSG_WARN) { - StringTokenizer tok = new StringTokenizer(event.getMessage(), ":"); - File file = null; - int line = -1; - - if(tok.hasMoreTokens()) { - file = new File(tok.nextToken()); - if(tok.hasMoreTokens()) { - try { - line = Integer.parseInt(tok.nextToken()); - } - catch(NumberFormatException ex) { - // Allow execption to fall through as we test - // success by the value of 'line' below. - } - } - } - - // Test for successful filename and line number detection. - if(file != null && line > 0 && file.exists()) { - // Since we only want to trigger on the first error, - // remove ourself from being notified of others. - // XXX are there any reasons this should occur after - // notification? - event.getProject().removeBuildListener(this); - - // Send notification. - fireFileErrorNotification(event.getProject(), file, line); - } - } - } - - /** - * Called when a message has been logged indicating that there - * is an error of some sort at the given file and line number. - * - * @param file File containing the error. - * @param lineNum Line number of error. - */ - protected abstract void fireFileErrorNotification( - Project project, File file, int lineNum); - - // Event types that are ignored. Looks like we really need a - // BuildAdapter class... - /** Ignored */ - public void buildStarted(BuildEvent event) { - } - /** Ignored */ - public void buildFinished(BuildEvent event) { - } - /** Ignored */ - public void targetStarted(BuildEvent event) { - } - /** Ignored */ - public void targetFinished(BuildEvent event) { - } - /** Ignored */ - public void taskStarted(BuildEvent event) { - } - /** Ignored */ - public void taskFinished(BuildEvent event) { - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/modules/TargetMonitor.java b/src/antidote/org/apache/tools/ant/gui/modules/TargetMonitor.java deleted file mode 100644 index f3d582cc3..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/TargetMonitor.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.modules; -import org.apache.tools.ant.gui.core.*; -import org.apache.tools.ant.gui.event.*; -import org.apache.tools.ant.gui.acs.ACSElement; -import org.apache.tools.ant.gui.acs.ACSTargetElement; -import org.apache.tools.ant.gui.acs.ElementTreeSelectionModel; -import javax.swing.*; -import javax.swing.plaf.ComponentUI; -import javax.swing.text.Document; -import java.awt.BorderLayout; -import java.awt.Insets; -import java.awt.Dimension; -import java.util.EventObject; - -/** - * A widget for displaying the currently selected targets. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class TargetMonitor extends AntModule { - - /** Place to display selected targets. */ - private JLabel _text = null; - - /** Default text. */ - private String _defText = null; - - /** - * Default ctor. - * - */ - public TargetMonitor() { - } - - /** - * Using the given AppContext, initialize the display. - * - * @param context Application context. - */ - public void contextualize(AppContext context) { - setContext(context); - context.getEventBus().addMember(EventBus.RESPONDING, new Handler()); - - setLayout(new BorderLayout()); - - _text = new JLabel(); - _text.setForeground(UIManager.getColor("TextField.foreground")); - add(BorderLayout.NORTH, _text); - - - _defText = context.getResources().getString(getClass(), "defText"); - setText(_defText); - } - - /** - * Set the displayed text. - * - * @param text Text to display. - */ - private void setText(String text) { - _text.setText("  " + text + ""); - } - - - /** 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. - * @return true if event should be propogated, false if - * it should be cancelled. - */ - public boolean eventPosted(EventObject event) { - ElementSelectionEvent e = (ElementSelectionEvent) event; - String text = _defText; - ACSElement[] selected = e.getSelectedElements(); - - if(selected != null && selected.length > 0) { - StringBuffer buf = new StringBuffer(); - String name = null; - - for(int i = 0; i < selected.length; i++) { - if(selected[i] instanceof ACSTargetElement) { - name = ((ACSTargetElement)selected[i]).getName(); - if( buf.toString().indexOf( name ) < 0 ) { - if(buf.length() > 0) { - buf.append(", "); - } - buf.append( name ); - } - } - } - - if(buf.length() > 0) { - text = buf.toString(); - } - } - - setText(text); - - return true; - } - } - - /** 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 ElementSelectionEvent; - } - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/modules/console/BuildConsole.java b/src/antidote/org/apache/tools/ant/gui/modules/console/BuildConsole.java deleted file mode 100644 index a2c1ebe08..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/console/BuildConsole.java +++ /dev/null @@ -1,356 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.modules.console; - -import org.apache.tools.ant.gui.core.AntModule; -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.*; -import javax.swing.*; -import javax.swing.plaf.ComponentUI; -import javax.swing.text.*; -import java.awt.BorderLayout; -import java.awt.FlowLayout; -import java.awt.Dimension; -import java.awt.Color; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; -import java.util.EventObject; -import java.util.Date; - -/** - * Logging console display. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class BuildConsole extends AntModule { - /** Area where messages are printed. */ - private JTextPane _text = null; - /** Selection of logging levels. */ - private JComboBox _logLevel = null; - /** Display styles. */ - private ConsoleStyleContext _styles = null; - /** ClearLog Button. */ - private JButton _clearLog = null; - - /** - * Default ctor. - */ - public BuildConsole() { - } - - - /** - * Using the given AppContext, initialize the display. - * - * @param context Application context. - */ - public void contextualize(AppContext context) { - setContext(context); - context.getEventBus().addMember(EventBus.MONITORING, new Handler()); - setLayout(new BorderLayout()); - - _styles = new ConsoleStyleContext(); - _text = new JTextPane(_styles.getStyledDocument()); - _text.setEditable(false); - JScrollPane scroller = new JScrollPane(_text); - scroller.setVerticalScrollBarPolicy( - JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - add(BorderLayout.CENTER, scroller); - - JPanel controls = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JLabel label = new JLabel( - context.getResources().getString(getClass(), "logLevel")); - controls.add(label); - _logLevel = new JComboBox(LogLevelEnum.getValues()); - _logLevel.setSelectedItem(LogLevelEnum.INFO); - controls.add(_logLevel); - - // Padding. - controls.add(Box.createHorizontalStrut(10)); - _clearLog = new JButton( - context.getResources().getString( - getClass(), "clearLog")); - _clearLog.addActionListener(new ActionHandler()); - controls.add(_clearLog); - - add(BorderLayout.NORTH, controls); - - /** Anonymous class to respond to resize envents and - * post ConsoleNotVisibleEvent or - * ConsoleVisibleEvent events. - */ - addComponentListener(new ComponentAdapter() { - public void componentResized(ComponentEvent e) { - AppContext c = BuildConsole.this.getContext(); - if (BuildConsole.this.getHeight() == 0) { - c.getEventBus().postEvent(new ConsoleNotVisibleEvent(c)); - } else { - c.getEventBus().postEvent(new ConsoleVisibleEvent(c)); - } - } - public void componentHidden(ComponentEvent e) {} - public void componentMoved(ComponentEvent e) {} - public void componentShown(ComponentEvent e) {} - }); - - } - - - /** - * Clear the contents of the console. - * - */ - private void clearDisplay() { - Document doc = _text.getDocument(); - try { - doc.remove(0, doc.getLength()); - } - catch(Exception ex) { - // Intentionally ignored. - } - } - - /** 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. - * @return true if event should be propogated, false if - * it should be cancelled. - */ - public boolean eventPosted(EventObject event) { - if(event instanceof ProjectSelectedEvent) { - return true; - } - - AntBuildEvent buildEvent = (AntBuildEvent) event; - Style style = null; - String text = null; - - switch(buildEvent.getType().getValue()) { - case BuildEventType.BUILD_STARTED_VAL: - - case BuildEventType.BUILD_FINISHED_VAL: - text = buildEvent.getType().toString() + - " (" + new Date().toString() + ")"; - style = _styles.getHeadingStyle(); - break; - case BuildEventType.TARGET_STARTED_VAL: - text = buildEvent.getEvent().getTarget().getName() + ":"; - style = _styles.getSubheadingStyle(); - break; - case BuildEventType.TARGET_FINISHED_VAL: - case BuildEventType.TASK_STARTED_VAL: - case BuildEventType.TASK_FINISHED_VAL: - break; - case BuildEventType.MESSAGE_LOGGED_VAL: - // Filter out events that are below our - // selected filterint level. - LogLevelEnum level = - (LogLevelEnum) _logLevel.getSelectedItem(); - int priority = buildEvent.getEvent().getPriority(); - if(priority <= level.getValue()) { - text = buildEvent.toString(); - style = _styles.getStyle(LogLevelEnum.fromInt(priority)); - } - break; - } - - if(text != null) { - try { - Document doc = _text.getDocument(); - doc.insertString(doc.getLength(), text, style); - doc.insertString(doc.getLength(), "\n", null); - } - catch(Exception ex) { - // XXX log me. - ex.printStackTrace(); - } - } - - return true; - } - } - - /** Handles press of the ClearLog button. */ - private class ActionHandler implements java.awt.event.ActionListener { - public void actionPerformed(java.awt.event.ActionEvent e) { - if (e.getSource() == _clearLog) clearDisplay(); - } - } - - /** 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 AntBuildEvent || - event instanceof ProjectSelectedEvent; - } - } - - /** Style set for pretty display of the console messages. */ - private static class ConsoleStyleContext extends StyleContext { - /** Name of the style used for headings. */ - public static final String HEADING_STYLE = "headingStyle"; - /** Name of the style used for subheadings. */ - public static final String SUBHEADING_STYLE = "subheadingStyle"; - - /** XXX temporary list of style colors. To go away once a real set of - * properties is implemented... */ - private static final Color[] _colors = { - Color.red, - Color.magenta, - Color.black, - Color.darkGray, - Color.blue - }; - - /** - * Default ctor. - * - */ - public ConsoleStyleContext() { - Style defaultStyle = getStyle(DEFAULT_STYLE); - StyleConstants.setFontSize(defaultStyle, 12); - - Style msgBase = addStyle("msgBase", defaultStyle); - StyleConstants.setFontFamily(msgBase, "Monospaced"); - - LogLevelEnum[] levels = LogLevelEnum.getValues(); - for(int i = 0; i < levels.length; i++) { - Style curr = addStyle(levels[i].toString(), msgBase); - StyleConstants.setFontSize(curr, 10); - StyleConstants.setForeground(curr, _colors[i]); - } - - Style heading = addStyle(HEADING_STYLE, defaultStyle); - StyleConstants.setFontFamily(heading, "SansSerif"); - StyleConstants.setBold(heading, true); - StyleConstants.setUnderline(heading, true); - - Style subheading = addStyle(SUBHEADING_STYLE, heading); - StyleConstants.setFontSize(subheading, 10); - StyleConstants.setUnderline(subheading, false); - } - - /** - * Get the style to use for the given logging level. - * - * @param level Logging level. - * @return Style to use for display. - */ - Style getStyle(LogLevelEnum level) { - Style retval = getStyle(level.toString()); - return retval == null ? getDefaultStyle() : retval; - } - - /** - * Get the default style. - * - * @return Default style. - */ - Style getDefaultStyle() { - return getStyle(DEFAULT_STYLE); - } - - /** - * Get the style to use for headings. - * - * @return Heading style. - */ - Style getHeadingStyle() { - return getStyle(HEADING_STYLE); - } - - /** - * Get the style to use for subheadings. - * - * @return Subheading style. - */ - Style getSubheadingStyle() { - return getStyle(SUBHEADING_STYLE); - } - - /** - * Get a StyledDocument initialized with this. - * - * @return SytledDocument. - */ - StyledDocument getStyledDocument() { - DefaultStyledDocument retval = new DefaultStyledDocument(this); - retval.setLogicalStyle(0, getDefaultStyle()); - return retval; - } - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/modules/console/LogLevelEnum.java b/src/antidote/org/apache/tools/ant/gui/modules/console/LogLevelEnum.java deleted file mode 100644 index fbf9c674b..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/console/LogLevelEnum.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.modules.console; - -/** - * Enumeration class of the different log levels. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class LogLevelEnum { - /** Enum value. */ - private int _value = 0; - - /** - * Standard ctor. - * - * @param value Index value. - */ - private LogLevelEnum(int value) { - _value = value; - } - - /** - * Get the enumeration value. - * - * @return - */ - public int getValue() { - return _value; - } - - /** - * Get the enumeration value with the given index value. - * - * @param value Index value. - * @return Enumeration value. - */ - public static LogLevelEnum fromInt(int value) { - return _objectMap[value]; - } - - /** - * Get the set of enumeration values. - * - * @return Value set. - */ - public static LogLevelEnum[] getValues() { - return _objectMap; - } - - /** - * Determine if the given object is logically equal to this one. - * - * @param o Object to compare to - * @return True if equal, false otherwise. - */ - public boolean equals(Object o) { - if(o instanceof LogLevelEnum) { - return ((LogLevelEnum)o)._value == _value; - } - return false; - } - /** - * Generate a hash value. - * - * @return Hash value. - */ - public int hashValue() { - return _value; - } - - /** - * Provide a string representation of this. - * - * @return String representation. - */ - public String toString() { - return _stringMap[_value]; - } - - - /* Index values. */ - public static final int ERROR_VAL = 0; - public static final int WARNING_VAL = 1; - public static final int INFO_VAL = 2; - public static final int VERBOSE_VAL = 3; - public static final int DEBUG_VAL = 4; - - /* Enumeration values. */ - public static final LogLevelEnum ERROR = - new LogLevelEnum(ERROR_VAL); - public static final LogLevelEnum WARNING = - new LogLevelEnum(WARNING_VAL); - public static final LogLevelEnum INFO = - new LogLevelEnum(INFO_VAL); - public static final LogLevelEnum VERBOSE = - new LogLevelEnum(VERBOSE_VAL); - public static final LogLevelEnum DEBUG = - new LogLevelEnum(DEBUG_VAL); - - /** Index to object mapping. */ - private static final LogLevelEnum[] _objectMap = { - ERROR, WARNING, INFO, VERBOSE, DEBUG - }; - - /** String map. XXX needs to be localized. */ - private static final String[] _stringMap = { - "Error", "Warning", "Info", "Verbose", "Debug" - }; - -} diff --git a/src/antidote/org/apache/tools/ant/gui/modules/edit/DependentTargetChooser.java b/src/antidote/org/apache/tools/ant/gui/modules/edit/DependentTargetChooser.java deleted file mode 100755 index f1d31955c..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/edit/DependentTargetChooser.java +++ /dev/null @@ -1,376 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS ConstrIBUTORS 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 - * . - */ -package org.apache.tools.ant.gui.modules.edit; - -import java.util.List; -import java.util.ArrayList; - -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import java.awt.BorderLayout; -import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.Dimension; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.JButton; -import javax.swing.JScrollPane; -import javax.swing.ListSelectionModel; -import javax.swing.ImageIcon; -import javax.swing.JTable; -import javax.swing.table.TableColumn; - -import org.apache.tools.ant.gui.util.WindowUtils; -import org.apache.tools.ant.gui.acs.ACSProjectElement; -import org.apache.tools.ant.gui.acs.ACSTargetElement; -import org.apache.tools.ant.gui.core.ResourceManager; - -/** - * Dialog for choosing dependent targes comfortable. - * - * @version $Revision$ - * @author Christoph Wilhelms - */ -public class DependentTargetChooser extends JDialog { - // "Business"-Object - private ACSTargetElement _target = null; - // Tables - private JTable _targetsTable = null; - // Major Elements; - private JPanel _commandButtonPanel = null; - // CommandButtons - private JButton _ok = null; - private JButton _cancel = null; - // common - private ResourceManager _resources = new ResourceManager(); - - private static ActionHandler _handler = null; - - /** - * Constructor needs a parent Frame - */ - public DependentTargetChooser (Frame parentFrame) { - this (parentFrame, null); - } - - /** - * Constructor needs a parent Frame, target can be set later - */ - public DependentTargetChooser (Frame parentFrame, ACSTargetElement target) { - super(parentFrame, true); - - _handler = new ActionHandler(); // get the ActionHandler ready - - // Dialog settings - setTitle("Select dependent targets"); - setDefaultCloseOperation(HIDE_ON_CLOSE); - - // Container - JPanel container = new JPanel(); - this.setContentPane(container); - container.setLayout(new BorderLayout()); - - JScrollPane tableScrollPane = new JScrollPane(); - tableScrollPane.setViewportView(getTargetsTable()); - - // Populate container - container.add(getCommandButtonPanel(), BorderLayout.SOUTH); - container.add(tableScrollPane, BorderLayout.CENTER); - - // Apply model - must be done this late, because it relies - // on an instntiated GUI - setTarget(target); - - // Set an initial size and pack it - container.setPreferredSize(new Dimension(350,250)); - pack(); - } - - - /** - * Lazily get the commandButtonPanel - * @return the created JPanel - */ - private JPanel getCommandButtonPanel() { - if (_commandButtonPanel == null) { - _commandButtonPanel = new JPanel(); - FlowLayout btnLayout = new FlowLayout(); - btnLayout.setAlignment(FlowLayout.RIGHT); - _commandButtonPanel.setLayout(btnLayout); - - _ok = new JButton(_resources.getString(getClass(), "ok")); - _ok.setMnemonic('O'); - _ok.addActionListener(_handler); - getRootPane().setDefaultButton(_ok); - getRootPane().setDefaultButton(_ok); - _cancel = new JButton(_resources.getString(getClass(), "cancel")); - _cancel.setMnemonic('c'); - _cancel.addActionListener(_handler); - - _commandButtonPanel.add(_ok); - _commandButtonPanel.add(_cancel); - } - return _commandButtonPanel; - } - - /** - * Writer method for the model-element - * @param ACSTargetElement the new Target model element. - */ - public void setTarget(ACSTargetElement newTarget) { - _target = newTarget; - - // fill source-TableModel with "sister-targets" - SelectableTargetsTableModel model = (SelectableTargetsTableModel) _targetsTable.getModel(); - model.setTargets(getCoTargets(newTarget)); - model.preselectTargets(newTarget.getDepends()); - model.fireTableDataChanged(); - } - - /** - * Fills a List with all sister-targets of a single target - * @return filled or empty List - */ - private ArrayList getCoTargets (ACSTargetElement aTarget) { - ACSProjectElement parentProject = null; - // Caution is the mother of wisdom ;-) - if (aTarget.getParentNode() instanceof ACSProjectElement) - parentProject = (ACSProjectElement) aTarget.getParentNode(); - else throw new IllegalArgumentException("Target not part of Project"); - - NodeList allNodes = parentProject.getChildNodes(); - ArrayList retVal = new ArrayList(); - int length = allNodes.getLength(); - for (int i = 0; i < length; i++) - { - Node node = allNodes.item(i); - if (node instanceof ACSTargetElement) { - ACSTargetElement currentElement = ((ACSTargetElement)node); - // ... leave out the current target TODO: avoid cyclic relations! - if (currentElement != aTarget) retVal.add(currentElement); - } - } - return retVal; - } - - /** - * Lazily get a target-table - * @return created JTable - */ - private JTable getTargetsTable() { - if (_targetsTable == null) { - _targetsTable = new JTable(); - _targetsTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); - _targetsTable.setAutoCreateColumnsFromModel(false); - _targetsTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - // Coulumn showing the selection of the Target - TableColumn selectCol = new TableColumn(); - selectCol.setHeaderValue(_resources.getString(getClass(), "selection")); - selectCol.setModelIndex(0); - selectCol.setPreferredWidth(70); - selectCol.setMaxWidth(70); - selectCol.setResizable(false); - // Coulumn showing the Target - TableColumn targetCol = new TableColumn(); - targetCol.setHeaderValue(_resources.getString(getClass(), "target")); - targetCol.setModelIndex(1); - targetCol.setPreferredWidth(150); - targetCol.setMaxWidth(150); - targetCol.setResizable(true); - // Coulumn showing the description of targets - TableColumn descrCol = new TableColumn(); - descrCol.setHeaderValue(_resources.getString(getClass(), "description")); - descrCol.setModelIndex(2); - descrCol.setPreferredWidth(250); - descrCol.setResizable(false); - _targetsTable.addColumn(selectCol); - _targetsTable.addColumn(targetCol); - _targetsTable.addColumn(descrCol); - _targetsTable.setModel(new SelectableTargetsTableModel()); - } - return _targetsTable; - } - - /** - * A decorator for TargetsTableModel to allow selection of targets. - * - * @see org.apache.tools.ant.gui.modules.edit.TargetsTableModel - */ - private class SelectableTargetsTableModel extends TargetsTableModel { - private boolean[] _selected = new boolean[0]; - - /** - * Change the entire model. - * @param List of ACSTargetElements - */ - public void setTargets(List newTargets) { - _selected = new boolean[newTargets.size()]; - super.setTargets(newTargets); - } - - /** - * @param Stringarray of target-names - */ - public void preselectTargets(String[] targetNames) { - int i = 0, j = 0; - int iDim = getRowCount(); - int jDim = targetNames.length; - for (i = 0; i < iDim; i++) { - String name = getTarget(i).getName(); - for( j= 0; j < jDim; j++) { - if (name.equalsIgnoreCase(targetNames[j])) _selected[i] = true; - } - } - } - - /** - * @param int columnIndex - * @return String.class - */ - public Class getColumnClass(int columnIndex) { - if (columnIndex == 0) return Boolean.class; - else return String.class; - } - - /** - * @return 3 - */ - public int getColumnCount() { - return 3; - } - - /** - * @return true in case of the first column. - */ - public boolean isCellEditable(int row, int col) { - return (col == 0); - } - - /** - * @param row and column in table - * @return the requested object to be shown. - */ - public Object getValueAt(int row, int col) { - ACSTargetElement rowObj = getTarget(row); - switch (col) { - case 0: return new Boolean(_selected[row]); - case 1: return rowObj.getName(); - case 2: return rowObj.getDescription(); - default: return ""; - } - } - - /** - * @param new value resulting from the editor - * @param row and column in table - */ - public void setValueAt(Object newValue, int row, int col) { - if (col == 0) { - _selected[row] = ((Boolean)newValue).booleanValue(); - } - } - - public int getSelectedTargetCount() { - int retVal = 0; - int length = getRowCount(); - for (int i = 0; i < length; i++) { - if (_selected[i]) retVal++; - } - return retVal; - } - - /** - * @return a StringArray (String[]) containing the names of all selected targets. - */ - public String[] getSelectedTargetsAsStringArray() { - int length = getRowCount(); - String[] retVal = new String[getSelectedTargetCount()]; - int i = 0, j = 0; - - for (i = 0; i < length; i++) { - if (_selected[i]) { - retVal[j] = getTarget(i).getName(); - j++; - } - } - return retVal; - } - } - - /** - * Ihis handler is the ActionListener for each button. - */ - private class ActionHandler implements ActionListener { - /** - * ActionListener Interface ethod - * @param ActionEvent - */ - public void actionPerformed(ActionEvent e) { - // Get some initial values needed later - // Evaluate EventSource - if (e.getSource()==_ok) { - // OK: take the selected targets and leave - _target.setDepends( ((SelectableTargetsTableModel)_targetsTable.getModel()).getSelectedTargetsAsStringArray() ); - dispose(); - } else if (e.getSource()==_cancel) { - // just close dialog - dispose(); - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/modules/edit/DependentTargetPropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/modules/edit/DependentTargetPropertyEditor.java deleted file mode 100755 index c3cc1eadc..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/edit/DependentTargetPropertyEditor.java +++ /dev/null @@ -1,327 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.modules.edit; - -import java.util.StringTokenizer; - -import java.awt.Component; -import java.awt.BorderLayout; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.event.FocusListener; -import java.awt.event.FocusEvent; -import java.awt.event.KeyListener; -import java.awt.event.KeyEvent; -import java.awt.Point; -import java.awt.Dimension; -import java.awt.Toolkit; - -import javax.swing.JPanel; -import javax.swing.JButton; -import javax.swing.JTextField; -import javax.swing.JOptionPane; -import javax.swing.BorderFactory; -import javax.swing.border.BevelBorder; - -import org.apache.tools.ant.gui.customizer.AbstractPropertyEditor; -import org.apache.tools.ant.gui.acs.ACSTargetElement; - -/** - * PropertyEditor for DependentTargets - * - * @version $Revision$ - * @author Christoph Wilhelms - */ -public class DependentTargetPropertyEditor extends AbstractPropertyEditor { - private JTextField _textField = null; - private JButton _button = null; - private JPanel _widget = null; - private ACSTargetElement _value = null; - private EventHandler _handler = new EventHandler(); - private static DependentTargetChooser _dialog = null; - - /** - * Gets the editor component: A panel containing a textfield an a button. - * @return the property editor component - */ - public Component getChild() { - if (_widget == null) // Lazy get - { - _widget = new JPanel(); - _widget.setLayout(new BorderLayout()); - _widget.add(getTextField(), BorderLayout.CENTER); - _widget.add(getButton(), BorderLayout.EAST); - } - return _widget; - } - - /** - * Lazily create the textfield, to make sure its only instantiated once. - * @return the button - */ - private JTextField getTextField() { - if (_textField == null) { - _textField = new JTextField(); - _textField.setText(getAsText()); - _textField.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); - _textField.addFocusListener(_handler); - _textField.addKeyListener(_handler); - // We dont really need the next line in Antidote context, just for testpurpose! - _textField.setPreferredSize(new Dimension(150, _textField.getPreferredSize().height)); - } - // Transfer Tooltip from Panel to TextField - this hat to be done at every get! - _textField.setToolTipText( _widget.getToolTipText()); - - return _textField; - } - - /** - * Lazily create the button, to make sure its only instantiated once. - * @return the button - */ - private JButton getButton() { - if (_button == null) { - _button = new JButton(); - _button.setText("..."); // Probably an Image is more nice, but ... is standart, I think. - _button.setPreferredSize(new Dimension(getTextField().getPreferredSize().height, getTextField().getPreferredSize().height)); - _button.addActionListener(_handler); - } - return _button; - } - - /** - * Sets the model for the component. Used to comunicate externally. - * @param The target element the editior works with. - */ - public void setValue(Object newValue) { - if(!(newValue instanceof ACSTargetElement)) { - throw new IllegalArgumentException( - "Value must be of type ACSTargetElement."); - } - _value = (ACSTargetElement)newValue; - - // Directly show the targets. - getTextField().setText(getAsText()); - } - - /** - * Sets the model for the component. Used to comunicate externally. - * @return The target element the editior works with. - */ - public Object getValue() { - return _value; - } - - /** - * Sets the depends for the target as text. - * @param A String containing all targetnames, separated by "," - */ - public void setAsText(String newValue) { - String vals = getTextField().getText(); - StringTokenizer tok = new StringTokenizer(vals,","); - String[] depends = new String[tok.countTokens()]; - for(int i = 0; i < depends.length; i++) { - depends[i] = tok.nextToken().trim(); - } - // Directly supply the target with the new depends. - ((ACSTargetElement)getValue()).setDepends(depends);; - } - - /** - * Gets the depends for the target as text. - * @return A String containing all targetnames, separated by "," - */ - public String getAsText() { - if (_value == null) return ""; - String[] dep = _value.getDepends(); - String retVal = ""; - for (int i = 0; i < dep.length; i++) { - retVal += dep[i]; - if (i < dep.length - 1) retVal += ", "; - } - return retVal; - } - - /** - * Creates and shows the dialog for selecting dependent targets. - */ - private void showSelectionDialog() { - // Create the dialog lazyly - it is static, for we want only ONE instance! - if (_dialog == null) { - _dialog = new DependentTargetChooser(JOptionPane.getFrameForComponent(getChild()), (ACSTargetElement)getValue()); - } - else { - // Supply dialog with target - it needs nothing else ;-) - but the - // target will be modified by the dialog. - _dialog.setTarget((ACSTargetElement)getValue()); - } - String oldValue = getTextField().getText(); - // Set the position of the dialog right under the Editor, if possible - DependentTargetPropertyEditor.setWindowRelativeToComponent (_dialog, getChild()); - _dialog.show(); - // after the modal dialog is disposed make shure that the propertyChangeEvent - // will be thrown and the textfield becomes updated! - Object newValue = (Object)getAsText(); - - getTextField().setText(getAsText()); - firePropertyChange(newValue, oldValue); - } - - /** - * Handler for ButtonAction, Focus- and KeyListening. I can't use the FocusHandler - * in superclass, for I have a different Object in Property Change! - */ - private class EventHandler implements ActionListener, FocusListener, KeyListener { - /* ActionListener methods */ - public void actionPerformed(ActionEvent e) { - if (e.getSource() == _button) showSelectionDialog(); - } - /* FocusListener methods */ - public void focusLost(FocusEvent e) { - Object oldValue = (Object)getAsText(); - String newValue = getTextField().getText(); - setAsText(newValue); - firePropertyChange(newValue, oldValue); - } - public void focusGained(FocusEvent e) { - } - /* KeyListener methods */ - public void keyPressed(KeyEvent e) { - } - public void keyTyped(KeyEvent e) { - } - public void keyReleased(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_F4) { - showSelectionDialog(); - } - } - } - - /** - * Places a window, depending of it's size, relative to a component and it's size - * TODO: move to WindowUtilities - */ - public static void setWindowRelativeToComponent (java.awt.Window window, Component theComp) { - int compX = theComp.getLocationOnScreen().x; - int compY = theComp.getLocationOnScreen().y; - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension dialogSize = window.getSize(); - int x = 0, y = 0; - - // Window should be aligned LEFT with component - x = compX; - // If there is not enough space to align LEFT, align RIGTH - if (x + dialogSize.width > screenSize.getWidth()) { - x = compX - (dialogSize.width - theComp.getWidth()); - } - // If there is not enough space to align LEFT, make sure that it - // will be display completely. - if (x < 0) x = 0; - - // Window should be located BELOW component - y = compY + theComp.getHeight(); - // If there is not enough space Window BELOW component, place ABOVE component - if (y + dialogSize.height > screenSize.getHeight() ) { - y = compY - dialogSize.height; - } - // If there is not enough space Window ABOVE component make sure that it - // will be display completely. - if (y < 0) y = 0; - - window.setLocation(x, y); - } - - /** main just for Test reasons */ - public static void main(String[] args) { - javax.swing.JFrame f = new javax.swing.JFrame(); - f.setDefaultCloseOperation(3 /*JFrame.EXIT_ON_CLOSE*/); - - org.apache.tools.ant.gui.core.AppContext context = new org.apache.tools.ant.gui.core.AppContext(f); - try { - context.getProjectManager().open(new java.io.File("G:\\build.xml")); - } catch (Exception e) { - System.out.println("No buildfile found"); - } - - JPanel c = new JPanel(); - c.setLayout(new java.awt.FlowLayout()); - f.setContentPane(c); - - org.w3c.dom.NodeList all2ndLevelNodes = context.getProjectManager().getOpen()[0].getChildNodes(); - - int i= 0; - while (i < all2ndLevelNodes.getLength()) { - org.w3c.dom.Node node = all2ndLevelNodes.item(i); - if (node instanceof ACSTargetElement) { - ACSTargetElement newTarget = ((ACSTargetElement)node); - DependentTargetPropertyEditor a = new DependentTargetPropertyEditor(); - c.add(a.getChild()); - a.setValue(newTarget); - } - i++; - } - f.pack(); - - f.addWindowListener(new java.awt.event.WindowListener() { - public void windowOpened(java.awt.event.WindowEvent e) {} - public void windowIconified(java.awt.event.WindowEvent e) {} - public void windowDeiconified(java.awt.event.WindowEvent e) {} - public void windowActivated(java.awt.event.WindowEvent e) {} - public void windowDeactivated(java.awt.event.WindowEvent e) {} - public void windowClosing(java.awt.event.WindowEvent e) {} - public void windowClosed(java.awt.event.WindowEvent e) {System.exit(0);} - }); - f.show(); - } -} \ No newline at end of file diff --git a/src/antidote/org/apache/tools/ant/gui/modules/edit/DragTree.java b/src/antidote/org/apache/tools/ant/gui/modules/edit/DragTree.java deleted file mode 100644 index 0e5e02759..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/edit/DragTree.java +++ /dev/null @@ -1,606 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.gui.modules.edit; - -import java.awt.datatransfer.*; -import java.awt.dnd.*; - -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Point; -import java.awt.Component; -import java.awt.Insets; -import java.awt.Rectangle; - -import javax.swing.JComponent; -import javax.swing.JTree; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.TreePath; -import javax.swing.JScrollPane; - -import java.io.IOException; -import java.util.TooManyListenersException; - -/** - * A tree which allows reorganization via drop and drag - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class DragTree extends JTree implements DragSourceListener, - DragGestureListener, DropTargetListener { - - /** - * The DragTreeListener - * associated with this DragTree. - */ - private DragTreeListener _dragTreeListener; - - /** - * Holds the position where the dropped item should be - * placed. Possible values are DROP_BEFORE, DROP_ON - * or DROP_AFTER. - */ - private int _dropPosition; - - /** - * The point where the drop line should be drawn. - */ - private Point _point; - - /** - * The object the drop occured on. - */ - private Object _dropOn; - - /** - * The path of where the drop occured. - */ - private TreePath _dropOnPath; - - /** - * The path of the item being dropped. - */ - private TreePath _droppedPath; - - /** - * The item being dragged should be placed before (or above) - * the item it is dropped on. - */ - final static protected int DROP_BEFORE = 0; - - /** - * The item being dragged should be placed on (as a child) - * the item it is dropped on. - */ - final static protected int DROP_ON = 1; - - /** - * The item being dragged should be placed on (or after) - * the item it is dropped on. - */ - final static protected int DROP_AFTER = 2; - - /** - * Default Constuctor - */ - public DragTree() { - - DragSource dragSource = DragSource.getDefaultDragSource(); - - // Use the default gesture recognizer - dragSource.createDefaultDragGestureRecognizer( - this, - DnDConstants.ACTION_COPY_OR_MOVE, - this); - - // Setup to be a drop target - new DropTarget(this, - DnDConstants.ACTION_COPY_OR_MOVE, - this); - } - - /** - * Starts the drag operation. - *

    - * @param e the DragGestureEvent describing - * the gesture that has just occurred - */ - public void dragGestureRecognized(DragGestureEvent e) { - - // Find the path for the cursor position. - Point p = e.getDragOrigin(); - _droppedPath = getPathForLocation(p.x, p.y); - - if (_droppedPath == null) { - return; - } - - // Select the item. - setSelectionPath(_droppedPath); - - // Wrap the object and start the drag. - Object obj = _droppedPath.getLastPathComponent(); - Wrapper wrapper = new Wrapper(obj); - e.startDrag(DragSource.DefaultMoveNoDrop, wrapper, this); - } - - // - // DragSourceListener methods - // - public void dragDropEnd(DragSourceDropEvent e) {} - public void dragEnter(DragSourceDragEvent e) {} - public void dragExit(DragSourceEvent e) {} - public void dragOver(DragSourceDragEvent e) {} - public void dropActionChanged(DragSourceDragEvent e) {} - - // - // DropTargetListener methods - // - public void dropActionChanged(java.awt.dnd.DropTargetDragEvent e) {} - public void dragEnter(DropTargetDragEvent e) { - dragOver(e); - } - - /** - * Called when a drag operation is ongoing - * on the DropTarget. - *

    - * @param dtde the DropTargetDragEvent - */ - public void dragOver(DropTargetDragEvent e) { - - checkAutoScroll(e.getLocation()); - - Point p = computeDropLocation(e.getLocation()); - - // Don't allow a parent to be dropped on one of its children. - if (_droppedPath.isDescendant(_dropOnPath)) { - _point = null; - _dropOn = null; - p = null; - e.rejectDrag(); - } else { - e.acceptDrag(e.getDropAction()); - } - - // If the point has changed, repaint the display. - if (_point == null || !p.equals(_point)) { - _point = p; - repaint(); - } - } - - /** - * Determines where the item will be dropped. - */ - private Point computeDropLocation(Point p) { - - int rowCount = getRowCount(); - int height = findCellHeight(); - int row = (p.y / height); - int offset = (p.y % height); - - // Move the point to the top of the cell. - p.y -= offset; - - int delta = 0; - - // Is the point at or past the end of the list? - if (row > (rowCount - 1) ) { - p.y = (rowCount - 1) * height; - row = rowCount - 1; - delta = height; - _dropPosition = DROP_AFTER; - } - // Is the point at the begining of the list? - else if (row <= 0) { - p.y = 0; - delta = height; - if (rowCount > 1) { - row = 1; - _dropPosition = DROP_BEFORE; - } else { - row = 0; - _dropPosition = DROP_ON; - } - } - // The point is in the middle of the tree. - else { - // Is the point on the top third of the cell? - if (offset < height * 0.333) { - - // Set the line to the top of the cell. - delta = 0; - _dropPosition = DROP_BEFORE; - } - // Is the point on the bottom third of the cell? - else if (offset > height * 0.666){ - - // Set the line to the bottom of the cell. - delta = height; - _dropPosition = DROP_AFTER; - } - // The point is in the middle of the cell? - else { - - // Set the line to the middle of the cell. - delta = height / 2; - _dropPosition = DROP_ON; - } - } - - // Find the object to use for the drop. - _dropOnPath = getPathForRow(row); - if (_dropOnPath != null) { - _dropOn = _dropOnPath.getLastPathComponent(); - } else { - _dropOn = null; - } - - // Adjust the point used to draw the drop line. - p.y += delta; - p.x = 0; - - return p; - } - - /** - * Process the drop - * - * @param e the DropTargetDropEvent - * @see DropTargetListener.drop - */ - public void drop(DropTargetDropEvent e) { - - if (_dropOn == null || _dropOnPath == null) { - return; - } - - // Get the object being transfered. - Object obj = null; - Transferable t = e.getTransferable(); - try { - obj = t.getTransferData(_flavors[0]); - } catch (Exception exp) { - System.out.println(exp); - } - - if (obj != null) { - - Object droppedObj = obj; - Object droppedOnObj = _dropOn; - Object parentObj = getParentOfDroppedOnObject(); - - if (_dropPosition == DROP_ON) { - - fireAppendChild(droppedOnObj, droppedObj); - setExpandedState(_dropOnPath, true); - } - else if (_dropPosition == DROP_BEFORE) { - - fireInsertBefore(parentObj, droppedOnObj, droppedObj); - } - else if (_dropPosition == DROP_AFTER) { - - // If the cell is exanded, add the new item before our - // first child. - if (isExpanded(getRowForPath(_dropOnPath))) { - parentObj = droppedOnObj; - } - - // Find the next sibling - int index = getModel().getIndexOfChild(parentObj, droppedOnObj); - int count = getModel().getChildCount(parentObj); - - if (index == count-1) { - fireAppendChild(parentObj, droppedObj); - } else { - Object sibling = getModel().getChild(parentObj, index+1); - fireInsertBefore(parentObj, sibling, droppedObj); - } - } - - if (e.getDropAction() == DnDConstants.ACTION_MOVE) { - fireRemoveChild(droppedObj); - } - - this.updateUI(); - } - } - - /** - * Returns the parent of the dropped on object. - */ - private Object getParentOfDroppedOnObject() { - int count = _dropOnPath.getPathCount(); - return _dropOnPath.getPathComponent(count-2); - } - - /** - * Repaint the display to cleanup any lines. - */ - public void dragExit(DropTargetEvent e) { - _point = null; - repaint(); - } - - /** - * Draws the line which shows where the dropped - * item will land. - * - * @see #JComponent.paintComponent - */ - public void paintComponent(Graphics g){ - super.paintComponent(g); - - if (_point != null) { - - if (_dropPosition == DROP_ON) { - // If the drop is on another item, draw - // two short lines. - g.drawLine(0, _point.y, 10, _point.y); - g.drawLine(getWidth()-10, _point.y, getWidth(), _point.y); - } else { - // If the drop is above or below an item, draw - // one long line. - g.drawLine(0, _point.y, getWidth(), _point.y); - } - } - } - - /** - * Wrapper holds the object to transfer - */ - protected class Wrapper implements Transferable { - - /** The object to transfer */ - private Object _obj; - - /** - * Creates a wrapper for the input object. - * - * @param obj object to wrap - */ - public Wrapper(Object obj) { - _obj = obj; - } - - /** - * Return out object if the DataFlavor is correct. - * - * @param flavor only javaJVMLocalObjectMimeType is supported - */ - public Object getTransferData(DataFlavor flavor) - throws UnsupportedFlavorException, IOException { - if (isDataFlavorSupported(flavor)) { - return _obj; - } - throw new UnsupportedFlavorException(flavor); - } - - /** - * Return true if the input flavor is support. - * - * @param flavor DataFlavor to test - */ - public boolean isDataFlavorSupported(DataFlavor flavor) { - return flavor.equals(_flavors[0]); - } - - /** - * Return true if the input flavor is support. - * - * @param flavor DataFlavor to test - */ - public DataFlavor[] getTransferDataFlavors() { - return _flavors; - } - } - - /** - * DataFlavors which are support for transfer - */ - private static final DataFlavor[] _flavors = { - createConstant(DataFlavor.javaJVMLocalObjectMimeType) - }; - - /** - * Returns a new DataFlavor or null - * - * @param flavor the flavor - */ - static private DataFlavor createConstant(String flavor) { - try { - return new DataFlavor(flavor); - } catch (Exception e) { - return null; - } - } - - /** - * Returns the cell height for the tree. - */ - protected int findCellHeight() { - DefaultTreeCellRenderer renderer = - (DefaultTreeCellRenderer) getCellRenderer(); - return renderer.getPreferredSize().height; - } - - /** - * Register a new DragTreeListener. - *

    - * @param dtl the DragTreeListener to register - * with this DragTree. - */ - public synchronized void addDragTreeListener(DragTreeListener dtl) { - _dragTreeListener = dtl; - } - - /** - * unregister the current DragTreeListener - *

    - * @param dtl the DragTreeListener to unregister - *

    - * @throws IllegalArgumentException if - * dtl is not (equal to) the currently registered - * DragTreeListener. - */ - public synchronized void removeDragTreeListener(DragTreeListener dtl) { - if (_dragTreeListener == null || !_dragTreeListener.equals(dtl)) - throw new IllegalArgumentException(); - else { - _dragTreeListener = null; - } - } - - /** - * Notify the DragTreeListener that an appendChild has - * been requested. - */ - protected synchronized Object fireAppendChild(Object parent, - Object newChild) { - - if (_dragTreeListener != null) { - return _dragTreeListener.appendChild(parent, newChild); - } - return null; - } - - /** - * Notify the DragTreeListener that an insertBefore has - * been requested. - */ - protected synchronized Object fireInsertBefore(Object parent, Object index, - Object newChild) { - - if (_dragTreeListener != null) { - return _dragTreeListener.insertBefore(parent, index, newChild); - } - return null; - } - - /** - * Notify the DragTreeListener that an removeChild has - * been requested. - */ - protected synchronized void fireRemoveChild(Object child) { - - if (_dragTreeListener != null) { - _dragTreeListener.removeChild(child); - } - } - - /** - * Scrolls tree if nessasary - *

    - * @param p A Point indicating the - * location of the cursor that triggered this operation. - */ - protected void checkAutoScroll(Point p) { - - Point locn = new Point(p); - javax.swing.SwingUtilities.convertPointToScreen(locn, this); - javax.swing.SwingUtilities.convertPointFromScreen(locn, getParent()); - - Rectangle outer = new Rectangle(); - Rectangle inner = new Rectangle(); - - Insets i = new java.awt.Insets(10, 10, 10, 10); - Dimension size = getParent().getSize(); - - if (size.width != outer.width || size.height != outer.height) - outer.setBounds(0, 0, size.width, size.height); - - if (inner.x != i.left || inner.y != i.top) - inner.setLocation(i.left, i.top); - - int newWidth = size.width - (i.left + i.right); - int newHeight = size.height - (i.top + i.bottom); - - if (newWidth != inner.width || newHeight != inner.height) - inner.setSize(newWidth, newHeight); - - if (outer.contains(locn) && !inner.contains(locn)) { - if (locn.y >= inner.height) { - scrollDown(); - } else { - scrollUp(); - } - } - } - - /** - * Scroll the tree up one cell - */ - public void scrollUp() { - Rectangle visibleRect = getVisibleRect(); - int height = findCellHeight(); - visibleRect.y -= height; - visibleRect.height -= height; - scrollRectToVisible(visibleRect); - } - - /** - * Scroll the tree down one cell - */ - public void scrollDown() { - Rectangle visibleRect = getVisibleRect(); - int height = findCellHeight(); - visibleRect.y += height; - visibleRect.height += height; - scrollRectToVisible(visibleRect); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/modules/edit/DragTreeListener.java b/src/antidote/org/apache/tools/ant/gui/modules/edit/DragTreeListener.java deleted file mode 100644 index cd2271dbb..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/edit/DragTreeListener.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.gui.modules.edit; - -import java.util.EventListener; - -/** - * This interface is sourced from a DragTree and is invoked - * when an object of that (sub)class detects the completion - * of a drag operation. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public interface DragTreeListener extends EventListener { - - /** - * Append the object to the end of the parent's child list. - * - * @param parent parent object - * @param newChild new child object - * @return the new object - */ - public Object appendChild(Object parent, Object newChild); - - /** - * Append the object to the end of the parent's child list. - * - * @param parent parent object - * @param index child object of parent the newChild should be added - * before. - * @param newChild new child object - * @return the new object - */ - public Object insertBefore(Object parent, Object index, Object newChild); - - /** - * Removes the child object from the parent. - * - * @param parent parent object - * @param child child object - */ - public void removeChild(Object child); -} diff --git a/src/antidote/org/apache/tools/ant/gui/modules/edit/DtdAttributePropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/modules/edit/DtdAttributePropertyEditor.java deleted file mode 100644 index 73f11a8c7..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/edit/DtdAttributePropertyEditor.java +++ /dev/null @@ -1,389 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.gui.modules.edit; -import org.apache.tools.ant.gui.customizer.AbstractPropertyEditor; -import org.apache.tools.ant.gui.acs.ACSDtdDefinedAttributes; -import javax.swing.*; -import javax.swing.table.*; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.BorderLayout; -import java.awt.event.*; -import java.util.*; - -/** - * Custom property editor for the DtdAttributes. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class DtdAttributePropertyEditor extends AbstractPropertyEditor { - - /** Recommended size for widgets inside a JScrollPane, as communicated - * through the setPreferredScrollableViewportSize() method. */ - protected static final Dimension VIEWPORT_SIZE = new Dimension(200, 150); - - /** Container. */ - private JPanel _widget = null; - /* The current properties being edited. */ - private ACSDtdDefinedAttributes _attributes = null; - /** The table editor for the properties. */ - private JTable _table = null; - /** Displays possible attribute values. */ - private JComboBox _combo = new JComboBox(); - - /** - * Default ctor. - * - */ - public DtdAttributePropertyEditor() { - _widget = new JPanel(new BorderLayout()); - _widget.addFocusListener(new FocusHandler(this)); - - _table = new JTable(); - _table.setPreferredScrollableViewportSize(VIEWPORT_SIZE); - JScrollPane scroller = new JScrollPane(_table); - _widget.add(BorderLayout.CENTER, scroller); - } - - /** - * Get the child editing component. Uses JComponent so we can have tool - * tips, etc. - * - * @return Child editing component. - */ - protected Component getChild() { - return _widget; - } - - /** - * This method is intended for use when generating Java code to set - * the value of the property. It should return a fragment of Java code - * that can be used to initialize a variable with the current property - * value. - *

    - * Example results are "2", "new Color(127,127,34)", "Color.orange", etc. - * - * @return A fragment of Java code representing an initializer for the - * current value. - */ - public String getJavaInitializationString() { - return "new ACSDtdDefinedAttributes()"; - } - - /** - * Set (or change) the object that is to be edited. Builtin types such - * as "int" must be wrapped as the corresponding object type such as - * "java.lang.Integer". - * - * @param value The new target object to be edited. Note that this - * object should not be modified by the PropertyEditor, rather - * the PropertyEditor should create a new object to hold any - * modified value. - */ - public void setValue(Object value) { - if(value == null) { - value = new ACSDtdDefinedAttributes(); - } - - if(!(value instanceof ACSDtdDefinedAttributes)) { - throw new IllegalArgumentException( - value.getClass().getName() + - " is not of type ACSDtdDefinedAttributes."); - } - - Object old = _attributes; - _attributes = (ACSDtdDefinedAttributes) - ((ACSDtdDefinedAttributes) value).clone(); - - TableModel model = new TableModel(); - _table.setModel(model); - - // Setup the combo box - updateComboBox(); - _combo.setEditable(true); - - // Set the first column to use the combo box - TableColumn tableColumn = _table.getColumnModel().getColumn(0); - tableColumn.setCellEditor(new DefaultCellEditor(_combo)); - - // When the combo box is updated, update the table. - _combo.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - JComboBox cb = (JComboBox)e.getSource(); - String newSelection = (String)cb.getSelectedItem(); - - // Should we update the table? - if (newSelection != null && _table.getEditingRow() > 0) { - _table.getModel().setValueAt(newSelection, - _table.getEditingRow(), _table.getEditingColumn() ); - } - } - }); - - _table.clearSelection(); - } - - /** - * Fills the combobox with possible values - */ - private void updateComboBox() { - _combo.removeAllItems(); - ArrayList array = new ArrayList(); - - // Add the optional attributes - String[] valueArray = _attributes.getOptionalAttributes(); - if (valueArray != null) { - for(int i = 0; i < valueArray.length; i++) { - if (_attributes.getProperty(valueArray[i]) == null) { - array.add(valueArray[i]); - } - } - } - - // Add the required attributes - valueArray = _attributes.getRequiredAttributes(); - if (valueArray != null) { - for(int i = 0; i < valueArray.length; i++) { - if (_attributes.getProperty(valueArray[i]) == null) { - array.add(valueArray[i]); - } - } - } - - Collections.sort(array); - for(int i = 0; i < array.size(); i++) { - _combo.addItem(array.get(i)); - } - } - - /** - * @return The value of the property. Builtin types - * such as "int" will be wrapped as the corresponding - * object type such as "java.lang.Integer". - */ - public Object getValue() { - return _attributes; - } - - /** - * Set the property value by parsing a given String. May raise - * java.lang.IllegalArgumentException if either the String is - * badly formatted or if this kind of property can't be expressed - * as text. - * @param text The string to be parsed. - */ - public void setAsText(String text) throws IllegalArgumentException { - throw new IllegalArgumentException("Cannot be expressed as a String"); - } - - /** - * @return The property value as a human editable string. - *

    Returns null if the value can't be expressed - * as an editable string. - *

    If a non-null value is returned, then the PropertyEditor should - * be prepared to parse that string back in setAsText(). - */ - public String getAsText() { - return null; - } - - /** Table model view of the Properties object. */ - private class TableModel extends AbstractTableModel { - private static final int NAME = 0; - private static final int VALUE = 1; - - private List _keys = null; - - public TableModel() { - // We need to store the property keys in an array - // so that the ordering is preserved. - _keys = new ArrayList(_attributes.keySet()); - Collections.sort(_keys); - } - - /** - * Get the number of rows. - * - * @return Number of rows. - */ - public int getRowCount() { - return _attributes.size() + 1; - } - - /** - * Get the number of columns. - * - * @return 2 - */ - public int getColumnCount() { - return 2; - } - - /** - * Get the editing and display class of the given column. - * - * @return String.class - */ - public Class getColumnClass(int column) { - return String.class; - } - - /** - * Get the header name of the column. - * - * @param column Column index. - * @return Name of the column. - */ - public String getColumnName(int column) { - // XXX fix me. - return column == NAME ? "Name" : "Value"; - } - - /** - * Determine if the given cell is editable. - * - * @param row Cell row. - * @param column Cell column. - * @return true - */ - public boolean isCellEditable(int row, int column) { - return true; - } - - /** - * Get the object at the given table coordinates. - * - * @param row Table row. - * @param column Table column. - * @return Object at location, or null if none. - */ - public Object getValueAt(int row, int column) { - if(row < _attributes.size()) { - switch(column) { - case NAME: - return _keys.get(row); - case VALUE: - return _attributes.getProperty((String)_keys.get(row)); - } - } - return null; - } - /** - * Set the table value at the given location. - * - * @param value Value to set. - * @param row Row. - * @param column Column. - */ - public void setValueAt(Object value, int row, int column) { - String k = null; - String v = null; - - // Get the current key and value. - String currKey = (String) getValueAt(row, NAME); - String currValue = null; - if(currKey != null) { - currValue = _attributes.getProperty(currKey); - } - - switch(column) { - case NAME: - k = (String) value; - - // Update or add the key value. - if(row < _keys.size()) { - _keys.set(row, k); - } - else { - _keys.add(k); - } - - // Remove the old key. - if(currKey != null) { - _attributes.remove(currKey); - } - v = currValue == null ? "" : currValue; - break; - case VALUE: - v = String.valueOf(value); - k = currKey; - - // Should we create a temp key? - if( (k == null || k.length() == 0 ) && v.length() != 0 ) { - k = "key-for-" + v; - } - break; - } - - // If there is a key, update the list. - if(k != null && k.length() > 0) { - _attributes.setProperty(k, v); - } - - // Has something changed? - if( (k != null && v != null) && - (!k.equals(currKey) || !v.equals(currValue) ) ) { - - fireTableRowsUpdated(row, row); - // Fire change in outer class. - firePropertyChange(null, _attributes); - - // Reset the combobox - updateComboBox(); - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/modules/edit/ElementNavigator.java b/src/antidote/org/apache/tools/ant/gui/modules/edit/ElementNavigator.java deleted file mode 100644 index 7dceeeb0a..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/edit/ElementNavigator.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.modules.edit; -import org.apache.tools.ant.gui.core.*; -import org.apache.tools.ant.gui.event.*; -import org.apache.tools.ant.gui.acs.*; -import javax.swing.*; -import javax.swing.tree.*; -import javax.swing.event.*; -import java.awt.GridLayout; -import java.awt.Dimension; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.EventObject; -import java.beans.PropertyChangeEvent; -import org.w3c.dom.Node; - -/** - * Module for navigating build file elemenets. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ElementNavigator extends AntModule { - - /** Navigation via a tree widget. */ - private DragTree _tree = null; - /** The selection model being used. */ - private ElementTreeSelectionModel _selections = null; - - /** - * Default ctor. - * - */ - public ElementNavigator() { - } - - /** - * Using the given AppContext, initialize the display. - * - * @param context Application context. - */ - public void contextualize(AppContext context) { - setContext(context); - context.getEventBus().addMember(EventBus.MONITORING, new Handler()); - - setLayout(new GridLayout(1,1)); - - _tree = new DragTree(); - _tree.addDragTreeListener(new DragHandler()); - _tree.setModel(null); - _tree.setCellRenderer(new ElementTreeCellRenderer()); - _tree.addMouseListener(new PopupHandler()); - _tree.putClientProperty("JTree.lineStyle", "Angled"); - _tree.setShowsRootHandles(true); - JScrollPane scroller = new JScrollPane(_tree); - add(scroller); - - setPreferredSize(new Dimension(250, 100)); - setMinimumSize(new Dimension(200, 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. - * @return true if event should be propogated, false if - * it should be cancelled. - */ - public boolean eventPosted(EventObject event) { - ElementTreeModel model = (ElementTreeModel)_tree.getModel(); - // XXX This crap needs cleaning up. Type switching is lazy... - if(event instanceof PropertyChangeEvent) { - // The project node has changed. - model.fireNodeChanged((ACSElement)event.getSource()); - } - else if(event instanceof RefreshDisplayEvent && model != null) { - _tree.updateUI(); - } - else if(event instanceof NewElementEvent && model != null) { - ACSElement element = ((NewElementEvent)event).getNewElement(); - model.fireNodeAdded(element); - TreePath path = new TreePath(model.getPathToRoot(element)); - _selections.setSelectionPath(path); - _tree.scrollPathToVisible(path); - } - else if(event instanceof DeleteElementEvent && model != null) { - _tree.updateUI(); - } - else { - ACSProjectElement project = null; - if(event instanceof ProjectSelectedEvent) { - ProjectSelectedEvent e = (ProjectSelectedEvent) event; - project = e.getSelectedProject(); - } - - if(project == null) { - // The project has been closed. - // XXX this needs to be tested against - // different version of Swing... - _tree.setModel(null); - _tree.setSelectionModel(null); - // Send an empty selection event to notify others that - // nothing is selected. - ElementSelectionEvent.createEvent(getContext(), null); - } - else { - boolean updateModel = false; - TreeModel testModel = _tree.getModel(); - - // Set the model if's not an ElementTreeModel - if (testModel instanceof ElementTreeModel) { - ElementTreeModel etm = (ElementTreeModel) testModel; - ACSProjectElement currentProject = - (ACSProjectElement) etm.getRoot(); - - // Set the model if the project is wrong - if (currentProject != project) { - updateModel = true; - } - } else { - updateModel = true; - } - - // Should we update the tree model - if (updateModel) { - _tree.setModel(new ElementTreeModel(project)); - _selections = new ElementTreeSelectionModel(); - _selections.addTreeSelectionListener( - new SelectionForwarder()); - _tree.setSelectionModel(_selections); - } - } - } - return true; - } - } - - /** Forwards selection events to the event bus. */ - private class SelectionForwarder implements TreeSelectionListener { - public void valueChanged(TreeSelectionEvent e) { - getContext().getEventBus().postEvent( - ElementSelectionEvent.createEvent( - getContext(), _selections.getSelectedElements())); - } - } - - /** 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 ProjectSelectedEvent || - event instanceof ProjectClosedEvent || - event instanceof NewElementEvent || - event instanceof PropertyChangeEvent || - event instanceof DeleteElementEvent || - event instanceof RefreshDisplayEvent; - } - } - - /** Mouse listener for showing popup menu. */ - private class PopupHandler extends MouseAdapter { - private void handle(MouseEvent e) { - if(e.isPopupTrigger()) { - Object source = e.getSource(); - String[] menuStr = null; - JTree tree = (JTree) source; - - // Find the selected path. - TreePath selPath = tree.getPathForLocation( - e.getX(), e.getY()); - if (selPath == null) { - return; - } - - // Update the selection. - tree.setSelectionPath(selPath); - - // Find the selected object. - Object selObj = selPath.getLastPathComponent(); - - String defaultID = null; - - // Does the item provide its own menu? - if (selObj instanceof ACSInfoProvider) { - ACSInfoProvider ip = (ACSInfoProvider) selObj; - menuStr = ip.getMenuString(); - defaultID = ip.getDefaultActionID(); - } else { - // Get the menu from the prop file. - menuStr = getContext().getResources().getStringArray( - ElementNavigator.class, defaultID); - } - - // Should we create a menu? - if (menuStr != null && menuStr.length != 0) { - ActionManager mgr = getContext().getActions(); - JPopupMenu menu = mgr.createPopup(menuStr, defaultID); - menu.show((JComponent)e.getSource(), e.getX(), e.getY()); - } - } - } - - public void mousePressed(MouseEvent e) { - handle(e); - } - public void mouseReleased(MouseEvent e) { - handle(e); - } - public void mouseClicked(MouseEvent e) { - handle(e); - } - } - - /** Class for handling drag operation. */ - private static class DragHandler implements DragTreeListener { - - /** - * Append the object to the end of the parent's child list. - */ - public Object appendChild(Object parent, Object newChild) { - - ACSTreeNodeElement parentNode = - (ACSTreeNodeElement) parent; - ACSTreeNodeElement newChildNode = - (ACSTreeNodeElement) newChild; - ACSTreeNodeElement clone = - (ACSTreeNodeElement) newChildNode.cloneNode(true); - parentNode.appendChild(clone); - return clone; - } - - /** - * Append the object to the end of the parent's child list. - */ - public Object insertBefore(Object parent, Object index, Object newChild) { - - ACSTreeNodeElement parentNode = - (ACSTreeNodeElement) parent; - ACSTreeNodeElement indexNode = - (ACSTreeNodeElement) index; - ACSTreeNodeElement newChildNode = - (ACSTreeNodeElement) newChild; - ACSTreeNodeElement clone = - (ACSTreeNodeElement) newChildNode.cloneNode(true); - parentNode.insertBefore(clone, indexNode); - return clone; - } - - /** - * Append the object to the end of the parent's child list. - */ - public void removeChild(Object child) { - - ACSTreeNodeElement childNode = - (ACSTreeNodeElement) child; - ACSTreeNodeElement parentNode = - (ACSTreeNodeElement) childNode.getParentNode(); - parentNode.removeChild(childNode); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/modules/edit/ElementTreeCellRenderer.java b/src/antidote/org/apache/tools/ant/gui/modules/edit/ElementTreeCellRenderer.java deleted file mode 100644 index a948496a6..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/edit/ElementTreeCellRenderer.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.modules.edit; - -import org.apache.tools.ant.gui.acs.ACSElement; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.JTree; -import javax.swing.ImageIcon; -import java.awt.Component; -import java.awt.Image; -import java.beans.*; - -/** - * Cell renderer for displaying the Ant XML file in a JTree. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ElementTreeCellRenderer extends DefaultTreeCellRenderer { - - public Component getTreeCellRendererComponent(JTree tree, - Object value, - boolean sel, - boolean expanded, - boolean leaf, - int row, - boolean hasFocus) { - super.getTreeCellRendererComponent(tree, value, sel, expanded, - leaf, row, hasFocus); - - try { - BeanInfo info = Introspector.getBeanInfo(value.getClass()); - Image icon = info.getIcon(BeanInfo.ICON_COLOR_16x16); - setIcon(icon == null ? null : new ImageIcon(icon)); - - if(value instanceof ACSElement) { - setText(((ACSElement)value).getDisplayName()); - } - else { - setText(info.getBeanDescriptor().getDisplayName()); - } - } - catch(IntrospectionException ex) { - // XXX log me. - ex.printStackTrace(); - } - - return this; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/modules/edit/PropertyEditor.java b/src/antidote/org/apache/tools/ant/gui/modules/edit/PropertyEditor.java deleted file mode 100644 index d2be69bb2..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/edit/PropertyEditor.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.modules.edit; - -import org.apache.tools.ant.gui.customizer.DynamicCustomizer; -import org.apache.tools.ant.gui.core.*; -import org.apache.tools.ant.gui.acs.*; -import org.apache.tools.ant.gui.event.*; -import javax.swing.*; -import java.util.*; -import java.beans.*; -import java.io.StringReader; -import java.io.IOException; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Point; - -/** - * Stub for a property editor. - * - * @version $Revision$ - * @author Simeon H.K. Fitch - */ -public class PropertyEditor extends AntModule { - - /** The editor for current bean.*/ - private Customizer _customizer = null; - /** Container for the customizer. */ - private JPanel _container = null; - /** Scroll area containing contents. */ - private JScrollPane _scroller = null; - /** Property change forwarder. */ - private PropertyChangeForwarder _forwarder = new PropertyChangeForwarder(); - - /** - * Default ctor. - * - */ - public PropertyEditor() { - } - - /** - * Using the given AppContext, initialize the display. - * - * @param context Application context. - */ - public void contextualize(AppContext context) { - setContext(context); - context.getEventBus().addMember(EventBus.MONITORING, new Handler()); - setLayout(new BorderLayout()); - _container = new JPanel(new BorderLayout()); - add(_scroller = new JScrollPane(_container)); - } - - /** - * Update the display for the current items. - * - * @param items Current items to display. - */ - private void updateDisplay(ACSElement[] items) { - if(_customizer != null) { - _customizer.removePropertyChangeListener(_forwarder); - _container.remove((Component)_customizer); - _customizer = null; - } - - if(items != null && items.length > 0) { - // The last selection element is the the one the - // user most recently selected. - ACSElement item = items[items.length - 1]; - - try { - BeanInfo info = Introspector.getBeanInfo(item.getClass()); - _customizer = (Customizer) info.getBeanDescriptor(). - getCustomizerClass().newInstance(); - _customizer.setObject(item); - _container.add(BorderLayout.CENTER, (Component) _customizer); - _customizer.addPropertyChangeListener(_forwarder); - } - catch(Exception ex) { - // XXX log me. - ex.printStackTrace(); - } - } - - _container.validate(); - _container.repaint(); - } - - - /** 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 posted to the member. - * - * @param event Event to post. - * @return true if event should be propogated, false if - * it should be cancelled. - */ - public boolean eventPosted(EventObject event) { - if(event instanceof ProjectClosedEvent) { - updateDisplay(null); - } - else { - ElementSelectionEvent e = (ElementSelectionEvent) event; - ACSElement[] elements = e.getSelectedElements(); - updateDisplay(elements); - } - return true; - } - - } - /** 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 ElementSelectionEvent || - event instanceof ProjectClosedEvent; - } - } - - /** Class for forwarding property change events to the event bus. */ - private class PropertyChangeForwarder implements PropertyChangeListener { - public void propertyChange(PropertyChangeEvent e) { - getContext().getEventBus().postEvent(e); - } - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/modules/edit/TargetsTableModel.java b/src/antidote/org/apache/tools/ant/gui/modules/edit/TargetsTableModel.java deleted file mode 100755 index cd6eb62a3..000000000 --- a/src/antidote/org/apache/tools/ant/gui/modules/edit/TargetsTableModel.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.modules.edit; - -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import java.util.List; -import java.util.ArrayList; - -import javax.swing.table.AbstractTableModel; - -import org.apache.tools.ant.gui.acs.ACSProjectElement; -import org.apache.tools.ant.gui.acs.ACSTargetElement; - -/** - * This is a TableModel containing the co-targets of a distinct target. - * - * @version $Revision$ - * @author Christoph Wilhelms - */ -public class TargetsTableModel extends AbstractTableModel { - // model data - private List _delegate = new ArrayList(); - private ACSTargetElement _mainTarget = null; - - /** - * Default constructor - */ - public TargetsTableModel() { - super(); - } - - /** - * @param int columnIndex - * @return String.class - */ - public Class getColumnClass(int columnIndex) { - return String.class; - } - - /** - * @return 2 - */ - public int getColumnCount() { - return 2; - } - - /** - * @return number of containing element - */ - public int getRowCount() { - return _delegate.size(); - } - - /** - * @param row and column in table - * @return the requested object to be shown. - */ - public Object getValueAt(int row, int col) { - ACSTargetElement rowObj = (ACSTargetElement)_delegate.get(row); - switch (col) { - case 0: return rowObj.getName(); - case 1: return rowObj.getDescription(); - default: return ""; - } - } - - /** - * @return false for no cell is editable. - */ - public boolean isCellEditable(int row, int col) { - return false; - } - - /** - * Change the entire model. - * @param List of ACSTargetElements - */ - public void setTargets(List newTargets) { - _delegate = newTargets; - fireTableDataChanged(); - } - - /** - * Access a single element. - * @param rowIndex - * @return ACSTargetElement - */ - public ACSTargetElement getTarget(int index) { - return (ACSTargetElement)_delegate.get(index); - } - - /** - * Remove a single element. - * @param int rowIndex - */ - public void removeTarget(int index) { - _delegate.remove(index); - fireTableRowsDeleted(index -1, index); - } - - /** - * Add a new element to list. - * @param ACSTargetElement newTarget to be added to the list. - */ - public void addTarget(ACSTargetElement newTarget) { - _delegate.add(newTarget); - fireTableRowsInserted(_delegate.size()-1, _delegate.size()); - } - - /** - * Moves a Target - * @param int rowindex in List - * @param int delta to move (negative to move up) - */ - public void moveTarget(int index, int delta) { - if (index + delta < 0) return; - else if (index + delta > _delegate.size()) return; - Object backObj = _delegate.get(index + delta); - _delegate.set(index + delta, _delegate.get(index) ); - _delegate.set(index, backObj); - fireTableRowsUpdated(index + delta, index); - } - - /** - * @return a StringArray (String[]) containing the names of all targets. - */ - public String[] getTargetsAsStringArray() { - int length = _delegate.size(); - String[] retVal = new String[length]; - - for (int i = 0; i < length; i++) { - retVal[i] = ((ACSTargetElement)_delegate.get(i)).getName(); - } - return retVal; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/resources/action.properties b/src/antidote/org/apache/tools/ant/gui/resources/action.properties deleted file mode 100644 index 7ecb66cc1..000000000 --- a/src/antidote/org/apache/tools/ant/gui/resources/action.properties +++ /dev/null @@ -1,185 +0,0 @@ -# Define the primary menubar items. -menus=File, View, Build, Projects, Help - -# Declare the list of known actions. -actions=\ - new, open, save, saveas, close, exit, about, \ - newTarget, newElement, newProperty, deleteElement, \ - startBuild, stopBuild, viewConsole - -# Configure the decalred actions. -new.name=New Project... -new.shortDescription=Create a new project -new.parentMenuName=File -new.icon=new-project.gif -new.accelerator=control N -new.enabled=true -new.command=org.apache.tools.ant.gui.command.NewProjectCmd - -open.name=Open... -open.shortDescription=Open an existing project -open.parentMenuName=File -open.icon=open.gif -open.accelerator=control O -open.enabled=true -open.command=org.apache.tools.ant.gui.command.OpenCmd - -save.name=Save -save.shortDescription=Save the current project -save.parentMenuName=File -save.icon=save.gif -save.accelerator=control S -save.command=org.apache.tools.ant.gui.command.SaveCmd -save.enabled=false -save.disableOn= \ - org.apache.tools.ant.gui.event.ProjectClosedEvent, \ - org.apache.tools.ant.gui.event.BuildStartedEvent -save.enableOn= \ - org.apache.tools.ant.gui.event.ProjectSelectedEvent, \ - org.apache.tools.ant.gui.event.NewProjectEvent, \ - org.apache.tools.ant.gui.event.BuildFinishedEvent - -saveas.name=Save As... -saveas.shortDescription=Save to a specific file -saveas.parentMenuName=File -saveas.command=org.apache.tools.ant.gui.command.SaveAsCmd -saveas.enabled=false -saveas.disableOn= \ - org.apache.tools.ant.gui.event.ProjectClosedEvent, \ - org.apache.tools.ant.gui.event.BuildStartedEvent -saveas.enableOn= \ - org.apache.tools.ant.gui.event.ProjectSelectedEvent, \ - org.apache.tools.ant.gui.event.NewProjectEvent, \ - org.apache.tools.ant.gui.event.BuildFinishedEvent - -close.name=Close -close.shortDescription=Close the current project -close.parentMenuName=File -close.command=org.apache.tools.ant.gui.command.CloseCmd -close.enabled=false -close.disableOn= \ - org.apache.tools.ant.gui.event.ProjectClosedEvent, \ - org.apache.tools.ant.gui.event.BuildStartedEvent -close.enableOn= \ - org.apache.tools.ant.gui.event.ProjectSelectedEvent, \ - org.apache.tools.ant.gui.event.NewProjectEvent, \ - org.apache.tools.ant.gui.event.BuildFinishedEvent - -exit.name=Exit -exit.shortDescription=Quit the application -exit.parentMenuName=File -exit.separator=true -exit.command=org.apache.tools.ant.gui.command.ExitCmd -exit.enabled=true - -about.name=About... -about.shortDescription=About this application -about.parentMenuName=Help -about.separator=true; -about.enabled=true -about.command=org.apache.tools.ant.gui.command.AboutCmd - -startBuild.name=Start Build -startBuild.shortDescription=Start build of selected target -startBuild.parentMenuName=Build -startBuild.icon=start.gif -startBuild.separator=true -startBuild.accelerator=control B -startBuild.command=org.apache.tools.ant.gui.command.BuildCmd -startBuild.enabled=false -startBuild.enableOn=\ - org.apache.tools.ant.gui.event.ProjectSelectedEvent, \ - org.apache.tools.ant.gui.event.NewProjectEvent, \ - org.apache.tools.ant.gui.event.BuildFinishedEvent -startBuild.disableOn=\ - org.apache.tools.ant.gui.event.BuildStartedEvent, \ - org.apache.tools.ant.gui.event.ProjectClosedEvent - -stopBuild.name=Stop Build -stopBuild.shortDescription=Stop the current build -stopBuild.parentMenuName=Build -stopBuild.icon=stop.gif -stopBuild.accelerator=control K -stopBuild.enabled=false -stopBuild.enableOn=\ - org.apache.tools.ant.gui.event.BuildStartedEvent -stopBuild.disableOn=\ - org.apache.tools.ant.gui.event.BuildFinishedEvent - -newTarget.name=New Target -newTarget.shortDescription=Create a new target -newTarget.icon=new-target.gif -newTarget.enabled=false -newTarget.separator=true -newTarget.command=org.apache.tools.ant.gui.command.NewTargetCmd -newTarget.enableOn=\ - org.apache.tools.ant.gui.event.ProjectSelectedEvent, \ - org.apache.tools.ant.gui.event.NewProjectEvent -newTarget.disableOn=\ - org.apache.tools.ant.gui.event.TargetSelectionEvent, \ - org.apache.tools.ant.gui.event.TaskSelectionEvent, \ - org.apache.tools.ant.gui.event.PropertySelectionEvent, \ - org.apache.tools.ant.gui.event.ProjectClosedEvent, \ - org.apache.tools.ant.gui.event.NullSelectionEvent, \ - org.apache.tools.ant.gui.event.DtdDefinedElementSelectionEvent - -newTask.name=New Task -newTask.shortDescription=Create a new task under the selected target -newTask.icon=new-task.gif -newTask.enabled=false -newTask.command=org.apache.tools.ant.gui.command.NewTaskCmd -newTask.enableOn=\ - org.apache.tools.ant.gui.event.TargetSelectionEvent -newTask.disableOn=\ - org.apache.tools.ant.gui.event.ProjectClosedEvent, \ - org.apache.tools.ant.gui.event.TaskSelectionEvent, \ - org.apache.tools.ant.gui.event.PropertySelectionEvent, \ - org.apache.tools.ant.gui.event.NullSelectionEvent, \ - org.apache.tools.ant.gui.event.DtdDefinedElementSelectionEvent - -newProperty.name=New Property -newProperty.shortDescription=Create a new property under the selected element -newProperty.icon=new-property.gif -newProperty.command=org.apache.tools.ant.gui.command.NewPropertyCmd -newProperty.enabled=false -newProperty.enableOn=\ - org.apache.tools.ant.gui.event.ProjectSelectedEvent, \ - org.apache.tools.ant.gui.event.NewProjectEvent, \ - org.apache.tools.ant.gui.event.TargetSelectionEvent, \ - org.apache.tools.ant.gui.event.TaskSelectionEvent -newProperty.disableOn=\ - org.apache.tools.ant.gui.event.PropertySelectionEvent, \ - org.apache.tools.ant.gui.event.ProjectClosedEvent, \ - org.apache.tools.ant.gui.event.NullSelectionEvent, \ - org.apache.tools.ant.gui.event.DtdDefinedElementSelectionEvent - -newElement.name=New Element -newElement.shortDescription=Create a new element under the selected element -newElement.icon=default.gif -newElement.command=org.apache.tools.ant.gui.command.NewElementCmd -newElement.enabled=true -newElement.hidden=true -newElement.popupSeparator=true - -deleteElement.name=Delete Element -deleteElement.shortDescription=Delete the selected element -deleteElement.icon=default.gif -deleteElement.command=org.apache.tools.ant.gui.command.DeleteElementCmd -deleteElement.enabled=true -deleteElement.hidden=true -deleteElement.popupSeparator=true - -viewConsole.name=console -viewConsole.shortDescription=Displays or hides the console pane -viewConsole.parentMenuName=View -viewConsole.icon=console.gif -viewConsole.separator=true -viewConsole.accelerator=control C -viewConsole.enabled=true -viewConsole.toggle=true -viewConsole.initalToggleValue=true -viewConsole.command=org.apache.tools.ant.gui.command.ShowOrHideConsoleCmd -viewConsole.checkedTrueOn=\ - org.apache.tools.ant.gui.event.ConsoleVisibleEvent -viewConsole.checkedFalseOn=\ - org.apache.tools.ant.gui.event.ConsoleNotVisibleEvent diff --git a/src/antidote/org/apache/tools/ant/gui/resources/antidote.properties b/src/antidote/org/apache/tools/ant/gui/resources/antidote.properties deleted file mode 100644 index d1ec98e91..000000000 --- a/src/antidote/org/apache/tools/ant/gui/resources/antidote.properties +++ /dev/null @@ -1,141 +0,0 @@ -# This is the general properties file for the Antidote application. - -#debug=true - -# The following four module properties configure those properties that -# should be initialized and displayed by default by the GUI. If more -# than one module is configured for a property (as indicated providing -# class names as a comma delimited list), then each module will appear -# in its own tab in a JTabbedPane. - -# Configure the modules that appear on the right of the UI. -org.apache.tools.ant.gui.Antidote.right.modules=\ - org.apache.tools.ant.gui.modules.edit.PropertyEditor - -# Configure the modules that appear on the left of the UI. -org.apache.tools.ant.gui.Antidote.left.modules=\ - org.apache.tools.ant.gui.modules.edit.ElementNavigator - -# Configure the modules that appear on the bottom of the UI. -org.apache.tools.ant.gui.Antidote.bottom.modules=\ - org.apache.tools.ant.gui.modules.console.BuildConsole - -# Configure the modules that appear on the top of the UI. -org.apache.tools.ant.gui.Antidote.top.modules=\ - org.apache.tools.ant.gui.modules.TargetMonitor - -org.apache.tools.ant.gui.modules.edit.PropertyEditor.name=Properties - -# DependentTargetChooser part of the DependentTargetPropertyEditor -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.ok=OK -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.cancel=Cancel -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.target=Target -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.description=Description -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.upIcon=up.gif -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.downIcon=down.gif -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.addIcon=enter.gif -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.removeIcon=exit.gif -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.up=Move dependent target up -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.down=Move dependent target down -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.add=Add target to dependent list -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.remove=Remove target from dependent list -org.apache.tools.ant.gui.modules.edit.DependentTargetChooser.selection=Selection - -org.apache.tools.ant.gui.modules.edit.ElementNavigator.name=Project -org.apache.tools.ant.gui.modules.edit.ElementNavigator.popupActions=\ - newTarget, newTask, newProperty - -org.apache.tools.ant.gui.modules.TargetMonitor.name=Selected Target(s) -org.apache.tools.ant.gui.modules.TargetMonitor.defText=[none] - -org.apache.tools.ant.gui.modules.console.BuildConsole.name=Console -org.apache.tools.ant.gui.modules.console.BuildConsole.clearLog=\ - Clear Log -org.apache.tools.ant.gui.modules.console.BuildConsole.logLevel=\ - Log message level: - -org.apache.tools.ant.gui.core.XMLFileFilter.description=XML Files - -org.apache.tools.ant.gui.core.ProjectSelectionMenu.name=Projects - -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=Antidote Error... -org.apache.tools.ant.gui.command.DisplayErrorCmd.expand=Details >> - -org.apache.tools.ant.gui.command.SaveCmd.saveError=Could not save to "{0}". -org.apache.tools.ant.gui.command.SaveCmd.noProject=No project to save. -org.apache.tools.ant.gui.command.SaveCmd.title=Overwrite? -org.apache.tools.ant.gui.command.SaveCmd.overwrite=Overwrite file "{0}"? - -# Properties file for BeanInfo strings - -org.apache.tools.ant.gui.acs.ACSTargetElementBeanInfo.beanName=Target -org.apache.tools.ant.gui.acs.ACSTargetElementBeanInfo.beanDescription=\ - An executable target in the build. -org.apache.tools.ant.gui.acs.ACSTargetElementBeanInfo.name=Name -org.apache.tools.ant.gui.acs.ACSTargetElementBeanInfo.description=Description -org.apache.tools.ant.gui.acs.ACSTargetElementBeanInfo.depends=Dependencies -org.apache.tools.ant.gui.acs.ACSTargetElementBeanInfo.if=if Clause -org.apache.tools.ant.gui.acs.ACSTargetElementBeanInfo.unless=unless Clause -org.apache.tools.ant.gui.acs.ACSTargetElementBeanInfo.xmlString=XML Code -org.apache.tools.ant.gui.acs.ACSTargetElementBeanInfo.icon=target.gif - -org.apache.tools.ant.gui.acs.ACSProjectElementBeanInfo.beanName=Project -org.apache.tools.ant.gui.acs.ACSProjectElementBeanInfo.beanDescription=\ - The top level project in the build definition. -org.apache.tools.ant.gui.acs.ACSProjectElementBeanInfo.name=Name -org.apache.tools.ant.gui.acs.ACSProjectElementBeanInfo.description=Description -org.apache.tools.ant.gui.acs.ACSProjectElementBeanInfo.basedir=Base Directory -org.apache.tools.ant.gui.acs.ACSProjectElementBeanInfo.default=Default Target -org.apache.tools.ant.gui.acs.ACSProjectElementBeanInfo.icon=project.gif - -org.apache.tools.ant.gui.acs.ACSPropertyElementBeanInfo.beanName=Property -org.apache.tools.ant.gui.acs.ACSPropertyElementBeanInfo.beanDescription=\ - A scoped property -org.apache.tools.ant.gui.acs.ACSPropertyElementBeanInfo.name=Name -org.apache.tools.ant.gui.acs.ACSPropertyElementBeanInfo.value=Value -org.apache.tools.ant.gui.acs.ACSPropertyElementBeanInfo.file=File -org.apache.tools.ant.gui.acs.ACSPropertyElementBeanInfo.icon=property.gif - -org.apache.tools.ant.gui.acs.ACSTaskElementBeanInfo.beanName=Task -org.apache.tools.ant.gui.acs.ACSTaskElementBeanInfo.beanDescription=\ - A scoped property -org.apache.tools.ant.gui.acs.ACSTaskElementBeanInfo.taskType=Type -org.apache.tools.ant.gui.acs.ACSTaskElementBeanInfo.namedValues=Attributes -org.apache.tools.ant.gui.acs.ACSTaskElementBeanInfo.xmlString=XML Code -org.apache.tools.ant.gui.acs.ACSTaskElementBeanInfo.icon=task.gif - -org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.beanName= -org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.beanDescription=\ - A scoped property -org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.taskType=Type -org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.namedValues=\ - Attributes -org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.xmlString=XML Code -org.apache.tools.ant.gui.acs.ACSDtdDefinedElementBeanInfo.icon=default.gif - -org.apache.tools.ant.gui.command.NewProjectCmd.defName=New Project -org.apache.tools.ant.gui.command.NewTargetCmd.defName=New Target - -#---------------------------------------------------------------------------- -# About Description (NB: this is only a temporary approach). -#---------------------------------------------------------------------------- - -org.apache.tools.ant.gui.About.title=About -org.apache.tools.ant.gui.About.ok=OK -org.apache.tools.ant.gui.About.message=\ -

    Antidote

    \ -

    Copyright © 2000 The Apache Software Foundation.
    \ - All rights reserved.


    \ -

    Visit http://jakarta.apache.org/ant for more information.


    \ - \ - \ - \ -
    Version:{0}
    Date:{1}
    \ -
    \ -

    Icons Copyright © 1998 Dean S. Jones (deansjones@hotmail.com)
    \ - http://jfa.javalobby.org/projects/icons

    \ - diff --git a/src/antidote/org/apache/tools/ant/gui/resources/args.properties b/src/antidote/org/apache/tools/ant/gui/resources/args.properties deleted file mode 100644 index 15297f9c0..000000000 --- a/src/antidote/org/apache/tools/ant/gui/resources/args.properties +++ /dev/null @@ -1,7 +0,0 @@ -# Property file for the command-line strings used by the Args class. - -usage=usage: antidote [-help] [-wizzard] [-debug] [build-file]\n\ -\nReport bugs to http://jakarta.apache.org/site/bugs.html\n\ -Copyright (C) 2001 Apache Software Foundation. All rights reserved. - -invalidArg=Unrecognized argument: "{0}" diff --git a/src/antidote/org/apache/tools/ant/gui/resources/buildFileWizard.properties b/src/antidote/org/apache/tools/ant/gui/resources/buildFileWizard.properties deleted file mode 100644 index 7d5842e51..000000000 --- a/src/antidote/org/apache/tools/ant/gui/resources/buildFileWizard.properties +++ /dev/null @@ -1,88 +0,0 @@ -# Property file for the wizard used to create a new build file. - -########################################################### -# Define required properties for wizard. -########################################################### -next=Next >> -back=<< Back -cancel=Cancel -finish=Finish -progress=Progress -help=Help - -########################################################### -# Define the steps the comprise the wizard. -########################################################### -steps=start, type, setup, compile, jar, javadoc, finish - -########################################################### -# Step: start -########################################################### -start.editor=org.apache.tools.ant.gui.wizard.InstructionStep -start.title=Create new build file -start.description=This wizard will step you through the process of creating \ -a basic Ant build file for your project. - -start.instructions=Welcome to the Ant build file wizard!\n\ -You will be asked a series of questions about the project you wish to create\ -and the types of build options you want included.\n\n\ -Click "Next >>" to proceed. - -########################################################### -# Step: type -########################################################### - -type.editor=org.apache.tools.ant.gui.wizard.build.ProjectTypeStep -type.title=Select project type -type.description=Select "New" if you want the buile environment \ -directory structure defined and created for you \ -in addition to the build file. Select "Import" if you want \ -a build file created for an existing project. - -type.isNewLabel=New project -type.isImportLabel=Import existing project - -########################################################### -# Step: setup -########################################################### - -setup.editor=org.apache.tools.ant.gui.wizard.build.ProjectSetupStep -setup.title=Setup project -setup.description=Give the project a name, and select the features you \ -wish to be included in the project file, such as JavaDoc and JAR creation. -setup.fileLabel=Build File: -setup.nameLabel=Project Name: -setup.optionsLabel=Options -setup.compile.label=Compiled Java code (.class files) -setup.jar.label=Executable JAR file -setup.javadoc.label=JavaDoc - -########################################################### -# Step: compile -########################################################### -compile.title=Setup Java source compilation -compile.description=Need help? -compile.editor=org.apache.tools.ant.gui.wizard.build.CompileStep - -########################################################### -# Step: jar -########################################################### -jar.title=Setup executable JAR creation -jar.description=Need help? -jar.editor=org.apache.tools.ant.gui.wizard.build.JARStep - -########################################################### -# Step: javadoc -########################################################### -javadoc.title=Setup JavaDoc creation -javadoc.description=Need help? -javadoc.editor=org.apache.tools.ant.gui.wizard.build.JavaDocStep - -########################################################### -# Step: finish -########################################################### -finish.editor=org.apache.tools.ant.gui.wizard.build.FinishStep -finish.title=Complete build file -finish.description=Click "Finish" to save your build file definition. -finish.instructions=You are done!\n\nClick "Finish" to complete your new\ -build file. diff --git a/src/antidote/org/apache/tools/ant/gui/resources/console.gif b/src/antidote/org/apache/tools/ant/gui/resources/console.gif deleted file mode 100644 index 4fbd3361c..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/console.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/default.gif b/src/antidote/org/apache/tools/ant/gui/resources/default.gif deleted file mode 100644 index 46261fce3..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/default.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/down.gif b/src/antidote/org/apache/tools/ant/gui/resources/down.gif deleted file mode 100755 index c4ea1a7e0..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/down.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/enter.gif b/src/antidote/org/apache/tools/ant/gui/resources/enter.gif deleted file mode 100755 index 1153c7940..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/enter.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/exit.gif b/src/antidote/org/apache/tools/ant/gui/resources/exit.gif deleted file mode 100755 index 70a31cece..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/exit.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/icon-small.gif b/src/antidote/org/apache/tools/ant/gui/resources/icon-small.gif deleted file mode 100644 index 72878f344..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/icon-small.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/new-project.gif b/src/antidote/org/apache/tools/ant/gui/resources/new-project.gif deleted file mode 100644 index 9fadc876b..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/new-project.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/new-property.gif b/src/antidote/org/apache/tools/ant/gui/resources/new-property.gif deleted file mode 100644 index 6e82de781..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/new-property.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/new-target.gif b/src/antidote/org/apache/tools/ant/gui/resources/new-target.gif deleted file mode 100644 index 107fa6a9c..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/new-target.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/new-task.gif b/src/antidote/org/apache/tools/ant/gui/resources/new-task.gif deleted file mode 100644 index 4309cf340..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/new-task.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/new.gif b/src/antidote/org/apache/tools/ant/gui/resources/new.gif deleted file mode 100644 index 462ae4c09..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/new.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/open.gif b/src/antidote/org/apache/tools/ant/gui/resources/open.gif deleted file mode 100644 index 3bd72bee0..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/open.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/project.gif b/src/antidote/org/apache/tools/ant/gui/resources/project.gif deleted file mode 100644 index 3a2bed667..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/project.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/property.gif b/src/antidote/org/apache/tools/ant/gui/resources/property.gif deleted file mode 100644 index 08058a84d..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/property.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/save.gif b/src/antidote/org/apache/tools/ant/gui/resources/save.gif deleted file mode 100644 index fc7fc0507..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/save.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/start.gif b/src/antidote/org/apache/tools/ant/gui/resources/start.gif deleted file mode 100644 index 072861596..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/start.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/stop.gif b/src/antidote/org/apache/tools/ant/gui/resources/stop.gif deleted file mode 100644 index 063dc3cff..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/stop.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/target.gif b/src/antidote/org/apache/tools/ant/gui/resources/target.gif deleted file mode 100644 index 3488dd3fe..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/target.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/task.gif b/src/antidote/org/apache/tools/ant/gui/resources/task.gif deleted file mode 100644 index 8c091865b..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/task.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/unknown.gif b/src/antidote/org/apache/tools/ant/gui/resources/unknown.gif deleted file mode 100644 index cd94e5f68..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/unknown.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/resources/up.gif b/src/antidote/org/apache/tools/ant/gui/resources/up.gif deleted file mode 100755 index 9de036526..000000000 Binary files a/src/antidote/org/apache/tools/ant/gui/resources/up.gif and /dev/null differ diff --git a/src/antidote/org/apache/tools/ant/gui/util/ChangeLookAndFeel.java b/src/antidote/org/apache/tools/ant/gui/util/ChangeLookAndFeel.java deleted file mode 100644 index 0506e8ee3..000000000 --- a/src/antidote/org/apache/tools/ant/gui/util/ChangeLookAndFeel.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.gui.util; - -import org.apache.tools.ant.gui.core.AppContext; -import org.apache.tools.ant.gui.event.ErrorEvent; -import org.apache.tools.ant.gui.util.WindowUtils; - -import javax.swing.*; -import java.io.IOException; -import java.util.*; -import java.awt.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** - * Dialog for changing the current Look and Feel - * - * @version $Revision$ - * @author Erik Meade - */ -public class ChangeLookAndFeel extends JDialog { - - private AppContext _context; - - private JList lookAndFeels; - /** - * Standard ctor. - * - * @param context Application context. - */ - public ChangeLookAndFeel(AppContext context) { - super(context.getParentFrame(), true); - _context = context; - setDefaultCloseOperation(DISPOSE_ON_CLOSE); - - setTitle(context.getResources().getString( - getClass(), "title")); - - // Add the OK button. - JButton ok = new JButton( - context.getResources().getString(getClass(), "ok")); - ok.addActionListener(new ActionHandler()); - JPanel p = new JPanel(); - p.add(ok); - Container contentPane = getContentPane(); - getRootPane().setDefaultButton(ok); - p.setPreferredSize(new Dimension(150, p.getPreferredSize().height)); - contentPane.add(BorderLayout.SOUTH, p); - - // Add the list of look and feels - p = new JPanel(new BorderLayout()); - p.setBorder(BorderFactory.createTitledBorder( - context.getResources().getString(getClass(), "border"))); - - UIManager.LookAndFeelInfo[] lookAndFeelInfos = - UIManager.getInstalledLookAndFeels(); - String[] lookAndFeelNames = new String[lookAndFeelInfos.length]; - for (int i = 0; i < lookAndFeelInfos.length; i++) { - lookAndFeelNames[i] = lookAndFeelInfos[i].getName(); - } - - lookAndFeels = new JList(lookAndFeelNames); - lookAndFeels.setSelectedValue( - UIManager.getLookAndFeel().getName(), true); - p.add(lookAndFeels); - contentPane.add(BorderLayout.CENTER, 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) { - try { - UIManager.setLookAndFeel(getLookAndFeelClass( - (String)lookAndFeels.getSelectedValue())); - SwingUtilities.updateComponentTreeUI( - _context.getParentFrame()); - } catch (Exception ex) { - _context.getEventBus().postEvent( - new ErrorEvent( - _context, _context.getResources().getString( - ChangeLookAndFeel.class, "error") + ex)); - } - WindowUtils.sendCloseEvent(ChangeLookAndFeel.this); - } - } - - /** - * Get the Look and Feel class for the given name. - * - * @param lookAndFeelName Name of the look and feel. - * @return Class name to load. - */ - private String getLookAndFeelClass(String lookAndFeelName) { - UIManager.LookAndFeelInfo[] lookAndFeelInfos = - UIManager.getInstalledLookAndFeels(); - for (int i = 0; i < lookAndFeelInfos.length; i++) { - if (lookAndFeelInfos[i].getName().equals(lookAndFeelName)) - return lookAndFeelInfos[i].getClassName(); - } - return null; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/util/CheckableButtonModel.java b/src/antidote/org/apache/tools/ant/gui/util/CheckableButtonModel.java deleted file mode 100644 index 21b737ace..000000000 --- a/src/antidote/org/apache/tools/ant/gui/util/CheckableButtonModel.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.util; - -import java.awt.event.ActionEvent; -import javax.swing.DefaultButtonModel; - -/** - * Provides a button which appears "pressed" when it is in - * a selected state. - *

    - * Call setSelected to select the button. When the - * button is selected, both the PRESSED and ARMED properties are - * set which gives the button a pressed appearance. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class CheckableButtonModel extends DefaultButtonModel { - - boolean _pressed = false; - boolean _armed = false; - - /** - * Constructs a CheckableButtonModel - * - */ - public CheckableButtonModel() { - } - - /** - * Sets the button to pressed or unpressed. - * - * @param b true to set the button to "pressed" - * @see #isPressed - */ - public void setPressed(boolean b) { - - if((_pressed == b) || !isEnabled()) { - return; - } - - _pressed = b; - - if(!_pressed && _armed) { - fireActionPerformed( - new ActionEvent(this, ActionEvent.ACTION_PERFORMED, - getActionCommand()) - ); - } - - fireStateChanged(); - - stateMask |= PRESSED; - } - - /** - * Marks the button as "armed". If the mouse button is - * released while it is over this item, the button's action event - * fires. If the mouse button is released elsewhere, the - * event does not fire and the button is disarmed. - * - * @param b true to arm the button so it can be selected - */ - public void setArmed(boolean b) { - - if((_armed == b) || !isEnabled()) { - return; - } - - _armed = b; - fireStateChanged(); - stateMask |= ARMED; - } - - /** - * Returns true if the button is selected. - * - * @return true if the button is "selected" - */ - public boolean isArmed() { - return isSelected(); - } - - /** - * Returns true if the button is selected. - * - * @return true if the button is "selected" - */ - public boolean isPressed() { - return isSelected(); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/util/Collections.java b/src/antidote/org/apache/tools/ant/gui/util/Collections.java deleted file mode 100644 index aee959d4c..000000000 --- a/src/antidote/org/apache/tools/ant/gui/util/Collections.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.tools.ant.gui.util; -import java.util.List; -import java.util.ArrayList; - -/** - * This class consists exclusively of static methods that operate on or return - * collections. - * - * @version $Revision$ - * @author Nick Davisnick_home_account@yahoo.com - */ -public class Collections { - /** - * Fills the input collection with the input array. - * - * @param dest the collection to fill, if null an ArrayList will be - * created and used. - * @param source source array - */ - public static List fill(List dest, Object[] source) { - if (dest == null) { - dest = new ArrayList(source.length); - } - for(int i = 0; i < source.length; i++) { - dest.add(source[i]); - } - return dest; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/util/LabelFieldGBC.java b/src/antidote/org/apache/tools/ant/gui/util/LabelFieldGBC.java deleted file mode 100644 index 4a34abbee..000000000 --- a/src/antidote/org/apache/tools/ant/gui/util/LabelFieldGBC.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.util; - -import java.awt.GridBagConstraints; -import java.awt.Insets; -import java.awt.Container; -import javax.swing.JLabel; - -/** - * Convenience specialization of the GridBagConstraints for laying - * out label:field pairs. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class LabelFieldGBC extends GridBagConstraints { - - /** - * Default ctor. Sets up the default settings. - * - */ - public LabelFieldGBC() { - // Add small abount of padding. - insets = new Insets(1,3,1,3); - // All vertical layout is relative - gridy = RELATIVE; - // Grid dimensions are equal (one label field pair per row). - gridheight = 1; - gridwidth = 1; - } - - /** - * Set up constraint values for placing a label before a field. - * - * @return Constraints for a label. - */ - public LabelFieldGBC forLabel() { - // Labels should only take up as much room as needed. - fill = NONE; - // Set location to left side. - gridx = 0; - // Move it over to be as close to field as possible. - anchor = NORTHEAST; - // Don't take up any extra. - weightx = 0.0; - return this; - } - - /** - * Provide the same setup as forLabel(), but allow it to expand vertically - * to use up any extra space there may be. - * - * @return Constraints for label that sucks up vertical space. - */ - public LabelFieldGBC forLastLabel() { - forLabel(); - fill = VERTICAL; - weighty = 1.0; - return this; - } - - /** - * Set up constraint values for placing a field after a label. - * - * @return Constraints for a field. - */ - public LabelFieldGBC forField() { - // The field should take up as much space as is necessary. - fill = HORIZONTAL; - // Set the location to the right side. - gridx = 1; - // Center the field in the space available (a noop in this case). - anchor = CENTER; - // Take up any extra space. - weightx = 1.0; - return this; - } - - /** - * Provide the same setup as forField(), but allow it to expand vertically - * - * - * @return Constraintes for field that sucks up vertical space. - */ - public LabelFieldGBC forLastField() { - forField(); - fill = BOTH; - weighty = 1.0; - return this; - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/util/StackFrame.java b/src/antidote/org/apache/tools/ant/gui/util/StackFrame.java deleted file mode 100644 index 00607c8ca..000000000 --- a/src/antidote/org/apache/tools/ant/gui/util/StackFrame.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -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$ - * @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(); - } -*/ -} - - diff --git a/src/antidote/org/apache/tools/ant/gui/util/WindowUtils.java b/src/antidote/org/apache/tools/ant/gui/util/WindowUtils.java deleted file mode 100644 index 446e23fba..000000000 --- a/src/antidote/org/apache/tools/ant/gui/util/WindowUtils.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -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$ - * @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 parent 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); - } - - /** - * Center the given child window with repsect to the root. - * - * @param child Window to center. - */ - public static void centerWindow(Window child) { - Dimension rsize = child.getToolkit().getScreenSize(); - Dimension size = child.getSize(); - child.setLocation((rsize.width - size.width)/2, - (rsize.height - size.height)/2); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/util/XMLHelper.java b/src/antidote/org/apache/tools/ant/gui/util/XMLHelper.java deleted file mode 100644 index 277a64f76..000000000 --- a/src/antidote/org/apache/tools/ant/gui/util/XMLHelper.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.util; - -/** - * Placeholder for XML related duties. - * - * @version $Revision$ - * @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(); - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/version.txt b/src/antidote/org/apache/tools/ant/gui/version.txt deleted file mode 100644 index b6b2f8db9..000000000 --- a/src/antidote/org/apache/tools/ant/gui/version.txt +++ /dev/null @@ -1,2 +0,0 @@ -VERSION=@VERSION@ -DATE=@DATE@ diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/AbstractWizardStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/AbstractWizardStep.java deleted file mode 100644 index f5160ba53..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/AbstractWizardStep.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard; -import org.apache.tools.ant.gui.core.ResourceManager; -import javax.swing.JComponent; - - -/** - * Abstract class implementing the basic support for the WizardStep interface. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public abstract class AbstractWizardStep extends JComponent - implements WizardStep { - - /** Flag to indicate whether or not init has been called. */ - private boolean _initialized = false; - /** Resources. */ - private ResourceManager _resources = null; - /** Step id. */ - private String _id = null; - /** Step display title. */ - private String _title = null; - /** Description of the step. */ - private String _description = null; - /** Data model. */ - private WizardData _model = null; - - /** - * Called when the instance should initialize its contents, e.g. - * create the widgets, etc. When this is called then all - * data values, including the ResourceManager, have been setup. - * - */ - protected abstract void init(); - - /** - * Set the step's resources. - * - */ - public void setResources(ResourceManager resources) { - _resources = resources; - } - - /** - * Get the step's resources. - * - * @return Resources. - */ - protected ResourceManager getResources() { - return _resources; - } - - /** - * Set the step id. The id must be unique among steps within the wizard. - * - * @param id Wizard id. - */ - public void setID(String id) { - _id = id; - } - - /** - * Get the step id. - * - * @return Step id. - */ - public String getID() { - return _id; - } - - /** - * Set the step title. - * - * @param title Step title. - */ - public void setTitle(String title) { - _title = title; - } - - /** - * Get the step title. - * - * @return Step title. - */ - public String getTitle() { - return _title; - } - - /** - * Set the step description. - * - * @param desc Step description. - */ - public void setDescription(String desc) { - _description = desc; - } - - /** - * Get the step description. - * - * @return Step description. - */ - public String getDescription() { - return _description; - } - - - /** - * Set the data model object that the step will edit. It is assumed - * that all steps initialized within a single wizard agree on the - * data model type. - * - * @param model Data model to edit. - */ - public void setDataModel(WizardData model) { - _model = model; - } - - /** - * Get the data model that should be passeed on to the next step. - * - * @return Current data model. - */ - public WizardData getDataModel() { - return _model; - } - - /** - * Get the component that should be displayed to the user for - * editing the model. This component should not include the - * title and text display, which is handled by the wizard container. - * - * @return Editing component. - */ - public JComponent getEditorComponent() { - if(!_initialized) { - init(); - _initialized = true; - } - - return this; - } - - /** - * Get the id of the next step. - * - * @return ID of next step. - */ - public String getNext() { - return getDataModel().getStateMachine().getNext( - this, getDataModel()); - } - - /** - * Get the id of the previous step. - * - * @return Previous step. - */ - public String getPrevious() { - return getDataModel().getStateMachine().getPrevious( - this, getDataModel()); - } - - /** - * Get a string representation of this. - * - * @return String representation. - */ - public String toString() { - StringBuffer buf = new StringBuffer(getClass().getName()); - buf.append("[id="); - buf.append(getID()); - buf.append("]"); - return buf.toString(); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/ButtonNavigator.java b/src/antidote/org/apache/tools/ant/gui/wizard/ButtonNavigator.java deleted file mode 100644 index 2780aed83..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/ButtonNavigator.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard; -import org.apache.tools.ant.gui.core.ResourceManager; -import javax.swing.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.FlowLayout; -import java.util.*; - -class ButtonNavigator extends JComponent implements WizardNavigator { - public static final String NEXT = "next"; - public static final String BACK = "back"; - public static final String CANCEL = "cancel"; - public static final String FINISH = "finish"; - - /** Resources. */ - private ResourceManager _resources = null; - /** Event listeners. */ - private List _listeners = new ArrayList(); - - /* Buttons. */ - private JButton _next = null; - private JButton _back = null; - private JButton _cancel = null; - private JButton _finish = null; - - /** Action handler. */ - private ActionHandler _handler = new ActionHandler(); - - public ButtonNavigator(ResourceManager resources) { - _resources = resources; - setLayout(new FlowLayout(FlowLayout.RIGHT)); - - _back = new JButton(_resources.getString(BACK)); - _next = new JButton(_resources.getString(NEXT)); - _finish = new JButton(_resources.getString(FINISH)); - _cancel = new JButton(_resources.getString(CANCEL)); - - _back.setActionCommand(BACK); - _next.setActionCommand(NEXT); - _finish.setActionCommand(FINISH); - _cancel.setActionCommand(CANCEL); - - _back.addActionListener(_handler); - _next.addActionListener(_handler); - _finish.addActionListener(_handler); - _cancel.addActionListener(_handler); - - _back.setEnabled(false); - _next.setEnabled(false); - _finish.setEnabled(false); - _cancel.setEnabled(true); - - add(_back); - add(_next); - add(_finish); - add(_cancel); - } - - /** - * Add a navigator listener. - * - * @param l Listener to add. - */ - public void addNavigatorListener(NavigatorListener l) { - _listeners.add(l); - } - - /** - * Remove a navigator listener. - * - * @param l Listener to remove. - */ - public void removeNavigatorListener(NavigatorListener l) { - _listeners.remove(l); - } - - /** - * Set the enabled state of the back button. - * - * @param state True for enabled, false for disabled. - */ - public void setBackEnabled(boolean state) { - _back.setEnabled(state); - } - /** - * Set the enabled state of the next button. - * - * @param state True for enabled, false for disabled. - */ - public void setNextEnabled(boolean state) { - _next.setEnabled(state); - } - /** - * Set the enabled state of the finished button. - * - * @param state True for enabled, false for disabled. - */ - public void setFinishEnabled(boolean state) { - _finish.setEnabled(state); - } - - /** Handler of the button presses. */ - private class ActionHandler implements ActionListener { - public void actionPerformed(ActionEvent e) { - Object source = e.getSource(); - - // Predetermine which method to call so that - // we don't traverse if statements for each iteration. - int idx = -1; - if(source == _next) { - idx = 0; - } - else if(source == _back) { - idx = 1; - } - else if(source == _cancel) { - idx = 2; - } - else if(source == _finish) { - idx = 3; - } - - Iterator it = _listeners.iterator(); - while(it.hasNext()) { - NavigatorListener l = (NavigatorListener) it.next(); - switch(idx) { - case 0: - l.nextStep(); - break; - case 1: - l.backStep(); - break; - case 2: - l.cancel(); - break; - case 3: - l.finish(); - break; - } - - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/DefaultStateMachine.java b/src/antidote/org/apache/tools/ant/gui/wizard/DefaultStateMachine.java deleted file mode 100644 index 317a7a9da..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/DefaultStateMachine.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard; -import org.apache.tools.ant.gui.core.ResourceManager; -import java.util.*; - -/** - * A simple state machine based on the defined ordering of steps - * in the resources. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class DefaultStateMachine implements StateMachine { - - /** - * Get the list of step IDs defined in the resources as a list. - * - * @param data Current wizard state. - * @return List of step IDs - */ - protected List getStepList(WizardData data) { - return Arrays.asList(data.getResources().getStringArray("steps")); - } - - /** - * Get the next step. - * - * @param curr The current step. - * @param data The current state of the wizard. - * @return The ID of next step, or null if there currently isn't one. - */ - public String getNext(WizardStep curr, WizardData data) { - List steps = getStepList(data); - int nextIndex = steps.indexOf(curr.getID()) + 1; - if(nextIndex > 0 && nextIndex < steps.size()) { - return (String) steps.get(nextIndex); - } - return null; - } - - /** - * Get the previous step. - * - * @param curr The current step. - * @param data The current state of the wizard. - * @return The ID of previous step, or null if there currently isn't one. - */ - public String getPrevious(WizardStep curr, WizardData data) { - List steps = getStepList(data); - int nextIndex = steps.indexOf(curr.getID()) - 1; - if(nextIndex > 0 && nextIndex < steps.size()) { - return (String) steps.get(nextIndex); - } - return null; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/InstructionStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/InstructionStep.java deleted file mode 100644 index 65630e101..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/InstructionStep.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard; -import javax.swing.*; -import java.awt.BorderLayout; -import java.awt.Font; -import java.awt.Insets; - -/** - * Wizard step whose only purpose is to display some text. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class InstructionStep extends AbstractWizardStep { - - /** - * Initialize the contents of the container. - * - */ - protected void init() { - setLayout(new BorderLayout()); - String msg = getResources().getString(getID() + ".instructions"); - - JTextArea text = new JTextArea(msg); - text.setMargin(new Insets(30, 20, 5, 5)); - text.setOpaque(false); - text.setFont(new Font("Serif", Font.PLAIN, 18)); - text.setEditable(false); - text.setLineWrap(true); - text.setWrapStyleWord(true); - add(text); - } - - /** - * Called when the step should refresh its display based on the - * current model setting. - * - */ - public void updateDisplay() { - // NOOP - } - /** - * Called when the step should update the data model based on the - * settings of its widgets. - * - */ - public void updateDataModel() { - // NOOP - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/NavigatorListener.java b/src/antidote/org/apache/tools/ant/gui/wizard/NavigatorListener.java deleted file mode 100644 index 9837f8d3e..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/NavigatorListener.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard; - -/** - * Interface for classes interested in events from the WizardNavigator. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public interface NavigatorListener { - /** - * Called when the wizard should show the next step. - * - */ - void nextStep(); - /** - * Called when the wizard should show the previous step. - * - */ - void backStep(); - /** - * Called when the wizard should show the step with the given id. - * - * @param stepID ID of step to show. - */ - void gotoStep(String stepID); - /** - * Called when the wizard activity shold be cancelled. - * - */ - void cancel(); - /** - * Called when the wizard is finished. - * - */ - void finish(); -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/StateMachine.java b/src/antidote/org/apache/tools/ant/gui/wizard/StateMachine.java deleted file mode 100644 index 3ea92c82f..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/StateMachine.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard; - -/** - * Interface for the wizard state machine, responsible for determining the - * next step in the wizard. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public interface StateMachine { - - /** - * Get the next step. - * - * @param curr The current step. - * @param data The current state of the wizard. - * @return The next step, or null if there currently isn't one. - */ - String getNext(WizardStep curr, WizardData data); - - /** - * Get the previous step. - * - * @param curr The current step. - * @param data The current state of the wizard. - * @return The previous step, or null if there currently isn't one. - */ - String getPrevious(WizardStep curr, WizardData data); -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/Wizard.java b/src/antidote/org/apache/tools/ant/gui/wizard/Wizard.java deleted file mode 100644 index a18424179..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/Wizard.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard; -import org.apache.tools.ant.gui.core.ResourceManager; - -import javax.swing.*; -import javax.swing.border.TitledBorder; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Insets; -import java.util.*; - -/** - * Top level container and controller for wizard-type GUI. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class Wizard extends JComponent { - /** The data model to pass on to each step. */ - private WizardData _data = null; - /** Container for the step editors. */ - private JPanel _stepContainer = null; - /** Layout manager for all the step panels. */ - private CardLayout _layout = null; - /** Set initialized steps. */ - private Map _steps = new HashMap(); - /** Steps saved in a list to preserve ordering. */ - private List _stepOrdering = new ArrayList(); - /** Description text. XXX should probably change to some other widget. */ - private JTextArea _description = null; - /** Progress meter. */ - private JProgressBar _progress = null; - /** Widget for navigating through steps. */ - private WizardNavigator _nav = null; - /** The current Wizard step. */ - private WizardStep _curr = null; - /** The set of wizard listeners. */ - private List _listeners = new ArrayList(1); - - /** - * Standard ctor. - * - * @param data Data for the wizard. - */ - public Wizard(WizardData data) { - setLayout(new BorderLayout()); - _data = data; - - _progress = new JProgressBar(); - _progress.setBorder(BorderFactory.createTitledBorder( - _data.getResources().getString("progress"))); - _progress.setStringPainted(true); - add(_progress, BorderLayout.NORTH); - - _description = new JTextArea(); - _description.setMargin(new Insets(5, 5, 5, 5)); - _description.setPreferredSize(new Dimension(100, 100)); - _description.setOpaque(true); - _description.setFont(new Font("Serif", Font.PLAIN, 12)); - _description.setEditable(false); - _description.setLineWrap(true); - _description.setWrapStyleWord(true); - - JScrollPane scroller = new JScrollPane( - _description, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - - scroller.setBorder(BorderFactory.createTitledBorder( - _data.getResources().getString("help"))); - add(scroller, BorderLayout.WEST); - - _stepContainer = new JPanel(_layout = new CardLayout()); - _stepContainer.setBorder(BorderFactory.createEtchedBorder()); - _stepContainer.setPreferredSize(new Dimension(400, 400)); - - - add(_stepContainer, BorderLayout.CENTER); - - _nav = new ButtonNavigator(_data.getResources()); - _nav.addNavigatorListener(new NavHandler()); - ((ButtonNavigator)_nav).setBorder(BorderFactory.createEtchedBorder()); - add((ButtonNavigator)_nav, BorderLayout.SOUTH); - - String[] steps = _data.getResources().getStringArray("steps"); - _progress.setMaximum(steps.length - 1); - try { - for(int i = 0; i < steps.length; i++) { - Class type = _data.getResources().getClass(steps[i] + ".editor"); - WizardStep step = (WizardStep) type.newInstance(); - step.setResources(_data.getResources()); - step.setID(steps[i]); - step.setTitle( - _data.getResources().getString(steps[i]+ ".title")); - step.setDescription( - _data.getResources().getString(steps[i]+ ".description")); - - _steps.put(steps[i], step); - _stepOrdering.add(step); - _stepContainer.add(step.getEditorComponent(), steps[i]); - } - // Initialize the first screen with the data model. - if(steps.length > 0) { - WizardStep first = (WizardStep)_steps.get(steps[0]); - first.setDataModel(_data); - _curr = first; - showStep(first); - } - } - catch(Exception ex) { - // If we get here then the wizard didn't initialize properly. - // XXX log me. - ex.printStackTrace(); - } - - } - - /** - * Add a wizard listener. - * - * @param l Listener to add. - */ - public void addWizardListener(WizardListener l) { - _listeners.add(l); - } - - /** - * Remove a wizard listener. - * - * @param l Listener to remove. - */ - public void removeWizardListener(WizardListener l) { - _listeners.remove(l); - } - - /** - * Go to the given step. - * - * @param step Step to go to. - */ - private void showStep(WizardStep step) { - if(step == null) return; - - step.setDataModel(_curr.getDataModel()); - - // Update the title and description. - _stepContainer.setBorder( - BorderFactory.createCompoundBorder( - BorderFactory.createTitledBorder(step.getTitle()), - BorderFactory.createEmptyBorder(5, 15, 5, 15))); - _description.setText(step.getDescription()); - - _nav.setBackEnabled(step.getPrevious() != null); - _nav.setNextEnabled(step.getNext() != null); - _nav.setFinishEnabled(step.getNext() == null); - _progress.setValue(_stepOrdering.indexOf(step)); - - // Tell the step to refresh its display based on the data model. - step.updateDisplay(); - - // Display the step. - _layout.show(_stepContainer, step.getID()); - - _curr = step; - } - - /** Handler for actions invoked by wizard. */ - private class NavHandler implements NavigatorListener { - public void nextStep() { - // Called to give data model chance to make changes to what is next. - _curr.updateDataModel(); - String nextID = _curr.getNext(); - if(nextID != null) { - showStep((WizardStep)_steps.get(nextID)); - } - } - public void backStep() { - // Called to give data model chance to make changes to what is - // before. - _curr.updateDataModel(); - String prevID = _curr.getPrevious(); - if(prevID != null) { - showStep((WizardStep)_steps.get(prevID)); - } - } - public void gotoStep(String stepID){ - _curr.updateDataModel(); - showStep((WizardStep) _steps.get(stepID)); - } - public void cancel() { - _curr.updateDataModel(); - Iterator it = _listeners.iterator(); - while(it.hasNext()) { - WizardListener l = (WizardListener) it.next(); - l.canceled(); - } - } - public void finish() { - _curr.updateDataModel(); - Iterator it = _listeners.iterator(); - while(it.hasNext()) { - WizardListener l = (WizardListener) it.next(); - l.finished(_curr.getDataModel()); - } - } - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/WizardData.java b/src/antidote/org/apache/tools/ant/gui/wizard/WizardData.java deleted file mode 100644 index 1e92fe175..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/WizardData.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard; - -import org.apache.tools.ant.gui.core.ResourceManager; - -/** - * Interface for the wizard data model. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public interface WizardData { - /** - * Get access to the resources for the wizard. - * - * @return Wizard resources. - */ - ResourceManager getResources(); - - /** - * Get the class the determines what the next step should be. - * - * @return State machine. - */ - StateMachine getStateMachine(); - - - /** - * Get any listeners to register with the wizard controller. - * - * @return WizardListener instances to register for control events, or null - * for none. - */ - // XXX not sure about this yet. - //WizardListener[] getWizardListeners(); - -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/WizardListener.java b/src/antidote/org/apache/tools/ant/gui/wizard/WizardListener.java deleted file mode 100644 index 3d4d4c11f..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/WizardListener.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard; - - -/** - * Interface for classes desiring notifiction of when the user - * completes his/her use of wizard. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public interface WizardListener { - /** - * Called when the user has clicked the finish button. - * - * @param model Last state of the object model. - */ - void finished(Object model); - - /** - * Called when the user has clicked the cancel button. - * - */ - void canceled(); -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/WizardNavigator.java b/src/antidote/org/apache/tools/ant/gui/wizard/WizardNavigator.java deleted file mode 100644 index 5fb2495e3..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/WizardNavigator.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard; - -/** - * Interface for classes that control the movement from one step of a - * wizard to another. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public interface WizardNavigator { - /** - * Add a navigator listener. - * - * @param l Listener to add. - */ - void addNavigatorListener(NavigatorListener l); - /** - * Remove a navigator listener. - * - * @param l Listener to remove. - */ - void removeNavigatorListener(NavigatorListener l); - - /** - * Set the enabled state of the back control. - * - * @param state True for enabled, false for disabled. - */ - void setBackEnabled(boolean state); - /** - * Set the enabled state of the next control. - * - * @param state True for enabled, false for disabled. - */ - void setNextEnabled(boolean state); - /** - * Set the enabled state of the finished control. - * - * @param state True for enabled, false for disabled. - */ - void setFinishEnabled(boolean state); -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/WizardStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/WizardStep.java deleted file mode 100644 index 94f722ad4..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/WizardStep.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard; -import org.apache.tools.ant.gui.core.ResourceManager; -import javax.swing.JComponent; - - -/** - * Interface for classes defining a step in a wizard. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public interface WizardStep { - /** - * Set the step's resources. - * - */ - void setResources(ResourceManager resources); - - /** - * Set the step id. The id must be unique among steps within the wizard. - * - * @param id Wizard id. - */ - void setID(String id); - - /** - * Get the step id. - * - * @return Step id. - */ - String getID(); - - /** - * Set the step title. - * - * @param title Step title. - */ - void setTitle(String title); - /** - * Get the step title. - * - * @return Step title. - */ - String getTitle(); - - /** - * Set the step description. - * - * @param desc Step description. - */ - void setDescription(String desc); - /** - * Get the step description. - * - * @return Step description. - */ - String getDescription(); - - /** - * Set the data model object that the step will edit. It is assumed - * that all steps initialized within a single wizard agree on the - * data model type. - * - * @param model Data model to edit. - */ - void setDataModel(WizardData model); - - /** - * Get the data model that should be passeed on to the next step. - * - * @return Current data model. - */ - WizardData getDataModel(); - - /** - * Get the component that should be displayed to the user for - * editing the model. This component should not include the - * title and text display, which is handled by the wizard container. - * - * @return Editing component. - */ - JComponent getEditorComponent(); - - /** - * Called when the step should refresh its display based on the - * current model setting. - * - */ - void updateDisplay(); - - /** - * Called when the step should update the data model based on the - * settings of its widgets. - * - */ - void updateDataModel(); - - /** - * Get the id of the next step. - * - * @return ID of next step. - */ - String getNext(); - - /** - * Get the id of the previous step. - * - * @return Previous step. - */ - String getPrevious(); - -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildData.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildData.java deleted file mode 100644 index 4b131a0b0..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildData.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard.build; - -import org.apache.tools.ant.gui.wizard.*; -import org.apache.tools.ant.gui.core.ResourceManager; -import org.apache.tools.ant.gui.acs.*; -import java.util.*; -import java.io.File; - -/** - * Data model for the build wizard. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class BuildData implements WizardData { - /** Wizard resources. */ - private ResourceManager _resources = new ResourceManager( - "org.apache.tools.ant.gui.resources.buildFileWizard"); - - private StateMachine _stateMachine = new BuildStateMachine(); - private String _name = "MyProject"; - private File _outputFile = new File("build.xml"); - private boolean _isNewProject = true; - private List _optionalSteps = null; - - /** - * Default ctor. - * - */ - public BuildData() { - //_project = ACSFactory.getInstance().createProject(); - _optionalSteps = Arrays.asList(ProjectSetupStep.OPTIONS); - } - - /** - * Get access to the resources for the wizard. - * - * @return Wizard resources. - */ - public ResourceManager getResources() { - return _resources; - } - - /** - * Get the class the determines what the next step should be. - * - * @return State machine. - */ - public StateMachine getStateMachine() { - return _stateMachine; - } - - /** - * Get the project name. - * - * @param name Project name. - */ - public void setProjectName(String name) { - _name = name; - } - - /** - * Set the project name. - * - * @return Project name. - */ - public String getProjectName() { - return _name; - } - - /** - * Set the output file. - * - * @param out Output file. - */ - public void setOutputFile(File out) { - _outputFile = out; - } - - /** - * Get the output file. - * - * @return Output file. - */ - public File getOutputFile() { - return _outputFile; - } - - - /** - * Set whether or not a new project is being created. - * - * @param isNew True if new project, false if importing a project. - */ - public void setNewProject(boolean isNew) { - _isNewProject = isNew; - } - - /** - * Determine if we are creating a new project. - * - * @return True if new project, false if importing a project. - */ - public boolean isNewProject() { - return _isNewProject; - } - - /** - * Set the set of optional steps (as IDs) that should be executed. - * - * @param steps Set of optional step IDs. - */ - public void setOptionalSteps(List steps) { - _optionalSteps = steps; - } - - /** - * Get the set of optional steps (as IDs) that should be executed. - * - * @return Set of optional step IDs. - */ - public List getOptionalSteps() { - return _optionalSteps; - - } - - /** - * Convert the state data into a project. - * - * @return Created project. - */ - public ACSProjectElement createProject() { - Builder builder = new Builder(this); - return builder.buildProject(); - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildStateMachine.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildStateMachine.java deleted file mode 100644 index be69de3ed..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/build/BuildStateMachine.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard.build; -import org.apache.tools.ant.gui.wizard.*; -import org.apache.tools.ant.gui.core.ResourceManager; -import java.util.*; - -/** - * State machine defining the step ordering for the build wizard. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class BuildStateMachine extends DefaultStateMachine { - private List _optionals = Arrays.asList(ProjectSetupStep.OPTIONS); - - - /** - * Get the next step. - * - * @param curr The current step. - * @param data The current state of the wizard. - * @return The ID of next step, or null if there currently isn't one. - */ - public String getNext(ProjectSetupStep curr, WizardData data) { - return getFollowingID(super.getNext(curr, data), data, +1); - } - - /** - * Get the next step. - * - * @param curr The current step. - * @param data The current state of the wizard. - * @return The ID of next step, or null if there currently isn't one. - */ - public String getNext(OptionalStep curr, WizardData data) { - return getFollowingID(super.getNext(curr, data), data, +1); - } - - /** - * Get the previous step. - * - * @param curr The current step. - * @param data The current state of the wizard. - * @return The ID of previous step, or null if there currently isn't one. - */ - public String getPrevious(OptionalStep curr, WizardData data) { - return getFollowingID(super.getPrevious(curr, data), data, -1); - } - - /** - * Get the previous step. - * - * @param curr The current step. - * @param data The current state of the wizard. - * @return The ID of previous step, or null if there currently isn't one. - */ - public String getPrevious(FinishStep curr, WizardData data) { - return getFollowingID(super.getPrevious(curr, data), data, -1); - } - - /** - * Figure out which ID should follow the given one based on the current - * state setting of the optional steps. - * - * @param curr ID of the current step. - * @param data State data. - * @param direction +1 for next, -1 for previous. - * @return The ID to follow, or null if none. - */ - private String getFollowingID(String curr, WizardData data, int direction) { - String follow = curr; - List steps = getStepList(data); - List setting = ((BuildData)data).getOptionalSteps(); - - while(follow != null && _optionals.contains(follow) && - !setting.contains(follow)) { - - int index = steps.indexOf(follow) + direction; - if(index >= 0 && index < steps.size()) { - follow = (String) steps.get(index); - } - else { - follow = null; - } - } - - return follow; - } -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/Builder.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/Builder.java deleted file mode 100644 index d2943b6bc..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/build/Builder.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard.build; - -import org.apache.tools.ant.gui.acs.*; - -/** - * Class that takes care of converting the wizard state data stored in - * BuildData and translates it into a build file. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class Builder { - - /** Build data. */ - private BuildData _data = null; - - /** - * Constructor. - * - * @param data Build data to create project from. - */ - public Builder(BuildData data) { - _data = data; - } - - /** - * Convert build data into a project. - * - * @return Project. - */ - public ACSProjectElement buildProject() { - ACSProjectElement retval = ACSFactory.getInstance().createProject(); - retval.setName(_data.getProjectName()); - - - return retval; - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/CompileStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/CompileStep.java deleted file mode 100644 index 72e6515a4..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/build/CompileStep.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard.build; - -import org.apache.tools.ant.gui.wizard.AbstractWizardStep; -import javax.swing.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** - * - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class CompileStep extends AbstractWizardStep implements OptionalStep { - - /** - * Initialize the display. - * - */ - protected void init() { - - - - } - - /** - * Called when the step should refresh its display based on the - * current model setting. - * - */ - public void updateDisplay() { - BuildData data = (BuildData) getDataModel(); - - } - - /** - * Called when the step should update the data model based on the - * settings of its widgets. - * - */ - public void updateDataModel() { - BuildData data = (BuildData) getDataModel(); - - } - - /** - * Get the id of the next step. - * - * @return ID of next step. - */ - public String getNext() { - return ((BuildStateMachine)getDataModel().getStateMachine()). - getNext(this, getDataModel()); - } - - /** - * Get the id of the previous step. - * - * @return Previous step. - */ - public String getPrevious() { - return ((BuildStateMachine)getDataModel().getStateMachine()). - getPrevious(this, getDataModel()); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/FinishStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/FinishStep.java deleted file mode 100644 index 421653d2d..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/build/FinishStep.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard.build; - -import org.apache.tools.ant.gui.wizard.InstructionStep; -import javax.swing.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** - * - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class FinishStep extends InstructionStep { - - - /** - * Called when the step should refresh its display based on the - * current model setting. - * - */ - public void updateDisplay() { - BuildData data = (BuildData) getDataModel(); - - } - - /** - * Called when the step should update the data model based on the - * settings of its widgets. - * - */ - public void updateDataModel() { - BuildData data = (BuildData) getDataModel(); - - } - - /** - * Get the id of the next step. - * - * @return ID of next step. - */ - public String getNext() { - return ((BuildStateMachine)getDataModel().getStateMachine()). - getNext(this, getDataModel()); - } - - /** - * Get the id of the previous step. - * - * @return Previous step. - */ - public String getPrevious() { - return ((BuildStateMachine)getDataModel().getStateMachine()). - getPrevious(this, getDataModel()); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/JARStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/JARStep.java deleted file mode 100644 index da90c62f6..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/build/JARStep.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard.build; - -import org.apache.tools.ant.gui.wizard.AbstractWizardStep; -import javax.swing.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** - * - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class JARStep extends AbstractWizardStep implements OptionalStep { - - /** - * Initialize the display. - * - */ - protected void init() { - } - - /** - * Called when the step should refresh its display based on the - * current model setting. - * - */ - public void updateDisplay() { - BuildData data = (BuildData) getDataModel(); - - } - - /** - * Called when the step should update the data model based on the - * settings of its widgets. - * - */ - public void updateDataModel() { - BuildData data = (BuildData) getDataModel(); - - } - - /** - * Get the id of the next step. - * - * @return ID of next step. - */ - public String getNext() { - return ((BuildStateMachine)getDataModel().getStateMachine()). - getNext(this, getDataModel()); - } - - /** - * Get the id of the previous step. - * - * @return Previous step. - */ - public String getPrevious() { - return ((BuildStateMachine)getDataModel().getStateMachine()). - getPrevious(this, getDataModel()); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/JavaDocStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/JavaDocStep.java deleted file mode 100644 index e8af955ed..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/build/JavaDocStep.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard.build; - -import org.apache.tools.ant.gui.wizard.AbstractWizardStep; -import javax.swing.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; - -/** - * - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class JavaDocStep extends AbstractWizardStep implements OptionalStep { - - /** - * Initialize the display. - * - */ - protected void init() { - } - - /** - * Called when the step should refresh its display based on the - * current model setting. - * - */ - public void updateDisplay() { - BuildData data = (BuildData) getDataModel(); - - } - - /** - * Called when the step should update the data model based on the - * settings of its widgets. - * - */ - public void updateDataModel() { - BuildData data = (BuildData) getDataModel(); - - } - - /** - * Get the id of the next step. - * - * @return ID of next step. - */ - public String getNext() { - return ((BuildStateMachine)getDataModel().getStateMachine()). - getNext(this, getDataModel()); - } - - /** - * Get the id of the previous step. - * - * @return Previous step. - */ - public String getPrevious() { - return ((BuildStateMachine)getDataModel().getStateMachine()). - getPrevious(this, getDataModel()); - } - -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/OptionalStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/OptionalStep.java deleted file mode 100644 index 1264c619b..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/build/OptionalStep.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard.build; -import org.apache.tools.ant.gui.wizard.WizardStep; - -/** - * A tagging interface for optional steps to make virtual dispatching easier. - * - * @version $Revision$ - * @author Simeon Fitch - */ -interface OptionalStep extends WizardStep { - -} diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectSetupStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectSetupStep.java deleted file mode 100644 index f1eba8f9f..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectSetupStep.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard.build; - -import org.apache.tools.ant.gui.wizard.AbstractWizardStep; -import org.apache.tools.ant.gui.util.LabelFieldGBC; -import org.apache.tools.ant.gui.customizer.FilePropertyEditor; -import javax.swing.*; -import java.awt.BorderLayout; -import java.awt.FlowLayout; -import java.awt.GridBagLayout; -import java.util.*; -import java.io.File; - -/** - * Build file wizard step for naming the project and - * selecting what features are desired. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ProjectSetupStep extends AbstractWizardStep { - - /** ID for compile option. */ - public static final String COMPILE_OPTION = "compile"; - /** ID for JAR option. */ - public static final String JAR_OPTION = "jar"; - /** ID for JavaDoc option. */ - public static final String JAVADOC_OPTION = "javadoc"; - - /** Available options as an array. */ - public static final String[] OPTIONS = { - COMPILE_OPTION, - JAR_OPTION, - JAVADOC_OPTION - }; - - /** Array of the option selections. */ - private JCheckBox[] _selections = null; - - - /** Name of the project. */ - private JTextField _name = null; - /** Control for selecting a file. */ - private FilePropertyEditor _fileEditor = null; - - - /** - * Initialize the screen widgets. - * - */ - protected void init() { - setLayout(new BorderLayout()); - - LabelFieldGBC gbc = new LabelFieldGBC(); - JPanel p = new JPanel(new GridBagLayout()); - add(p, BorderLayout.NORTH); - - _fileEditor = new FilePropertyEditor(); - p.add(new JLabel( - getResources().getString(getID() + ".fileLabel")), gbc.forLabel()); - p.add(_fileEditor.getCustomEditor(), gbc.forField()); - - _name = new JTextField(10); - p.add(new JLabel( - getResources().getString(getID() + ".nameLabel")), gbc.forLabel()); - p.add(_name, gbc.forField()); - - p = new JPanel(null); - p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); - p.setBorder(BorderFactory.createCompoundBorder( - BorderFactory.createTitledBorder( - getResources().getString(getID() + ".optionsLabel")), - BorderFactory.createEmptyBorder(5, 10, 5, 10))); - add(p, BorderLayout.CENTER); - - _selections = new JCheckBox[OPTIONS.length]; - for(int i = 0; i < OPTIONS.length; i++) { - _selections[i] = new JCheckBox( - getResources().getString(getID() + "." + OPTIONS[i] + ".label")); - _selections[i].setSelected(true); - p.add(_selections[i]); - } - } - - /** - * Called when the step should refresh its display based on the - * current model setting. - * - */ - public void updateDisplay() { - // Name. - BuildData data = (BuildData) getDataModel(); - _name.setText(data.getProjectName()); - - _fileEditor.setValue(data.getOutputFile()); - - // Steps. - List steps = data.getOptionalSteps(); - if(steps != null) { - for(int i = 0; i < _selections.length; i++) { - _selections[i].setSelected(steps.contains(OPTIONS[i])); - } - } - } - - /** - * Called when the step should update the data model based on the - * settings of its widgets. - * - */ - public void updateDataModel() { - // Name. - BuildData data = (BuildData) getDataModel(); - data.setProjectName(_name.getText()); - - data.setOutputFile((File)_fileEditor.getValue()); - - // Steps. - List steps = new ArrayList(); - for(int i = 0; i < _selections.length; i++) { - if(_selections[i].isSelected()) { - steps.add(OPTIONS[i]); - } - } - - data.setOptionalSteps(steps); - } - - /** - * Get the id of the next step. - * - * @return ID of next step. - */ - public String getNext() { - return ((BuildStateMachine)getDataModel().getStateMachine()). - getNext(this, getDataModel()); - } - - /** - * Get the id of the previous step. - * - * @return Previous step. - */ - public String getPrevious() { - return ((BuildStateMachine)getDataModel().getStateMachine()). - getPrevious(this, getDataModel()); - } -} - diff --git a/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectTypeStep.java b/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectTypeStep.java deleted file mode 100644 index 880a16131..000000000 --- a/src/antidote/org/apache/tools/ant/gui/wizard/build/ProjectTypeStep.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ -package org.apache.tools.ant.gui.wizard.build; - -import org.apache.tools.ant.gui.wizard.AbstractWizardStep; -import javax.swing.*; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import org.apache.tools.ant.gui.acs.*; -import java.util.*; - -/** - * Step for selecting whether a new project is being created, or - * if an existing one is being imported. - * - * @version $Revision$ - * @author Simeon Fitch - */ -public class ProjectTypeStep extends AbstractWizardStep { - - private JRadioButton _isNew = null; - private JRadioButton _isImport = null; - - /** - * Initialize the display. - * - */ - protected void init() { - setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - - ButtonGroup group = new ButtonGroup(); - _isNew = new JRadioButton( - getResources().getString(getID() + ".isNewLabel")); - group.add(_isNew); - add(_isNew); - _isImport = new JRadioButton( - getResources().getString(getID() + ".isImportLabel")); - group.add(_isImport); - add(_isImport); - // XXX Not implemented yet. - _isImport.setEnabled(false); - _isImport.setToolTipText("Not implemented yet."); - } - - /** - * Called when the step should refresh its display based on the - * current model setting. - * - */ - public void updateDisplay() { - BuildData data = (BuildData) getDataModel(); - _isNew.setSelected(data.isNewProject()); - } - - /** - * Called when the step should update the data model based on the - * settings of its widgets. - * - */ - public void updateDataModel() { - BuildData data = (BuildData) getDataModel(); - data.setNewProject(_isNew.isSelected()); - } -}