Skip to content

Commit 1d15c43

Browse files
matthijskooijmanfacchinm
authored andcommitted
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 aae0bc4 commit 1d15c43

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
@@ -259,9 +259,6 @@ public void handleDeleteCode() throws IOException {
259259
return;
260260
}
261261

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

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)