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