001package jmri.jmrit.roster;
002
003import java.awt.event.ActionEvent;
004import javax.swing.Icon;
005import jmri.util.swing.JmriAbstractAction;
006import jmri.util.swing.WindowInterface;
007
008/**
009 * Recreate the roster index file if it's been damaged or lost.
010 * <p>
011 * Scans the roster directory for xml files, including any that are found.
012 *
013 * @author Bob Jacobsen Copyright (C) 2001
014 */
015public class RecreateRosterAction extends JmriAbstractAction {
016
017    public RecreateRosterAction(String s, WindowInterface wi) {
018        super(s, wi);
019    }
020
021    public RecreateRosterAction(String s, Icon i, WindowInterface wi) {
022        super(s, i, wi);
023    }
024
025    public RecreateRosterAction() {
026        this("Rebuild Roster");
027    }
028
029    public RecreateRosterAction(String s) {
030        super(s);
031    }
032
033    @Override
034    public void actionPerformed(ActionEvent e) {
035        Roster.getDefault().reindex();
036    }
037
038    // never invoked, because we overrode actionPerformed above
039    @Override
040    public jmri.util.swing.JmriPanel makePanel() {
041        throw new IllegalArgumentException("Should not be invoked");
042    }
043}