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