001package apps;
002
003import java.awt.GraphicsEnvironment;
004import java.awt.event.ActionEvent;
005import javax.swing.Icon;
006import jmri.util.swing.JmriPanel;
007import jmri.util.swing.WindowInterface;
008
009/**
010 * Swing action to display the JMRI System Console
011 * <hr>
012 * This file is part of JMRI.
013 * <p>
014 * JMRI is free software; you can redistribute it and/or modify it under the
015 * terms of version 2 of the GNU General Public License as published by the Free
016 * Software Foundation. See the "COPYING" file for a copy of this license.
017 * <p>
018 * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY
019 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
020 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
021 *
022 * @author Matthew Harris copyright (c) 2010
023 */
024public class SystemConsoleAction extends jmri.util.swing.JmriAbstractAction {
025
026    public SystemConsoleAction(String s, WindowInterface wi) {
027        super(s, wi);
028    }
029
030    public SystemConsoleAction(String s, Icon i, WindowInterface wi) {
031        super(s, i, wi);
032    }
033
034    public SystemConsoleAction() {
035        super(Bundle.getMessage("TitleConsole"));
036    }
037
038    @Override
039    public void actionPerformed(ActionEvent e) {
040        if(!GraphicsEnvironment.isHeadless()) {
041           // Show system console
042           SystemConsole.getConsole().setVisible(true);
043        }
044    }
045
046    // never invoked, because we overrode actionPerformed above
047    @Override
048    public JmriPanel makePanel() {
049        throw new IllegalArgumentException("Should not be invoked"); // NOI18N
050    }
051
052}