Skip to content

Commit 6ed4191

Browse files
Let SketchFile.delete() call Sketch.removeFile()
Previously, callers of `SketchFile.delete()` would also call `Sketch.removeFile()`, but letting SketchFile handle this is more robust. This is possible now that SketchFile keeps a reference to Sketch and makes updating the Sketch file list less fragile. Eventually this might be further decoupled by letting SketchFile broadcast a "deleted" event instead.
1 parent 538f702 commit 6ed4191

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

app/src/processing/app/SketchController.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,6 @@ public void handleDeleteCode() throws IOException {
260260
return;
261261
}
262262

263-
// remove code from the list
264-
sketch.removeFile(current);
265-
266263
// just set current tab to the main tab
267264
editor.selectTab(0);
268265

arduino-core/src/processing/app/SketchFile.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ protected boolean delete(Path tempBuildFolder) throws IOException {
142142
}
143143
}
144144

145+
sketch.removeFile(this);
146+
145147
return true;
146148
}
147149

0 commit comments

Comments
 (0)