001package jmri.jmrit.powerpanel;
002
003/**
004 * Swing action to create and register a PowerPanelFrame object.
005 *
006 * @author Bob Jacobsen Copyright (C) 2001, 2010
007 */
008public class PowerPanelAction extends jmri.util.swing.JmriNamedPaneAction {
009
010    public PowerPanelAction(String s, jmri.util.swing.WindowInterface wi) {
011        super(s, wi, "jmri.jmrit.powerpanel.PowerPane");
012        checkManager();
013    }
014
015    public PowerPanelAction(String s, javax.swing.Icon i, jmri.util.swing.WindowInterface wi) {
016        super(s, i, wi, "jmri.jmrit.powerpanel.PowerPane");
017        checkManager();
018    }
019
020    public PowerPanelAction(String s) {
021        super(s, "jmri.jmrit.powerpanel.PowerPane");
022        checkManager();
023    }
024
025    public PowerPanelAction() {
026        this(Bundle.getMessage("TitlePowerPanel"));
027    }
028
029    final void checkManager() {
030        // disable ourself if there is no power Manager
031        if (jmri.InstanceManager.getNullableDefault(jmri.PowerManager.class) == null) {
032            setEnabled(false);
033        }
034    }
035
036}