001package jmri.jmrix.qsi.packetgen;
002
003import java.awt.event.ActionEvent;
004import jmri.InstanceManager;
005import jmri.jmrix.qsi.QsiSystemConnectionMemo;
006import jmri.jmrix.qsi.swing.QsiSystemConnectionAction;
007import org.slf4j.Logger;
008import org.slf4j.LoggerFactory;
009
010/**
011 * Swing action to create and register a PacketGenFrame object.
012 *
013 * @author Bob Jacobsen Copyright (C) 2007, 2008
014 */
015public class PacketGenAction extends QsiSystemConnectionAction {
016
017    public PacketGenAction(String s, QsiSystemConnectionMemo memo) {
018        super(s, memo);
019    }
020
021    public PacketGenAction(QsiSystemConnectionMemo memo) {
022        this(Bundle.getMessage("MenuItemSendCommand"), memo);
023    }
024
025    public PacketGenAction() {
026        this(InstanceManager.getDefault(QsiSystemConnectionMemo.class));
027    }
028
029    @Override
030    public void actionPerformed(ActionEvent e) {
031        PacketGenFrame f = new PacketGenFrame(getSystemConnectionMemo());
032        try {
033            f.initComponents();
034        } catch (Exception ex) {
035            log.error("Exception: ", ex);
036        }
037        f.setVisible(true);
038    }
039
040    private final static Logger log = LoggerFactory.getLogger(PacketGenAction.class);
041
042}