Libraryless. Click here for Pure Java version (15894L/95K).
sclass DeleteFilesDialog { settable S title = "Delete files"; new LinkedHashSet<File> 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)); } }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035137 |
Snippet name: | DeleteFilesDialog |
Eternal ID of this version: | #1035137/6 |
Text MD5: | a8e017a75955ff2dbe2a43bc3c9f5f62 |
Transpilation MD5: | 2daf486ad2239597f0e96538e5500890 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-31 16:51:36 |
Source code size: | 999 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 162 / 242 |
Version history: | 5 change(s) |
Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) |