001package jmri.jmrit.operations.rollingstock.engines.tools;
002
003import java.awt.event.ActionEvent;
004
005import javax.swing.AbstractAction;
006
007import jmri.InstanceManager;
008import jmri.jmrit.operations.rollingstock.engines.EngineManager;
009import jmri.util.swing.JmriJOptionPane;
010
011/**
012 * This routine will reset the move count for all engines in the operation
013 * database.
014 *
015 * @author Dan Boudreau Copyright (C) 2012
016 */
017public class ResetEngineMovesAction extends AbstractAction {
018
019    public ResetEngineMovesAction() {
020        super(Bundle.getMessage("MenuItemResetMoves"));
021    }
022
023    @Override
024    public void actionPerformed(ActionEvent ae) {
025        if (JmriJOptionPane.showConfirmDialog(null, Bundle.getMessage("engineSureResetMoves"),
026                Bundle.getMessage("engineResetMovesAll"), JmriJOptionPane.OK_CANCEL_OPTION) == JmriJOptionPane.OK_OPTION) {
027            log.debug("Reset moves for all engines in roster");
028            InstanceManager.getDefault(EngineManager.class).resetMoves();
029        }
030    }
031
032    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(ResetEngineMovesAction.class);
033}