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

Method EditorTab

app/src/processing/app/EditorTab.java:92–113  ·  view source on GitHub ↗

Create a new EditorTab @param editor The Editor this tab runs in @param file The file to display in this tab @param contents Initial contents to display in this tab. Can be used when editing a file that doesn't exist yet. If null is passed, code.load() is

(Editor editor, SketchFile file, String contents)

Source from the content-addressed store, hash-verified

90 * @throws IOException
91 */
92 public EditorTab(Editor editor, SketchFile file, String contents)
93 throws IOException {
94 super(new BorderLayout());
95
96 // Load initial contents contents from file if nothing was specified.
97 if (contents == null) {
98 contents = file.load();
99 modified = false;
100 } else {
101 modified = true;
102 }
103
104 this.editor = editor;
105 this.file = file;
106 RSyntaxDocument document = createDocument(contents);
107 textarea = createTextArea(document);
108 scrollPane = createScrollPane(textarea);
109 file.setStorage(this);
110 applyPreferences();
111 add(scrollPane, BorderLayout.CENTER);
112 editor.base.addEditorFontResizeMouseWheelListener(textarea);
113 }
114
115 private RSyntaxDocument createDocument(String contents) {
116 RSyntaxDocument document = new RSyntaxDocument(new ArduinoTokenMakerFactory(editor.base.getPdeKeywords()), RSyntaxDocument.SYNTAX_STYLE_CPLUSPLUS);

Callers

nothing calls this directly

Calls 8

createDocumentMethod · 0.95
createTextAreaMethod · 0.95
createScrollPaneMethod · 0.95
applyPreferencesMethod · 0.95
setStorageMethod · 0.80
loadMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected