Open Recent: if sketch was read only and it was saved, saved version was not put into recent sketches list. Fixed

This commit is contained in:
Federico Fissore 2015-06-11 17:36:02 +02:00
parent cb29f4832e
commit 35d3aeb6d6
2 changed files with 16 additions and 2 deletions

View File

@ -617,6 +617,12 @@ public class Base {
PreferencesData.setCollection("recent.sketches", sketches);
}
protected void removeRecentSketchPath(String path) {
Collection<String> sketches = new LinkedList<String>(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

View File

@ -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