Replace the current selection with whatever's in the replacement text field.
()
| 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 |