001package jmri.jmrit.operations.routes;
002
003import java.awt.Frame;
004import java.awt.event.ActionEvent;
005
006import javax.swing.AbstractAction;
007
008import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
009
010/**
011 * Swing action to create and register a RoutesTableFrame object.
012 *
013 * @author Bob Jacobsen Copyright (C) 2001
014 * @author Daniel Boudreau Copyright (C) 2008
015 */
016public class RoutesTableAction extends AbstractAction {
017
018    public RoutesTableAction() {
019        super(Bundle.getMessage("MenuRoutes")); // NOI18N
020    }
021
022    private static RoutesTableFrame routesTableFrame = null;
023
024    @Override
025    @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "Show only one RouteTableFrame")
026    public void actionPerformed(ActionEvent e) {
027        // create a route table frame
028        if (routesTableFrame == null || !routesTableFrame.isVisible()) {
029            routesTableFrame = new RoutesTableFrame();
030        }
031        routesTableFrame.setExtendedState(Frame.NORMAL);
032        routesTableFrame.setVisible(true); // this also brings the frame into focus
033    }
034}
035
036