diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 2b0cbadfa..6f31a2b72 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -617,6 +617,12 @@ public class Base { PreferencesData.setCollection("recent.sketches", sketches); } + protected void removeRecentSketchPath(String path) { + Collection sketches = new LinkedList(PreferencesData.getCollection("recent.sketches")); + sketches.remove(path); + PreferencesData.setCollection("recent.sketches", sketches); + } + // Because of variations in native windowing systems, no guarantees about // changes to the focused and active Windows can be made. Developers must // never assume that this Window is the focused or active Window until this diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index c6df10207..43a958c7f 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -2239,11 +2239,19 @@ public class Editor extends JFrame implements RunnerListener { statusNotice(_("Saving...")); boolean saved = false; try { + boolean wasReadOnly = sketch.isReadOnly(); + String previousMainFilePath = sketch.getMainFilePath(); saved = sketch.save(); - if (saved) + if (saved) { statusNotice(_("Done Saving.")); - else + if (wasReadOnly) { + base.removeRecentSketchPath(previousMainFilePath); + } + base.storeRecentSketches(sketch); + base.rebuildRecentSketchesMenuItems(); + } else { statusEmpty(); + } // rebuild sketch menu in case a save-as was forced // Disabling this for 0125, instead rebuild the menu inside // the Save As method of the Sketch object, since that's the