MCPcopy Index your code
hub / github.com/processing/processing / run

Method run

app/src/processing/app/tools/Archiver.java:65–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63
64
65 public void run() {
66 editor = base.getActiveEditor();
67 Sketch sketch = editor.getSketch();
68
69 if (sketch.isModified()) {
70 Messages.showWarning("Save", "Please save the sketch before archiving.");
71 return;
72 }
73
74 File location = sketch.getFolder();
75 String name = location.getName();
76 File parent = new File(location.getParent());
77
78 File newbie = null;
79 String namely = null;
80 int index = 0;
81 do {
82 // only use the date if the sketch name isn't the default name
83 useDate = !name.startsWith("sketch_");
84
85 if (useDate) {
86 String purty = dateFormat.format(new Date());
87 String stamp = purty + ((char) ('a' + index));
88 namely = name + "-" + stamp;
89 newbie = new File(parent, namely + ".zip");
90
91 } else {
92 String diggie = numberFormat.format(index + 1);
93 namely = name + "-" + diggie;
94 newbie = new File(parent, namely + ".zip");
95 }
96 index++;
97 } while (newbie.exists());
98
99 // open up a prompt for where to save this fella
100 PApplet.selectOutput(Language.text("archive_sketch"),
101 "fileSelected", newbie, this, editor);
102 }
103
104
105 public void fileSelected(File newbie) {

Callers

nothing calls this directly

Calls 11

isModifiedMethod · 0.95
showWarningMethod · 0.95
getFolderMethod · 0.95
selectOutputMethod · 0.95
textMethod · 0.95
getActiveEditorMethod · 0.80
getSketchMethod · 0.80
startsWithMethod · 0.80
formatMethod · 0.65
getNameMethod · 0.45
getParentMethod · 0.45

Tested by

no test coverage detected