001    /*
002     * This file is part of muCommander, http://www.mucommander.com
003     * Copyright (C) 2002-2008 Maxence Bernard
004     *
005     * muCommander is free software; you can redistribute it and/or modify
006     * it under the terms of the GNU General Public License as published by
007     * the Free Software Foundation; either version 3 of the License, or
008     * (at your option) any later version.
009     *
010     * muCommander is distributed in the hope that it will be useful,
011     * but WITHOUT ANY WARRANTY; without even the implied warranty of
012     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013     * GNU General Public License for more details.
014     *
015     * You should have received a copy of the GNU General Public License
016     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017     */
018    
019    package com.mucommander.ui.action;
020    
021    import com.mucommander.file.util.FileSet;
022    import com.mucommander.ui.dialog.file.CalculateChecksumDialog;
023    import com.mucommander.ui.main.MainFrame;
024    
025    import java.util.Hashtable;
026    
027    /**
028     * This action invokes the {@link com.mucommander.ui.dialog.file.CalculateChecksumDialog} which allows to calculate
029     * the checksum of the selected files and store the results in a pseudo-standard checksum file. 
030     *
031     * @author Maxence Bernard
032     */
033    public class CalculateChecksumAction extends SelectedFilesAction implements InvokesDialog  {
034    
035        public CalculateChecksumAction(MainFrame mainFrame, Hashtable properties) {
036            super(mainFrame, properties);
037        }
038    
039        public void performAction() {
040            FileSet files = mainFrame.getActiveTable().getSelectedFiles();
041    
042            // Invoke job dialog only if at least one file is selected/marked
043            if(files.size()>0)
044                new CalculateChecksumDialog(mainFrame, files);
045        }
046    }