MCPcopy Index your code
hub / github.com/arduino/Arduino / run

Method run

app/src/processing/app/tools/FixEncoding.java:51–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49
50
51 public void run() {
52 Sketch sketch = editor.getSketch();
53 //SketchCode code = sketch.current;
54
55 if (sketch.isModified()) {
56 int result =
57 JOptionPane.showConfirmDialog(editor,
58 tr("Discard all changes and reload sketch?"),
59 tr("Fix Encoding & Reload"),
60 JOptionPane.YES_NO_OPTION,
61 JOptionPane.QUESTION_MESSAGE);
62
63 if (result == JOptionPane.NO_OPTION) {
64 return;
65 }
66 }
67 try {
68 for (int i = 0; i < sketch.getCodeCount(); i++) {
69 SketchFile file = sketch.getFile(i);
70 editor.findTab(file).setText(loadWithLocalEncoding(file.getFile()));
71 }
72 } catch (IOException e) {
73 String msg =
74 tr("An error occurred while trying to fix the file encoding.\nDo not attempt to save this sketch as it may overwrite\nthe old version. Use Open to re-open the sketch and try again.\n") +
75 e.getMessage();
76 Base.showWarning(tr("Fix Encoding & Reload"), msg, e);
77 }
78 }
79
80
81 protected String loadWithLocalEncoding(File file) throws IOException {

Callers

nothing calls this directly

Calls 11

isModifiedMethod · 0.95
getCodeCountMethod · 0.95
getFileMethod · 0.95
loadWithLocalEncodingMethod · 0.95
getFileMethod · 0.95
showWarningMethod · 0.95
trMethod · 0.80
findTabMethod · 0.80
getSketchMethod · 0.45
setTextMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected