sclass DeleteFilesDialog { settable S title = "Delete files"; new LinkedHashSet filesToDelete; *() {} *(S *title) {} selfType wholeDirectory(File dir) { if (!isDirectory(dir)) this; filesToDelete.addAll(reversed(findAllFiles(dir))); filesToDelete.add(dir); this; } void show { renameSubmitButton("DELETE " + upper(nFiles(filesToDelete)), showFormTitled3(title, "Files to delete", jscroll(uneditableTextArea(lines(filesToDelete))), null, rThread doIt).visualize()); } void doIt { int successes = 0; for (File f : filesToDelete) if (deleteFile(f)) { print("DELETED: " + f); ++successes; } else print("COULDN'T DELETE: " + f); int failures = l(filesToDelete)-successes; S msg = "Deleted " + nFiles(successes); if (failures == 0) infoBox(msg); else messageBox(msg + ", but couldn't delete " + n2(failures)); } }