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)
| 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); |
nothing calls this directly
no test coverage detected