Example #1
0
 // ****************************************
 protected boolean double_confirm_delete_file(File f)
       // ****************************************
     {
   int dialogButton =
       JOptionPane.showConfirmDialog(
           null,
           "Please confirm you want to sure-delete file "
               + f.getAbsolutePath()
               + " (WARNING: cannot be undone)",
           "Are you sure?",
           JOptionPane.OK_CANCEL_OPTION,
           JOptionPane.PLAIN_MESSAGE);
   if (dialogButton == JOptionPane.YES_OPTION) {
     if (f.isDirectory() == true) {
       int dialogButton2 =
           JOptionPane.showConfirmDialog(
               null,
               "DANGER: The target is a Folder ! Please confirm you want to sure-delete *recursively* ALL FILES IN THIS FOLDER (cannot be undone)\nIf you dont know what \"recursively\" means DONT click OK!",
               "Are you REALLY REALLY sure?",
               JOptionPane.OK_CANCEL_OPTION,
               JOptionPane.PLAIN_MESSAGE);
       if (dialogButton2 == JOptionPane.YES_OPTION) {
         Show_dialog_box.display("going to sure-delete:" + f.getAbsolutePath());
         return Garbagor.sure_delete(f);
       }
     } else {
       Show_dialog_box.display("going to sure-delete:" + f.getAbsolutePath());
       return Garbagor.sure_delete(f);
     }
   }
   return false;
 }
Example #2
0
  // ****************************************
  public void cleanup(List<File> target, String text)
        // ****************************************
      {
    if (target.isEmpty() == true) return;
    int s = target.size();
    int option =
        JOptionPane.showConfirmDialog(
            null,
            s + " " + text + " files will be deleted",
            "Please confirm, file deletion?",
            JOptionPane.OK_CANCEL_OPTION);
    if (option != JOptionPane.OK_OPTION) {
      return;
    }
    List<File> not_deleted = new ArrayList<File>();
    for (File f : target) {
      boolean b = Garbagor.sure_delete(f);
      if (b == false) not_deleted.add(f);
    }
    target.clear();
    target.addAll(not_deleted);
    if (not_deleted.isEmpty() == false) {
      int s2 = not_deleted.size();
      JOptionPane.showConfirmDialog(
          null,
          s2 + " " + text + " files COULD NOT be deleted",
          "This is weird!?",
          JOptionPane.OK_CANCEL_OPTION);
    }

    show_files(target);
  }