Find Dialog in the Editor

Author: Rudolf Bock
Version: 1.1

Dates: January 24th, 2005

Table of Contents:

The Find Dialog

The design of the Find Dialog has changed only slightly. The default size of the window stayed the same, but new is the placement most of the elements.

MacOS version

Windows version

Bellow the combobox are checkboxes where can be used to changing the method of searching. This check boxes arranged into logical groups. The first one affecting the handling with the inserted text. There are three checkboxes:

1. "Match Case" (tooltip: "Search the document only for a text with the same capitalization.")
2. "Whole Word" (tooltip: "Matches the searched text only to whole words in the document.")
3. "Regular Expressions" (tooltip: "Matches the searched text only to regular expressions in the document.")

The second group of checkboxes determine the way, how the document will be searched thru:

4. "Wrap Around" (tooltip: "Continues search from the beginning if end of the document is reached.")
5. "Search Selection" (tooltip: "Searches for occurrences in a selected block of text only.")
6. "Search Backwards" (tooltip: "Searches backwards from the current cursor position.")

The last two checkboxes set the way, how indicate the results of searching:

7. "Highlight Results" (tooltip: "Highlights all occurrences of the searched text.")
8. "Incremental Search" (tooltip: "Tries to find text as You type.")
  • Note: All tooltips must be displayed bellow the relevant item using a plain black text on a classical "tooltip-yellow" background. Tooltips are invoked approx. one second after placing the mouse cursor over an item and disappears only after next mouse movement.

On the right site of the Find Dialog are the main buttons. At the top is the "Find" button. Using this button user activates the search process. The "Find" button is set as default button. In the middle is the "Close" button, which closes the Find Dialog. This button don't play the role of a Cancel button. At the bottom is the "Help" button, which opens the NetBeans Help with the proper chapter.

The Behavior

Opening the dialog
The Find dialog can be invoked in different ways. Using a keystroke Ctrl-F (or Cmd-F on MacOS), by clicking on the "Find..." button in toolbar or by selecting menu item "Find..." in menu "Edit". If this dialog is opened first time in current session, it appears in center of the main IDE window. If user moves the dialog to an other position, IDE remembers this new position for rest of the session. The dialog remains open until the "Close" button is clicked.
If the user selected a piece text (max. one row of text) before he invoked the Find Dialog, this selected text will be taken as default searched text phrase and it'll be inserted into the "Find What" field. If user selected more than one row, the Find Dialog opens in "Search Selection" mode (described later). If the dialog was successfully used before, the "Find What" contains the last searched text. The Find Dialog remembers also the settings all of his UI elements.

By default are all of the checkboxes deselected, except the "Highlight Results", "Incremental Search" and "Wrap Around". This three are checked by default.

Using the dialog
It is very simple and intuitive. The user insert a searched text phrase into text field of the combobox or select one from the shared history.
Using the checkboxes, user can set options affecting the search process. Functionality most of them explain the tooltip texts in previous paragraph, but some needs more detailed explanation.

If the option "Regular Expressions" is checked, the checkboxes "Incremental Search" and "Whole Word" should be disabled. This means, that theses options won't be functional and the search process begins after clicking on the "Find" button. Searched regular expressions will be also stored in the search history. If user enters an expression that is not compilable and thus a pattern cannot be created, a warning message must be displayed. This warning should be displayed using Alert dialog, because is a kind of dead-in state and showing this warning in editor's status bar isn't enough synoptical.

If the option "Incremental Search" is checked, the Find Dialog performs a search from beginning of the document (or selection) each time, when a new character is entered. Current search result will be selected in editor. The Find Dialog searches for the first occurrence of the entered text phrase only.

If the option "Highlight Results" is checked, the search process select the occurrence of the searched text phrase at first and than marks all another occurrences with yellow background color. The exact specification of all used colors will be described later.

Search selection
If the user select more than one row of text before the Find Dialog opens, the checkbox "Search Selection" is checked and the search process takes place only inside this selection. User can deselect this check box whenever he want and the Find Dialog will use the whole document for searching. When the checkbox is checked again, the "remembered" selection will be reused (and displayed). If the user select text up to one row, this checkbox will be disabled.

Because the search process selects the newly found text, it's needed to preserve the search region - the original selection. Therefore is the original selection temporarily highlighted with a special color. The remaining behavior of the Find Dialog remains the same as described earlier. The result of searching is selected, the another results eventually highlighted...

Communication with the user
If the searched text phrase is found in the document or selection, the user is informed about that thru the editor status bar. For example " 'my text' found at 7:14", which means, that the phrase "my text" was found on the 7th row and the first letter of the phrase is the 14th character of that row.
If the searched text phrase is not found in the document or selection, the status bar of the editor reports a message like " 'my text' not found". This applies also in case, if "Wrap Around" is not checked and user performs another search after the last occurrence was found.
If the option "Wrap Around" is active, the search process starts at the beginning if the end of the document/selection was reached. The user is informed about that by a sound beep and the editor status bar. A message like " 'my text' found at 7:14; End of the document reached. Continuing search from beginning." (or " 'my text' found at 7:14; End of the selection reached. Continuing search from beginning." if searching in selection).

Basic rules
If the user searching in a selection and his text phrase was not found, the original selection must be preserved.
If the user searching in a selection, the option "Wrap Around" is not active and the end of selection is reached, the original selection must be preserved.
If the user select a text, invoke the Find Dialog and then closing the dialog without searching - his selection must be preserved.
If the user select a block of text, invoke the Find Dialog and then clicking back into the editor - his selection must be preserved.
If user leave the Find Dialog open and then using it later, the dialog must always reflect the current state. This means, if the user working with the editor and then activate the Find Dialog by clicking on it, this must behave the same way like at opening. This act teak especially the "Search Selection" checkbox and content of the "Find What" box.
If searching was successful, the wanted text was found and selected, the user should be able activate the editor by clicking on it without loosing this selection. The first click into the editor mustn't be handled as a command for deselecting.

The Colors

The next picture shows the colors used by the searching process. On the left site is displayed a result of searching in the whole document and on right the searching in a selection can be seen.

For selecting a search result, the classical color scheme of the IDE should be used (inverted text on a gray background).
In case of searching in a selection - during working with the Find Dialog, the original selection is replaced with a light blue-gray background and the found text is selected using orange. The syntax styles are disabled, but the basic syntax is illustrated using bold and plain text.

If the option "Highlight Results" is active, all occurrences of the searched text phrase are marked using this yellow background color.

Another Searching without this Dialog

But there exists a case, when user don't want use this Find Dialog - even when it is open. The Editor support this case with his function "Find Again", which can be invoked by using the standard key F3 on Windows or keystroke Cmd-G on MacOS. Editor will use the last searched text phrase from the Find Dialog. This kind of searching can be performed repeatedly in different documents.

Editor isn't the only one place, where you can see some elements from the Find Dialog. Pictures bellow show you two examples: Find in Projects and the function Replace. In these cases the used elements sharing their settings with the Find Dialog in the Editor (last used state).

Project Features

About this Project

Usersguide was started in November 2009, is owned by kganfield, and has 64 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
Please Confirm