Search in sources :

Example 1 with DeleteJob

use of com.mucommander.job.impl.DeleteJob in project mucommander by mucommander.

the class DeleteDialog method actionPerformed.

// /////////////////////////////////
// ActionListener implementation //
// /////////////////////////////////
public void actionPerformed(ActionEvent e) {
    // Start by disposing this dialog
    dispose();
    if (e.getSource() == deleteButton) {
        // Starts deleting files
        ProgressDialog progressDialog = new ProgressDialog(mainFrame, Translator.get("delete_dialog.deleting"));
        DeleteJob deleteJob = new DeleteJob(progressDialog, mainFrame, files, moveToTrash);
        progressDialog.start(deleteJob);
    }
}
Also used : DeleteJob(com.mucommander.job.impl.DeleteJob)

Example 2 with DeleteJob

use of com.mucommander.job.impl.DeleteJob in project mucommander by mucommander.

the class XfceTrash method empty.

/**
 * Empty the trash
 * <p>
 * <b>Implementation notes:</b><br>
 * Simply free the <code>TRASH_PATH</code> directory
 * </p>
 *
 * @return True if everything went well
 */
@Override
public boolean empty() {
    // Abort if there is no usable trash folder
    if (TRASH_FOLDER == null)
        return false;
    FileSet filesToDelete = new FileSet(TRASH_FOLDER);
    try {
        // delete real files
        filesToDelete.addAll(TRASH_FILES_SUBFOLDER.ls());
        // delete spec files
        filesToDelete.addAll(TRASH_INFO_SUBFOLDER.ls());
    } catch (java.io.IOException ex) {
        LOGGER.debug("Failed to list files", ex);
        return false;
    }
    if (filesToDelete.size() > 0) {
        // Starts deleting files
        MainFrame mainFrame = WindowManager.getCurrentMainFrame();
        ProgressDialog progressDialog = new ProgressDialog(mainFrame, Translator.get("delete_dialog.deleting"));
        DeleteJob deleteJob = new DeleteJob(progressDialog, mainFrame, filesToDelete, false);
        progressDialog.start(deleteJob);
    }
    return true;
}
Also used : DeleteJob(com.mucommander.job.impl.DeleteJob) FileSet(com.mucommander.commons.file.util.FileSet) IOException(java.io.IOException) ProgressDialog(com.mucommander.ui.dialog.file.ProgressDialog) MainFrame(com.mucommander.ui.main.MainFrame)

Example 3 with DeleteJob

use of com.mucommander.job.impl.DeleteJob in project mucommander by mucommander.

the class GnomeTrash method empty.

/**
 * Empty the trash
 * <p>
 * <b>Implementation notes:</b><br>
 * Simply free the <code>TRASH_PATH</code> directory
 * </p>
 *
 * @return True if everything went well
 */
@Override
public boolean empty() {
    // Abort if there is no usable trash folder
    if (TRASH_FOLDER == null)
        return false;
    FileSet filesToDelete = new FileSet(TRASH_FOLDER);
    try {
        // delete real files
        filesToDelete.addAll(TRASH_FILES_SUBFOLDER.ls());
        // delete spec files
        filesToDelete.addAll(TRASH_INFO_SUBFOLDER.ls());
    } catch (java.io.IOException ex) {
        LOGGER.debug("Failed to list files", ex);
        return false;
    }
    if (filesToDelete.size() > 0) {
        // Starts deleting files
        MainFrame mainFrame = WindowManager.getCurrentMainFrame();
        ProgressDialog progressDialog = new ProgressDialog(mainFrame, Translator.get("delete_dialog.deleting"));
        DeleteJob deleteJob = new DeleteJob(progressDialog, mainFrame, filesToDelete, false);
        progressDialog.start(deleteJob);
    }
    return true;
}
Also used : DeleteJob(com.mucommander.job.impl.DeleteJob) FileSet(com.mucommander.commons.file.util.FileSet) IOException(java.io.IOException) ProgressDialog(com.mucommander.ui.dialog.file.ProgressDialog) MainFrame(com.mucommander.ui.main.MainFrame)

Aggregations

DeleteJob (com.mucommander.job.impl.DeleteJob)3 FileSet (com.mucommander.commons.file.util.FileSet)2 ProgressDialog (com.mucommander.ui.dialog.file.ProgressDialog)2 MainFrame (com.mucommander.ui.main.MainFrame)2 IOException (java.io.IOException)2