001package jmri.jmrit.throttle; 002 003import java.awt.event.ActionEvent; 004 005import jmri.InstanceManager; 006import jmri.util.swing.JmriAbstractAction; 007import jmri.util.swing.JmriPanel; 008 009public class ThrottlesListAction extends JmriAbstractAction { 010 011 /** 012 * Constructor 013 * 014 * @param s Name for the action. 015 */ 016 public ThrottlesListAction(String s) { 017 super(s); 018 // disable the ourselves if there is no throttle Manager 019 if (jmri.InstanceManager.getNullableDefault(jmri.ThrottleManager.class) == null) { 020 setEnabled(false); 021 } 022 } 023 024 public ThrottlesListAction() { 025 this("Throttles list"); 026 } 027 028 @Override 029 public void actionPerformed(ActionEvent e) { 030 InstanceManager.getDefault(ThrottleFrameManager.class).showThrottlesList(); 031 } 032 033 // never invoked, because we overrode actionPerformed above 034 @Override 035 public JmriPanel makePanel() { 036 throw new IllegalArgumentException("Should not be invoked"); 037 } 038}