001package jmri.jmrit.dualdecoder;
002
003import java.awt.event.ActionEvent;
004import javax.swing.Icon;
005import jmri.AddressedProgrammerManager;
006import jmri.GlobalProgrammerManager;
007import jmri.InstanceManager;
008import jmri.util.swing.JmriAbstractAction;
009import jmri.util.swing.WindowInterface;
010
011/**
012 * Swing action to create and register a DualDecoderTool
013 *
014 * @author Bob Jacobsen Copyright (C) 2001
015 */
016public class DualDecoderToolAction extends JmriAbstractAction {
017
018    public DualDecoderToolAction(String s, WindowInterface wi) {
019        super(s, wi);
020    }
021
022    public DualDecoderToolAction(String s, Icon i, WindowInterface wi) {
023        super(s, i, wi);
024    }
025
026    public DualDecoderToolAction(String s) {
027        super(s);
028
029        // disable ourself if programming is not possible
030        boolean enabled = false;
031        if (InstanceManager.getList(GlobalProgrammerManager.class).size() > 0) {
032            enabled = true;
033        }
034        if (InstanceManager.getList(AddressedProgrammerManager.class).size() > 0) {
035            enabled = true;
036        }
037
038        setEnabled(enabled);
039    }
040
041    public DualDecoderToolAction() {
042        this(Bundle.getMessage("MenuItemMultiDecoderControl"));
043    }
044
045    @Override
046    public void actionPerformed(ActionEvent e) {
047        new DualDecoderSelectFrame().setVisible(true);
048    }
049
050    @Override
051    public jmri.util.swing.JmriPanel makePanel() { return null; } // not used by this classes actionPerformed, not migrated to new form yet
052
053}