Skip to content

Commit

Permalink
Disable sketch folder deletion
Browse files Browse the repository at this point in the history
This feature was too sketchy for most users, we don't need it
  • Loading branch information
Stefterv committed Feb 5, 2025
1 parent 365d36e commit 9186b8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/src/processing/app/Sketch.java
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,17 @@ public void handleDeleteCode() {
return;
}

if(currentIndex == 0){
JOptionPane.showMessageDialog(editor,
Language.interpolate("warn.delete.sketch_last", getName()),
Language.text("warn.delete"),
JOptionPane.ERROR_MESSAGE);
return;
}

// confirm deletion with user, yes/no
Object[] options = { Language.text("prompt.ok"), Language.text("prompt.cancel") };
String prompt = (currentIndex == 0) ?
Language.interpolate("warn.delete.sketch_folder", getName()) :
Language.interpolate("warn.delete.sketch_file", current.getPrettyName());
String prompt = Language.interpolate("warn.delete.sketch_file", current.getPrettyName());
int result = JOptionPane.showOptionDialog(editor,
prompt,
Language.text("warn.delete"),
Expand All @@ -672,6 +678,7 @@ public void handleDeleteCode() {
null,
options,
options[0]);
// TODO: Remove the code to remove the entire sketch folder
if (result == JOptionPane.YES_OPTION) {
if (currentIndex == 0) { // delete the entire sketch
// need to unset all the modified flags, otherwise tries
Expand Down
1 change: 1 addition & 0 deletions build/shared/lib/languages/PDE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ contrib.import.errors.link = Error: The library %s has a strange looking downloa

warn.delete = Delete
warn.delete.sketch_folder = Are you sure you want to delete this sketch?\nThis will remove the entire “%s” folder.
warn.delete.sketch_last = Sorry deleting the sketch folder through Processing is not supported.
warn.delete.sketch_file = Are you sure you want to delete “%s”?
warn.cannot_change_mode.title = Cannot change mode
warn.cannot_change_mode.body = Cannot change mode,\nbecause “%s” mode is not compatible with current mode.
Expand Down

0 comments on commit 9186b8d

Please sign in to comment.