8000 Open Recent: if sketch was read only and it was saved, saved version … · CRImier/Arduino@35d3aeb · GitHub
[go: up one dir, main page]

Skip to content

Commit 35d3aeb

Browse files
author
Federico Fissore
committed
Open Recent: if sketch was read only and it was saved, saved version was not put into recent sketches list. Fixed
1 parent cb29f48 commit 35d3aeb

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

app/src/processing/app/Base.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,12 @@ protected void storeRecentSketches(Sketch sketch) {
617617
PreferencesData.setCollection("recent.sketches", sketches);
618618
}
619619

620+
protected void removeRecentSketchPath(String path) {
621+
Collection<String> sketches = new LinkedList<String>(PreferencesData.getCollection("recent.sketches"));
622+
sketches.remove(path);
623+
PreferencesData.setCollection("recent.sketches", sketches);
624+
}
625+
620626
// Because of variations in native windowing systems, no guarantees about
621627
// changes to the focused and active Windows can be made. Developers must
622628
// never assume that this Window is the focused or active Window until this

app/src/processing/app/Editor.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,11 +2239,19 @@ private boolean handleSave2() {
22392239
statusNotice(_("Saving..."));
22402240
boolean saved = false;
22412241
try {
2242+
boolean wasReadOnly = sketch.isReadOnly();
2243+
String previousMainFilePath = sketch.getMainFilePath();
22422244
saved = sketch.save();
2243-
if (saved)
2245+
if (saved) {
22442246
statusNotice(_("Done Saving."));
2245-
else
2247+
if (wasReadOnly) {
2248+
base.removeRecentSketchPath(previousMainFilePath);
2249+
}
2250+
base.storeRecentSketches(sketch);
2251+
base.rebuildRecentSketchesMenuItems();
2252+
} else {
22462253
statusEmpty();
2254+
}
22472255
// rebuild sketch menu in case a save-as was forced
22482256
// Disabling this for 0125, instead rebuild the menu inside
22492257
// the Save As method of the Sketch object, since that's the

0 commit comments

Comments
 (0)
0