Skip to content

Commit 6c2a94e

Browse files
matthijskooijmanfacchinm
authored andcommitted
Remove SketchCodeDocument
This class served no purpose anymore, so it can be removed. The `SketchCode.getMetadata()` and `setMetaData()` methods only served to keep track of a SketchCodeDocument instance (and were no longer used), so these are removed too, just like some SketchCode constructors dealing with this metadata object.
1 parent d2bac86 commit 6c2a94e

File tree

3 files changed

+2
-61
lines changed

3 files changed

+2
-61
lines changed

app/src/processing/app/Sketch.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@ private void load() throws IOException {
9090
protected void load(boolean forceUpdate) throws IOException {
9191
data.load();
9292

93-
for (SketchCode code : data.getCodes()) {
94-
if (code.getMetadata() == null)
95-
code.setMetadata(new SketchCodeDocument(this, code));
96-
}
97-
9893
// set the main file to be the current tab
9994
if (editor != null) {
10095
int current = editor.getCurrentTabIndex();
@@ -401,7 +396,7 @@ protected void nameCode(String newName) {
401396
return;
402397
}
403398
ensureExistence();
404-
SketchCode code = (new SketchCodeDocument(this, newFile)).getCode();
399+
SketchCode code = new SketchCode(newFile);
405400
try {
406401
editor.addTab(code, "");
407402
} catch (IOException e) {
@@ -861,7 +856,7 @@ public boolean addFile(File sourceFile) {
861856
}
862857

863858
if (codeExtension != null) {
864-
SketchCode newCode = (new SketchCodeDocument(this, destFile)).getCode();
859+
SketchCode newCode = new SketchCode(destFile);
865860

866861
if (replacement) {
867862
data.replaceCode(newCode);

app/src/processing/app/SketchCodeDocument.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

arduino-core/src/processing/app/SketchCode.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ public class SketchCode {
4545
*/
4646
private File file;
4747

48-
private Object metadata;
49-
5048
/**
5149
* Interface for an in-memory storage of text file contents. This is
5250
* intended to allow a GUI to keep modified text in memory, and allow
@@ -74,16 +72,7 @@ public static interface TextStorage {
7472
private TextStorage storage;
7573

7674
public SketchCode(File file) {
77-
init(file, null);
78-
}
79-
80-
public SketchCode(File file, Object metadata) {
81-
init(file, metadata);
82-
}
83-
84-
private void init(File file, Object metadata) {
8575
this.file = file;
86-
this.metadata = metadata;
8776
}
8877

8978
/**
@@ -244,14 +233,4 @@ public void saveAs(File newFile) throws IOException {
244233

245234
BaseNoGui.saveFile(storage.getText(), newFile);
246235
}
247-
248-
249-
public Object getMetadata() {
250-
return metadata;
251-
}
252-
253-
254-
public void setMetadata(Object metadata) {
255-
this.metadata = metadata;
256-
}
257236
}

0 commit comments

Comments
 (0)