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

Method replace

app/src/cc/arduino/view/findreplace/FindReplace.java:392–414  ·  view source on GitHub ↗

Replace the current selection with whatever's in the replacement text field.

()

Source from the content-addressed store, hash-verified

390 * field.
391 */
392 private void replace() {
393 if (findField.getText().length() == 0) {
394 return;
395 }
396
397 int newpos = editor.getCurrentTab().getSelectionStart() - findField.getText().length();
398 if (newpos < 0) {
399 newpos = 0;
400 }
401 editor.getCurrentTab().setSelection(newpos, newpos);
402
403 boolean foundAtLeastOne = false;
404
405 if (find(false, false, searchAllFilesBox.isSelected(), -1)) {
406 foundAtLeastOne = true;
407 editor.getCurrentTab().setSelectedText(replaceField.getText());
408 }
409
410 if (!foundAtLeastOne) {
411 Toolkit.getDefaultToolkit().beep();
412 }
413
414 }
415
416 /**
417 * Replace the current selection with whatever's in the replacement text

Callers 15

replaceAndFindNextMethod · 0.95
updateCacheInfoMethod · 0.80
makeConnectionMethod · 0.80
shExpMatchMethod · 0.80
makeProxyFromMethod · 0.80
trMethod · 0.80
formatMethod · 0.80
addArgumentMethod · 0.80
handle_401Method · 0.80
unquote_header_valueFunction · 0.80

Calls 6

findMethod · 0.95
getSelectionStartMethod · 0.80
getCurrentTabMethod · 0.80
setSelectionMethod · 0.80
setSelectedTextMethod · 0.80
getTextMethod · 0.65

Tested by 1

escapeStringMethod · 0.64