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 remove all engines from the operation database.
013 *
014 * @author Dan Boudreau Copyright (C) 2007
015 */
016public class DeleteEngineRosterAction extends AbstractAction {
017
018    public DeleteEngineRosterAction() {
019        super(Bundle.getMessage("MenuItemDelete"));
020    }
021
022    @Override
023    public void actionPerformed(ActionEvent ae) {
024        if (JmriJOptionPane.showConfirmDialog(null, Bundle.getMessage("engineSureDelete"),
025                Bundle.getMessage("engineDeleteAll"), JmriJOptionPane.OK_CANCEL_OPTION) == JmriJOptionPane.OK_OPTION) {
026            log.debug("removing all engines from roster");
027            InstanceManager.getDefault(EngineManager.class).deleteAll();
028        }
029    }
030
031    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(DeleteEngineRosterAction.class);
032}