001package jmri.jmrit.throttle;
002
003import java.awt.event.ActionEvent;
004import javax.swing.AbstractAction;
005import jmri.InstanceManager;
006
007public class ThrottlesPreferencesAction extends AbstractAction {
008
009    /**
010     * Constructor
011     *
012     * @param s Name for the action.
013     */
014    public ThrottlesPreferencesAction(String s) {
015        super(s);
016        // disable the ourselves if there is no throttle Manager
017        if (jmri.InstanceManager.getNullableDefault(jmri.ThrottleManager.class) == null) {
018            setEnabled(false);
019        }
020    }
021
022    public ThrottlesPreferencesAction() {
023        this("Throttles preferences");
024    }
025
026    @Override
027    public void actionPerformed(ActionEvent e) {
028        InstanceManager.getDefault(ThrottleFrameManager.class).showThrottlesPreferences();
029    }
030}