MCPcopy
hub / github.com/arduino/Arduino / storeSketches

Method storeSketches

app/src/processing/app/Base.java:573–596  ·  view source on GitHub ↗

Store list of sketches that are currently open. Called when the application is quitting and documents are still open.

()

Source from the content-addressed store, hash-verified

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();

Callers 2

handleOpenMethod · 0.95
handleQuitMethod · 0.95

Calls 7

storeSketchLocationMethod · 0.95
getMainFilePathMethod · 0.95
isModifiedMethod · 0.95
setIntegerMethod · 0.95
sizeMethod · 0.80
getMethod · 0.65
getSketchMethod · 0.45

Tested by

no test coverage detected