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

Method createTextArea

app/src/processing/app/EditorTab.java:145–192  ·  view source on GitHub ↗
(RSyntaxDocument document)

Source from the content-addressed store, hash-verified

143 }
144
145 private SketchTextArea createTextArea(RSyntaxDocument document)
146 throws IOException {
147 final SketchTextArea textArea = new SketchTextArea(document, editor.base.getPdeKeywords());
148 textArea.setName("editor");
149 textArea.setFocusTraversalKeysEnabled(false);
150 //textArea.requestFocusInWindow();
151 textArea.setMarkOccurrences(PreferencesData.getBoolean("editor.advanced"));
152 textArea.setMarginLineEnabled(false);
153 textArea.setCodeFoldingEnabled(PreferencesData.getBoolean("editor.code_folding"));
154 textArea.setAutoIndentEnabled(PreferencesData.getBoolean("editor.indent"));
155 textArea.setCloseCurlyBraces(PreferencesData.getBoolean("editor.auto_close_braces", true));
156 textArea.setAntiAliasingEnabled(PreferencesData.getBoolean("editor.antialias"));
157 textArea.setTabsEmulated(PreferencesData.getBoolean("editor.tabs.expand"));
158 textArea.setTabSize(PreferencesData.getInteger("editor.tabs.size"));
159 textArea.addHyperlinkListener(evt -> {
160 try {
161 UpdatableBoardsLibsFakeURLsHandler boardLibHandler = new UpdatableBoardsLibsFakeURLsHandler(editor.base);
162 boardLibHandler.openBoardLibManager(evt.getURL());
163 }
164 catch (Exception e) {
165 try {
166 editor.platform.openURL(editor.getSketch().getFolder(), evt.getURL().toExternalForm());
167 } catch (Exception f) {
168 Base.showWarning(f.getMessage(), f.getMessage(), f);
169 }
170 }
171 });
172 textArea.addCaretListener(e -> {
173 Element root = textArea.getDocument().getDefaultRootElement();
174 int lineStart = root.getElementIndex(e.getMark());
175 int lineEnd = root.getElementIndex(e.getDot());
176
177 editor.lineStatus.set(lineStart, lineEnd);
178 });
179 textArea.addFocusListener(new FocusListener() {
180 public void focusGained(FocusEvent e) {
181 Element root = textArea.getDocument().getDefaultRootElement();
182 int lineStart = root.getElementIndex(textArea.getCaret().getMark());
183 int lineEnd = root.getElementIndex(textArea.getCaret().getDot());
184 editor.lineStatus.set(lineStart, lineEnd);
185 };
186 public void focusLost(FocusEvent e) {};
187 });
188 ToolTipManager.sharedInstance().registerComponent(textArea);
189
190 configurePopupMenu(textArea);
191 return textArea;
192 }
193
194 private void configurePopupMenu(final SketchTextArea textarea){
195

Callers 1

EditorTabMethod · 0.95

Calls 12

getBooleanMethod · 0.95
getIntegerMethod · 0.95
openBoardLibManagerMethod · 0.95
showWarningMethod · 0.95
configurePopupMenuMethod · 0.95
getPdeKeywordsMethod · 0.80
setNameMethod · 0.80
getFolderMethod · 0.65
openURLMethod · 0.45
getSketchMethod · 0.45
getMessageMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected