001package apps.gui3.paned;
002
003import java.awt.event.ActionEvent;
004import javax.swing.Icon;
005import jmri.util.swing.JmriPanel;
006import jmri.util.swing.WindowInterface;
007
008/**
009 * Action to quit the program
010 *
011 * Ignores WindowInterface.
012 *
013 * @author Bob Jacobsen Copyright (C) 2010
014 */
015public class QuitAction extends jmri.util.swing.JmriAbstractAction {
016
017    public QuitAction(String s, WindowInterface wi) {
018        super(s, wi);
019    }
020
021    public QuitAction(String s, Icon i, WindowInterface wi) {
022        super(s, i, wi);
023    }
024
025    @Override
026    public void actionPerformed(ActionEvent e) {
027        try {
028            jmri.InstanceManager.getDefault(jmri.ShutDownManager.class).shutdown();
029        } catch (Exception ex) {
030            System.err.println("Continuing after error in handleQuit: " + ex); // can't count on logging here
031        }
032    }
033
034    // never invoked, because we overrode actionPerformed above
035    @Override
036    public void dispose() {
037        throw new IllegalArgumentException("Should not be invoked");
038    }
039
040    // never invoked, because we overrode actionPerformed above
041    @Override
042    public JmriPanel makePanel() {
043        throw new IllegalArgumentException("Should not be invoked");
044    }
045
046}