Skip to content

Commit 0ef8a91

Browse files
authored
Merge pull request #943 from Stefterv/disable-folder-delete
2 parents 365d36e + b7aa3b9 commit 0ef8a91

16 files changed

+64
-10
lines changed

app/src/processing/app/Sketch.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,11 +659,25 @@ public void handleDeleteCode() {
659659
return;
660660
}
661661

662+
if(currentIndex == 0){
663+
Object[] options = { Language.text("menu.sketch.show_sketch_folder"), Language.text("prompt.cancel") };
664+
int result = JOptionPane.showOptionDialog(editor,
665+
Language.interpolate("warn.delete.sketch_last", getName()),
666+
Language.text("warn.delete"),
667+
JOptionPane.YES_NO_OPTION,
668+
JOptionPane.ERROR_MESSAGE,
669+
null,
670+
options,
671+
options[1]);
672+
if (result == JOptionPane.YES_OPTION) {
673+
Platform.openFolder(folder);
674+
}
675+
return;
676+
}
677+
662678
// confirm deletion with user, yes/no
663679
Object[] options = { Language.text("prompt.ok"), Language.text("prompt.cancel") };
664-
String prompt = (currentIndex == 0) ?
665-
Language.interpolate("warn.delete.sketch_folder", getName()) :
666-
Language.interpolate("warn.delete.sketch_file", current.getPrettyName());
680+
String prompt = Language.interpolate("warn.delete.sketch_file", current.getPrettyName());
667681
int result = JOptionPane.showOptionDialog(editor,
668682
prompt,
669683
Language.text("warn.delete"),
@@ -672,6 +686,7 @@ public void handleDeleteCode() {
672686
null,
673687
options,
674688
options[0]);
689+
// TODO: Remove the code to remove the entire sketch folder
675690
if (result == JOptionPane.YES_OPTION) {
676691
if (currentIndex == 0) { // delete the entire sketch
677692
// need to unset all the modified flags, otherwise tries

build/shared/lib/languages/PDE.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ contrib.import.errors.link = Error: The library %s has a strange looking downloa
600600

601601
warn.delete = Delete
602602
warn.delete.sketch_folder = Are you sure you want to delete this sketch?\nThis will remove the entire “%s” folder.
603+
warn.delete.sketch_last = To keep your files safe, deleting the whole sketch folder is not supported in Processing. \nPlease open the sketch folder in your file explorer to delete it.
603604
warn.delete.sketch_file = Are you sure you want to delete “%s”?
604605
warn.cannot_change_mode.title = Cannot change mode
605606
warn.cannot_change_mode.body = Cannot change mode,\nbecause “%s” mode is not compatible with current mode.

build/shared/lib/languages/PDE_de.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ editor.status.error.syntax = Syntaxfehler - %s
407407

408408
warn.delete = Löschen
409409
warn.delete.sketch = Den Sketch endgültig löschen?
410+
warn.delete.sketch_last = Um deine Dateien sicher zu halten, wird das Löschen des gesamten Sketch-Ordners in Processing nicht unterstützt. \nBitte öffne den Sketch-Ordner in deinem Datei-Explorer, um ihn zu löschen.
410411
warn.delete.file = Die Datei "%s" entgültig löschen?
411412

412413

build/shared/lib/languages/PDE_el.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ contrib.import.errors.link = Error: The library %s has a strange looking downloa
478478

479479
warn.delete = Διαγραφή
480480
warn.delete.sketch = Είσαι σίγουρος ότι θέλεις να διαγραφεί το Σχέδιο;
481+
warn.delete.sketch_last = Για να διατηρήσετε τα αρχεία σας ασφαλή, η διαγραφή ολόκληρου του φακέλου Σχεδίου δεν υποστηρίζεται στο Processing.\nΠαρακαλούμε ανοίξτε το φάκελο Σχεδίου στον εξερευνητή αρχείων για να το διαγράψετε.
481482
warn.delete.file = Είσαι σίγουρος ότι θέλεις να διαγράψεις το "%s";
482483

483484

build/shared/lib/languages/PDE_es.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ contrib.import.errors.link = Error: el enlace de descarga de la biblioteca «%s
599599

600600
warn.delete = Eliminar
601601
warn.delete.sketch_folder = ¿Seguro que quieres eliminar el sketch?\nEsto suprimirá la carpeta «%s» y todo su contenido.
602+
warn.delete.sketch_last = Para mantener tus archivos seguros, no se admite eliminar toda la carpeta del sketch en Processing.\nAbre la carpeta del sketch en tu explorador de archivos para eliminarla.
602603
warn.delete.sketch_file = ¿Seguro que quieres eliminar el archivo «%s»?
603604
warn.cannot_change_mode.title = Error cambio de modo
604605
warn.cannot_change_mode.body = No se puede cambiar al modo «%s»\nporque no es compatible con el modo actual.

build/shared/lib/languages/PDE_fr.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,9 @@ contrib.import.errors.link = Erreur : Le lien de téléchargement de la biblioth
487487
# Warnings
488488

489489
warn.delete = Supprimer
490-
warn.delete.sketch = Êtes-vous sûr(e) de vouloir supprimer ce sketch?
490+
warn.delete.sketch = Êtes-vous sûr(e) de vouloir supprimer ce sketch? \nLe dossier “%s” sera entièrement effacé.
491+
# warn.delete.sketch_last = To keep your files safe, deleting the whole sketch folder isn?t supported in Processing. \nPlease open the sketch folder in your file explorer to delete it.
492+
warn.delete.sketch_last = Pour protéger vos fichiers, la suppression du dossier de sketch entier n'est pas prise en charge dans Processing. \nVeuillez ouvrir le dossier de sketch dans votre explorateur de fichiers pour le supprimer.
491493
warn.delete.file = Êtes-vous sûr(e) de vouloir supprimer «%s»?
492494
warn.cannot_change_mode.title = Impossible de changer le mode
493495
warn.cannot_change_mode.body = Impossible de changer de mode, \ncar le mode "%s" n'est pas compatible avec le mode actuel.

build/shared/lib/languages/PDE_it.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ contrib.import.errors.link = Errore: la libreria %s ha uno strano link di downlo
533533

534534
warn.delete = Elimina
535535
warn.delete.sketch = Sei sicuro di voler eliminare questo sketch?
536+
warn.delete.sketch_last = Per mantenere i tuoi file al sicuro, l'eliminazione dell'intera cartella dello sketch non è supportata in Processing. \nPer favore apri la cartella dello sketch nel tuo esplora file per eliminarla.
536537
warn.delete.file = Sei sicuro di voler eliminare "%s"?
537538
warn.cannot_change_mode.title = Impossibile cambiare modalità
538539
warn.cannot_change_mode.body = Impossibile cambiare modalità,\npoichè la modalità "%s" non è compatibile con quella corrente.

build/shared/lib/languages/PDE_ja.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ contrib.import.errors.link = Error: The library %s has a strange looking downloa
537537

538538
warn.delete = 削除
539539
warn.delete.sketch = このスケッチを削除してもよろしいですか?
540+
warn.delete.sketch_last = ファイルの安全を保つため、Processing ではプロジェクトフォルダーの削除はサポートされていません。\nファイルエクスプローラーでプロジェクトフォルダーを開き、削除してください。
540541
warn.delete.file = "%s"を削除してもよろしいですか?
541542
warn.cannot_change_mode.title = モード変更失敗
542543
warn.cannot_change_mode.body = 互換性がないため、"%s"モードに切り替えられません。

build/shared/lib/languages/PDE_ko.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ editor.status.error.syntax = 구문 오류 - %s
308308

309309
warn.delete = 삭제
310310
warn.delete.sketch = 정말 해당 스케치를 삭제하시겠습니까?
311+
warn.delete.sketch_last = 파일의 안전을 위해 Processing에서는 프로젝트 폴더 삭제를 지원하지 않습니다. \n파일 탐색기에서 프로젝트 폴더를 열어 삭제해 주세요.
311312
warn.delete.file = 정말 "%s"를 삭제하시겠습니까?
312313

313314

build/shared/lib/languages/PDE_nl.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ contrib.unsupported_operating_system = Uw besturingssyteem wordt schijnbaar niet
305305

306306
warn.delete = Verwijderen
307307
warn.delete.sketch = Weet u zeker dat u deze schets wil verwijderen?
308+
warn.delete.sketch_last = Om je bestanden veilig te houden, wordt het verwijderen van de gehele schets niet ondersteund in Processing. \nOpen de schets map in je bestandsverkenner om deze te verwijderen.
308309
warn.delete.file = Weet u zeker dat u "%s" wil verwijderen?
309310

310311

0 commit comments

Comments
 (0)