Displays the "find" UI (either a dialog or a toolbar). @see #showReplaceUI()
()
| 371 | * @see #showReplaceUI() |
| 372 | */ |
| 373 | public void showFindUI() { |
| 374 | |
| 375 | if (searchingMode==SearchingMode.DIALOGS) { |
| 376 | |
| 377 | rtext.getCollapsibleSectionPanel().hideBottomComponent(); |
| 378 | ensureSearchDialogsCreated(); |
| 379 | |
| 380 | if (replaceDialog.isVisible()) { |
| 381 | replaceDialog.setVisible(false); |
| 382 | } |
| 383 | |
| 384 | if (!findDialog.isVisible()) { |
| 385 | // If the current document has selected text, use the selection |
| 386 | // as the value to search for. |
| 387 | RTextEditorPane editor = rtext.getMainView().getCurrentTextArea(); |
| 388 | String selectedText = editor.getSelectedText(); |
| 389 | if (selectedText!=null) { |
| 390 | findDialog.setSearchString(selectedText); |
| 391 | } |
| 392 | findDialog.setVisible(true); |
| 393 | } |
| 394 | else { |
| 395 | findDialog.requestFocus(); |
| 396 | } |
| 397 | |
| 398 | } |
| 399 | |
| 400 | else { // SearchingMode.TOOLBARS |
| 401 | hideFindDialogIfVisible(); |
| 402 | hideReplaceDialogIfVisible(); |
| 403 | ensureToolbarsCreated(); |
| 404 | rtext.getCollapsibleSectionPanel().showBottomComponent(findToolBar); |
| 405 | } |
| 406 | |
| 407 | } |
| 408 | |
| 409 | |
| 410 | /** |
no test coverage detected