001/* An action for editing parameters for a specific NamedObj.
002
003 * '$Author: crawl $'
004 * '$Date: 2014-08-06 23:08:49 +0000 (Wed, 06 Aug 2014) $' 
005 * '$Revision: 32859 $'
006 * 
007 * Permission is hereby granted, without written agreement and without
008 * license or royalty fees, to use, copy, modify, and distribute this
009 * software and its documentation for any purpose, provided that the above
010 * copyright notice and the following two paragraphs appear in all copies
011 * of this software.
012 *
013 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
014 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
015 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
016 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
017 * SUCH DAMAGE.
018 *
019 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
020 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
021 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
022 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
023 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
024 * ENHANCEMENTS, OR MODIFICATIONS.
025 */
026package org.kepler.gui;
027
028import java.awt.Frame;
029import java.awt.event.ActionEvent;
030
031import ptolemy.kernel.util.NamedObj;
032import ptolemy.util.MessageHandler;
033import ptolemy.vergil.toolbox.ConfigureAction;
034
035/** An action that will configure parameters for a specific NamedObj.
036 * 
037 * @author Daniel Crawl
038 * @version $Id: ConfigureNamedObjAction.java 32859 2014-08-06 23:08:49Z crawl $ 
039 */
040public class ConfigureNamedObjAction extends ConfigureAction {
041    
042    /** Create a new ConfigureInOutlineAction. */
043    public ConfigureNamedObjAction(String description, NamedObj target, Frame frame) {
044        super(description);
045        _target = target;
046        _frame = frame;
047    }
048
049    ///////////////////////////////////////////////////////////////////
050    ////                         public methods                    ////
051
052    /** Open a dialog to edit the target.
053     *  @param e The event.
054     */
055    @Override
056    public void actionPerformed(ActionEvent e) {
057        try {
058            _openDialog(_frame, _target, e);
059        } catch (Throwable throwable) {
060            MessageHandler.error("Failed to open a dialog to edit the target.",
061                    throwable);
062        }
063    }
064    
065    /** The NamedObj to configure. */
066    private NamedObj _target;
067    
068    /** The parent frame. */
069    private Frame _frame;
070}