001package jmri.jmrit.operations.locations.tools;
002
003import java.awt.event.ActionEvent;
004import javax.swing.AbstractAction;
005import jmri.jmrit.operations.locations.TrackEditFrame;
006
007/**
008 * Action to create a track pool and place a track in that pool.
009 *
010 * @author Daniel Boudreau Copyright (C) 2011
011 * @author Gregory Madsen Copyright (C) 2012
012 */
013public class PoolTrackAction extends AbstractAction {
014
015    private TrackEditFrame _tef;
016    private PoolTrackFrame _ptf;
017
018    public PoolTrackAction(TrackEditFrame tef) {
019        super(Bundle.getMessage("MenuItemPoolTrack"));
020        _tef = tef;
021    }
022
023    @Override
024    public void actionPerformed(ActionEvent e) {
025        if (_ptf != null) {
026            _ptf.dispose();
027        }
028        _ptf = new PoolTrackFrame(_tef._track);
029        _ptf.initComponents();
030    }
031}