@@ -563,21 +563,22 @@ protected void storeSketches() {
563
563
String untitledPath = untitledFolder .getAbsolutePath ();
564
564
565
565
// 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 );
568
569
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 ()) {
574
575
continue ;
575
576
}
576
577
PreferencesData .set ("last.sketch" + index + ".path" , path );
577
578
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 );
581
582
index ++;
582
583
}
583
584
PreferencesData .setInteger ("last.sketch.count" , index );
@@ -896,12 +897,7 @@ protected Editor handleOpen(File file, int[] storedLocation, int[] defaultLocati
896
897
// now that we're ready, show the window
897
898
// (don't do earlier, cuz we might move it based on a window being closed)
898
899
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 ));
905
901
}
906
902
907
903
return editor ;
0 commit comments