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