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 009/** 010 * Action to open the throttles list window 011 * 012 * <hr> 013 * This file is part of JMRI. 014 * <p> 015 * JMRI is free software; you can redistribute it and/or modify it under the 016 * terms of version 2 of the GNU General Public License as published by the Free 017 * Software Foundation. See the "COPYING" file for a copy of this license. 018 * <p> 019 * JMRI is distributed in the hope that it will be useful, but WITHOUT ANY 020 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 021 * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 022 * 023 * @author Lionel Jeanson 024 * 025 */ 026 027public class ThrottlesListAction extends JmriAbstractAction { 028 029 /** 030 * Constructor 031 * 032 * @param s Name for the action. 033 */ 034 public ThrottlesListAction(String s) { 035 super(s); 036 // disable the ourselves if there is no throttle Manager 037 if (jmri.InstanceManager.getNullableDefault(jmri.ThrottleManager.class) == null) { 038 setEnabled(false); 039 } 040 } 041 042 public ThrottlesListAction() { 043 this("Throttles list"); 044 } 045 046 @Override 047 public void actionPerformed(ActionEvent e) { 048 InstanceManager.getDefault(ThrottleFrameManager.class).showThrottlesList(); 049 } 050 051 // never invoked, because we overrode actionPerformed above 052 @Override 053 public JmriPanel makePanel() { 054 throw new IllegalArgumentException("Should not be invoked"); 055 } 056}