Store list of sketches that are currently open. Called when the application is quitting and documents are still open.
()
| 571 | * Called when the application is quitting and documents are still open. |
| 572 | */ |
| 573 | protected void storeSketches() { |
| 574 | |
| 575 | // If there is only one sketch opened save his position as default |
| 576 | if (editors.size() == 1) { |
| 577 | storeSketchLocation(editors.get(0), ".default"); |
| 578 | } |
| 579 | |
| 580 | // Save the sketch path and window placement for each open sketch |
| 581 | String untitledPath = untitledFolder.getAbsolutePath(); |
| 582 | List<Editor> reversedEditors = new LinkedList<>(editors); |
| 583 | Collections.reverse(reversedEditors); |
| 584 | int index = 0; |
| 585 | for (Editor editor : reversedEditors) { |
| 586 | Sketch sketch = editor.getSketch(); |
| 587 | String path = sketch.getMainFilePath(); |
| 588 | // Skip untitled sketches if they do not contains changes. |
| 589 | if (path.startsWith(untitledPath) && !sketch.isModified()) { |
| 590 | continue; |
| 591 | } |
| 592 | storeSketchLocation(editor, "" + index); |
| 593 | index++; |
| 594 | } |
| 595 | PreferencesData.setInteger("last.sketch.count", index); |
| 596 | } |
| 597 | |
| 598 | private void storeSketchLocation(Editor editor, String index) { |
| 599 | String path = editor.getSketch().getMainFilePath(); |
no test coverage detected