001package jmri.jmrix.openlcb.swing.lccpro;
002
003import java.awt.event.ActionEvent;
004import javax.swing.Icon;
005import jmri.InstanceManager;
006import jmri.util.swing.JmriAbstractAction;
007import jmri.util.swing.WindowInterface;
008
009import org.openlcb.MimicNodeStore;
010
011/**
012 * AbstractAction that refeshes the underlying LCC node store
013 *
014 * @author Bob Jacobsen  Copyright (C) 2024
015 */
016public class RefreshAction extends JmriAbstractAction {
017
018    public RefreshAction(String s, WindowInterface wi) {
019        super(s, wi);
020    }
021
022    public RefreshAction(String s, Icon i, WindowInterface wi) {
023        super(s, i, wi);
024    }
025
026    /**
027     * Default constructor used when instantiating via startup action or button
028     * configured in user preferences
029     */
030    public RefreshAction() {
031        super(Bundle.getMessage("RefreshAction")); // NOI18N
032    }
033
034    @Override
035    public void actionPerformed(ActionEvent event) {
036        InstanceManager.getDefault(jmri.jmrix.can.CanSystemConnectionMemo.class)
037            .get(MimicNodeStore.class).refresh();
038    }
039
040    // never invoked, because we overrode actionPerformed above
041    @Override
042    public jmri.util.swing.JmriPanel makePanel() {
043        throw new IllegalArgumentException("Should not be invoked");
044    }
045}