Skip to content

Commit 2c08904

Browse files
committed
Small cosmetics
1 parent 19a9e4d commit 2c08904

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

app/src/processing/app/Base.java

+12-16
Original file line numberDiff line numberDiff line change
@@ -563,21 +563,22 @@ protected void storeSketches() {
563563
String untitledPath = untitledFolder.getAbsolutePath();
564564

565565
// Save the sketch path and window placement for each open sketch
566-
LinkedList<Editor> reverseEditors = new LinkedList<Editor>(editors);
567-
Collections.reverse(reverseEditors);
566+
String untitledPath = untitledFolder.getAbsolutePath();
567+
List<Editor> reversedEditors = new LinkedList<>(editors);
568+
Collections.reverse(reversedEditors);
568569
int index = 0;
569-
for (Editor editor : reverseEditors) {
570-
String path = editor.getSketch().getMainFilePath();
571-
// In case of a crash, save untitled sketches if they contain changes.
572-
// (Added this for release 0158, may not be a good idea.)
573-
if (path.startsWith(untitledPath) && !editor.getSketch().isModified()) {
570+
for (Editor editor : reversedEditors) {
571+
Sketch sketch = editor.getSketch();
572+
String path = sketch.getMainFilePath();
573+
// Skip untitled sketches if they do not contains changes.
574+
if (path.startsWith(untitledPath) && !sketch.isModified()) {
574575
continue;
575576
}
576577
PreferencesData.set("last.sketch" + index + ".path", path);
577578

578-
int[] location = editor.getPlacement();
579-
String locationStr = PApplet.join(PApplet.str(location), ",");
580-
PreferencesData.set("last.sketch" + index + ".location", locationStr);
579+
int[] placement = editor.getPlacement();
580+
String location = PApplet.join(PApplet.str(placement), ",");
581+
PreferencesData.set("last.sketch" + index + ".location", location);
581582
index++;
582583
}
583584
PreferencesData.setInteger("last.sketch.count", index);
@@ -896,12 +897,7 @@ protected Editor handleOpen(File file, int[] storedLocation, int[] defaultLocati
896897
// now that we're ready, show the window
897898
// (don't do earlier, cuz we might move it based on a window being closed)
898899
if (showEditor) {
899-
SwingUtilities.invokeLater(new Runnable() {
900-
@Override
901-
public void run() {
902-
editor.setVisible(true);
903-
}
904-
});
900+
SwingUtilities.invokeLater(() -> editor.setVisible(true));
905901
}
906902

907903
return editor;

0 commit comments

Comments
 (0)