mirror of https://github.com/noisymime/Arduino.git
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:
parent
cb29f4832e
commit
35d3aeb6d6
|
@ -617,6 +617,12 @@ public class Base {
|
||||||
PreferencesData.setCollection("recent.sketches", sketches);
|
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
|
// Because of variations in native windowing systems, no guarantees about
|
||||||
// changes to the focused and active Windows can be made. Developers must
|
// 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
|
// never assume that this Window is the focused or active Window until this
|
||||||
|
|
|
@ -2239,11 +2239,19 @@ public class Editor extends JFrame implements RunnerListener {
|
||||||
statusNotice(_("Saving..."));
|
statusNotice(_("Saving..."));
|
||||||
boolean saved = false;
|
boolean saved = false;
|
||||||
try {
|
try {
|
||||||
|
boolean wasReadOnly = sketch.isReadOnly();
|
||||||
|
String previousMainFilePath = sketch.getMainFilePath();
|
||||||
saved = sketch.save();
|
saved = sketch.save();
|
||||||
if (saved)
|
if (saved) {
|
||||||
statusNotice(_("Done Saving."));
|
statusNotice(_("Done Saving."));
|
||||||
else
|
if (wasReadOnly) {
|
||||||
|
base.removeRecentSketchPath(previousMainFilePath);
|
||||||
|
}
|
||||||
|
base.storeRecentSketches(sketch);
|
||||||
|
base.rebuildRecentSketchesMenuItems();
|
||||||
|
} else {
|
||||||
statusEmpty();
|
statusEmpty();
|
||||||
|
}
|
||||||
// rebuild sketch menu in case a save-as was forced
|
// rebuild sketch menu in case a save-as was forced
|
||||||
// Disabling this for 0125, instead rebuild the menu inside
|
// Disabling this for 0125, instead rebuild the menu inside
|
||||||
// the Save As method of the Sketch object, since that's the
|
// the Save As method of the Sketch object, since that's the
|
||||||
|
|
Loading…
Reference in New Issue