MCPcopy Index your code
hub / github.com/benfry/processing4 / handleNew

Method handleNew

app/src/processing/app/Base.java:1100–1136  ·  view source on GitHub ↗

Create a new untitled document in a new sketch window.

()

Source from the content-addressed store, hash-verified

1098 * Create a new untitled document in a new sketch window.
1099 */
1100 public void handleNew() {
1101// long t1 = System.currentTimeMillis();
1102 try {
1103 // In 0126, untitled sketches will begin in the temp folder,
1104 // and then moved to a new location because Save will default to Save As.
1105 //File sketchbookDir = getSketchbookFolder();
1106 File newbieDir = SketchName.nextFolder(untitledFolder);
1107
1108 // User was told to go outside or other problem happened inside naming.
1109 if (newbieDir == null) return;
1110
1111 // Make the directory for the new sketch
1112 if (!newbieDir.mkdirs()) {
1113 throw new IOException("Could not create directory " + newbieDir);
1114 }
1115
1116 // Retrieve the sketch name from the folder name (not a great
1117 // assumption for the future, but overkill to do otherwise for now.)
1118 String newbieName = newbieDir.getName();
1119
1120 // Add any template files from the Mode itself
1121 File newbieFile = nextMode.addTemplateFiles(newbieDir, newbieName);
1122
1123 // Create sketch properties file if it's not the default mode.
1124 if (!nextMode.equals(getDefaultMode())) {
1125 Sketch.updateModeProperties(newbieDir, nextMode, getDefaultMode());
1126 }
1127
1128 String path = newbieFile.getAbsolutePath();
1129 handleOpenUntitled(path);
1130
1131 } catch (IOException e) {
1132 Messages.showTrace("That's new to me",
1133 "A strange and unexplainable error occurred\n" +
1134 "while trying to create a new sketch.", e, false);
1135 }
1136 }
1137
1138
1139 /**

Callers 7

BaseMethod · 0.95
initDefaultFileMenuMethod · 0.95
changeModeMethod · 0.95
handleOpenInternalMethod · 0.95
runMethod · 0.80
removeModeMethod · 0.80
buildFileMenuMethod · 0.80

Calls 8

nextFolderMethod · 0.95
getDefaultModeMethod · 0.95
updateModePropertiesMethod · 0.95
handleOpenUntitledMethod · 0.95
showTraceMethod · 0.95
addTemplateFilesMethod · 0.80
getNameMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected