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