001package jmri.jmrit.operations.locations; 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 LocationTableFrame object. 012 * 013 * @author Bob Jacobsen Copyright (C) 2001 014 * @author Daniel Boudreau Copyright (C) 2008 015 */ 016public class LocationsTableAction extends AbstractAction { 017 018 public LocationsTableAction() { 019 super(Bundle.getMessage("MenuLocations")); // NOI18N 020 } 021 022 private static LocationsTableFrame locationTableFrame = null; 023 024 @Override 025 @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "Show only one LocationsTableFrame") 026 public void actionPerformed(ActionEvent e) { 027 // create a location table frame 028 if (locationTableFrame == null || !locationTableFrame.isVisible()) { 029 locationTableFrame = new LocationsTableFrame(); 030 } 031 locationTableFrame.setExtendedState(Frame.NORMAL); 032 locationTableFrame.setVisible(true); // this also brings the frame into focus 033 } 034} 035 036