From aefb450f2201238c7bc85d3560f0c3e7c32dad56 Mon Sep 17 00:00:00 2001 From: metasim Date: Tue, 28 Nov 2000 05:05:13 +0000 Subject: [PATCH] Added infrastructure for generating popup menus from configured actions. The popup menu will then have options who's status is in sync with the menu and toolbar actions. Also added finer grained element selection code so that specific events are generated for specific element types. As a test, added stubbed out actions for adding new elements to the build file. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268251 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/gui/ActionManager.java | 27 ++++++- .../apache/tools/ant/gui/EventResponder.java | 5 ++ .../tools/ant/gui/ProjectNavigator.java | 31 +++++++- .../ant/gui/event/ElementSelectionEvent.java | 49 +++++++++++- .../ant/gui/event/NullSelectionEvent.java | 74 ++++++++++++++++++ .../ant/gui/event/ProjectSelectionEvent.java | 75 +++++++++++++++++++ .../ant/gui/event/PropertySelectionEvent.java | 75 +++++++++++++++++++ .../ant/gui/event/TargetSelectionEvent.java | 75 +++++++++++++++++++ .../ant/gui/event/TaskSelectionEvent.java | 75 +++++++++++++++++++ .../tools/ant/gui/resources/action.properties | 45 ++++++++++- .../ant/gui/resources/antidote.properties | 2 + 11 files changed, 523 insertions(+), 10 deletions(-) create mode 100644 src/antidote/org/apache/tools/ant/gui/event/NullSelectionEvent.java create mode 100644 src/antidote/org/apache/tools/ant/gui/event/ProjectSelectionEvent.java create mode 100644 src/antidote/org/apache/tools/ant/gui/event/PropertySelectionEvent.java create mode 100644 src/antidote/org/apache/tools/ant/gui/event/TargetSelectionEvent.java create mode 100644 src/antidote/org/apache/tools/ant/gui/event/TaskSelectionEvent.java diff --git a/src/antidote/org/apache/tools/ant/gui/ActionManager.java b/src/antidote/org/apache/tools/ant/gui/ActionManager.java index ede0af000..3479880f5 100644 --- a/src/antidote/org/apache/tools/ant/gui/ActionManager.java +++ b/src/antidote/org/apache/tools/ant/gui/ActionManager.java @@ -225,7 +225,9 @@ public class ActionManager { new JCheckBoxMenuItem(action.getName()); b.setActionCommand(action.getID()); b.addActionListener(action); - b.setAction(action); + // 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); } @@ -259,6 +261,29 @@ public class ActionManager { } } + 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. + * @return Popup menu to display. + */ + public JPopupMenu createPopup(String[] actionIDs) { + JPopupMenu retval = new JPopupMenu(); + + for(int i = 0; i < actionIDs.length; i++) { + AntAction action = (AntAction) _actions.get(actionIDs[i]); + if(action != null) { + retval.add(action); + } + } + return retval; } diff --git a/src/antidote/org/apache/tools/ant/gui/EventResponder.java b/src/antidote/org/apache/tools/ant/gui/EventResponder.java index 801924e09..804198e00 100644 --- a/src/antidote/org/apache/tools/ant/gui/EventResponder.java +++ b/src/antidote/org/apache/tools/ant/gui/EventResponder.java @@ -123,6 +123,11 @@ class EventResponder { 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; } } diff --git a/src/antidote/org/apache/tools/ant/gui/ProjectNavigator.java b/src/antidote/org/apache/tools/ant/gui/ProjectNavigator.java index 23e84a637..53e61cf0b 100644 --- a/src/antidote/org/apache/tools/ant/gui/ProjectNavigator.java +++ b/src/antidote/org/apache/tools/ant/gui/ProjectNavigator.java @@ -56,6 +56,8 @@ import org.apache.tools.ant.gui.event.*; import javax.swing.*; import java.awt.GridLayout; import java.awt.Dimension; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.util.EventObject; /** @@ -83,11 +85,12 @@ class ProjectNavigator extends AntEditor { _tree = new JTree(); _tree.setModel(null); _tree.setCellRenderer(new AntTreeCellRenderer()); + _tree.addMouseListener(new PopupHandler()); JScrollPane scroller = new JScrollPane(_tree); add(scroller); - setPreferredSize(new Dimension(150, 100)); - setMinimumSize(new Dimension(150, 100)); + setPreferredSize(new Dimension(200, 100)); + setMinimumSize(new Dimension(200, 100)); } /** Class for handling project events. */ @@ -112,7 +115,7 @@ class ProjectNavigator extends AntEditor { * it should be cancelled. */ public boolean eventPosted(EventObject event) { - ProjectProxy project = getAppContext().getProject(); + ProjectProxy project = getContext().getProject(); if(project == null) { // The project has been closed. @@ -142,4 +145,26 @@ class ProjectNavigator extends AntEditor { } } + /** Mouse listener for showing popup menu. */ + private class PopupHandler extends MouseAdapter { + private void handle(MouseEvent e) { + if(e.isPopupTrigger()) { + ActionManager mgr = getContext().getActions(); + JPopupMenu menu = mgr.createPopup( + getContext().getResources().getStringArray( + ProjectNavigator.class, "popupActions")); + 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); + } + } } diff --git a/src/antidote/org/apache/tools/ant/gui/event/ElementSelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/ElementSelectionEvent.java index b0e60fb71..5e3b5eb15 100644 --- a/src/antidote/org/apache/tools/ant/gui/event/ElementSelectionEvent.java +++ b/src/antidote/org/apache/tools/ant/gui/event/ElementSelectionEvent.java @@ -52,7 +52,9 @@ * . */ package org.apache.tools.ant.gui.event; -import org.apache.tools.ant.gui.acs.ACSElement; +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.AppContext; /** @@ -72,8 +74,8 @@ public class ElementSelectionEvent extends AntEvent { * @param context application context. * @param selected the selected Elements. */ - public ElementSelectionEvent(AppContext context, - ACSElement[] selected) { + protected ElementSelectionEvent(AppContext context, + ACSElement[] selected) { super(context); _selected = selected; } @@ -87,4 +89,45 @@ public class ElementSelectionEvent extends AntEvent { return _selected; } + + /** + * 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(type.isAssignableFrom(ACSTargetElement.class)) { + retval = new TargetSelectionEvent(context, selected); + } + else if(type.isAssignableFrom(ACSTaskElement.class)) { + retval = new TaskSelectionEvent(context, selected); + } + else if(type.isAssignableFrom(ACSPropertyElement.class)) { + retval = new PropertySelectionEvent(context, selected); + } + else if(type.isAssignableFrom(ACSProjectElement.class)) { + retval = new ProjectSelectionEvent(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/NullSelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/NullSelectionEvent.java new file mode 100644 index 000000000..5e1c4d1d6 --- /dev/null +++ b/src/antidote/org/apache/tools/ant/gui/event/NullSelectionEvent.java @@ -0,0 +1,74 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ +package org.apache.tools.ant.gui.event; +import org.apache.tools.ant.gui.acs.ACSElement; +import org.apache.tools.ant.gui.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/ProjectSelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/ProjectSelectionEvent.java new file mode 100644 index 000000000..aaf1cf917 --- /dev/null +++ b/src/antidote/org/apache/tools/ant/gui/event/ProjectSelectionEvent.java @@ -0,0 +1,75 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ +package org.apache.tools.ant.gui.event; +import org.apache.tools.ant.gui.acs.ACSElement; +import org.apache.tools.ant.gui.AppContext; + +/** + * Event fired when the project node is selected. + * + * @version $Revision$ + * @author Simeon Fitch + */ +public class ProjectSelectionEvent extends ElementSelectionEvent { + /** + * Standard ctor. + * + * @param context application context. + * @param selected the selected Elements. + */ + public ProjectSelectionEvent(AppContext context, + ACSElement[] selected) { + super(context, selected); + } +} diff --git a/src/antidote/org/apache/tools/ant/gui/event/PropertySelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/PropertySelectionEvent.java new file mode 100644 index 000000000..5ee5a4b6c --- /dev/null +++ b/src/antidote/org/apache/tools/ant/gui/event/PropertySelectionEvent.java @@ -0,0 +1,75 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ +package org.apache.tools.ant.gui.event; +import org.apache.tools.ant.gui.acs.ACSElement; +import org.apache.tools.ant.gui.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); + } +} diff --git a/src/antidote/org/apache/tools/ant/gui/event/TargetSelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/TargetSelectionEvent.java new file mode 100644 index 000000000..400a269d4 --- /dev/null +++ b/src/antidote/org/apache/tools/ant/gui/event/TargetSelectionEvent.java @@ -0,0 +1,75 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ +package org.apache.tools.ant.gui.event; +import org.apache.tools.ant.gui.acs.ACSElement; +import org.apache.tools.ant.gui.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); + } +} diff --git a/src/antidote/org/apache/tools/ant/gui/event/TaskSelectionEvent.java b/src/antidote/org/apache/tools/ant/gui/event/TaskSelectionEvent.java new file mode 100644 index 000000000..7a418e3a5 --- /dev/null +++ b/src/antidote/org/apache/tools/ant/gui/event/TaskSelectionEvent.java @@ -0,0 +1,75 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ +package org.apache.tools.ant.gui.event; +import org.apache.tools.ant.gui.acs.ACSElement; +import org.apache.tools.ant.gui.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); + } +} diff --git a/src/antidote/org/apache/tools/ant/gui/resources/action.properties b/src/antidote/org/apache/tools/ant/gui/resources/action.properties index ef4b5cc46..4743c5684 100644 --- a/src/antidote/org/apache/tools/ant/gui/resources/action.properties +++ b/src/antidote/org/apache/tools/ant/gui/resources/action.properties @@ -3,8 +3,10 @@ menus=File, Build, Options, Help # Declare the list of known actions. actions=\ - open, save, saveas, close, exit, about, startBuild, stopBuild, \ - notifyEmacs, changeLookAndFeel + open, save, saveas, close, exit, about, \ + newTarget, newTask, newProperty \ + startBuild, stopBuild, \ + notifyEmacs, changeLookAndFeel # Configure the decalred actions. @@ -94,6 +96,43 @@ stopBuild.enableOn=\ 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.enableOn=\ + org.apache.tools.ant.gui.event.ProjectSelectionEvent +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.NullSelectionEvent + +newTask.name=New Task +newTask.shortDescription=Create a new task under the selected target +newTask.icon=new-task.gif +newTask.enabled=false +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 + +newProperty.name=New Property +newProperty.shortDescription=Create a new property under the selected element +newProperty.icon=new-property.gif +newProperty.enabled=false +newProperty.enableOn=\ + org.apache.tools.ant.gui.event.ProjectSelectionEvent, \ + 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.NullSelectionEvent + changeLookAndFeel.name=Look and Feel... changeLookAndFeel.shortDescription=Change the Look and Feel changeLookAndFeel.parentMenuName=Options @@ -103,7 +142,7 @@ changeLookAndFeel.separator=true notifyEmacs.name=Notify Emacs notifyEmacs.shortDescription=\ - Send a notification event to Emacs on build errors. + Send a notification event to Emacs on build errors notifyEmacs.parentMenuName=Options notifyEmacs.toggle=true notifyEmacs.command=org.apache.tools.ant.gui.command.EmacsNotifyCmd diff --git a/src/antidote/org/apache/tools/ant/gui/resources/antidote.properties b/src/antidote/org/apache/tools/ant/gui/resources/antidote.properties index 3add07f97..c6a996052 100644 --- a/src/antidote/org/apache/tools/ant/gui/resources/antidote.properties +++ b/src/antidote/org/apache/tools/ant/gui/resources/antidote.properties @@ -23,6 +23,8 @@ org.apache.tools.ant.gui.SourceEditor.name=Source org.apache.tools.ant.gui.PropertyEditor.name=Properties org.apache.tools.ant.gui.ProjectNavigator.name=Project +org.apache.tools.ant.gui.ProjectNavigator.popupActions=\ + newTarget, newTask, newProperty org.apache.tools.ant.gui.TargetMonitor.name=Selected Target(s) org.apache.tools.ant.gui.TargetMonitor.defText=[none]