6.2.2.9   Find/Replace...

Synopsis:
Find and replace text in the current program.
Shortcut:
Ctrl+F

This dialog provides comprehensive facilities for searching the program code. You can perform a full text search or search for variable names as well as operator (or procedure) calls. In addition, you can replace variable names and substitute operator or procedure calls. The dialog is displayed in figure 6.9.

Figure 6.9: Looking for operator calls containing “grab_image”.

The search context can be set to one of the following entities:

The search scope can be specified as follows:

Please note that locked procedures are not searched (see section “Protected Procedures” on page 93).

The following parameters specify how the search is performed:

Finding Single Occurrences of the Search Text Enter the search text and click Find. If there is no match, the text field will blink shortly. Otherwise, the first matching program line in the current procedure is highlighted. Each subsequent click of Find highlights the next matching program line. If the last matching line of the current scope has been reached, the text field blinks shortly. The next click on Find starts over at the beginning.

Finding All Occurrences of the Search Text

Enter the search text and click Find All. The search result will be presented in a separate window, i.e., the tab card Find Results of the quick navigation window (see section “Open Quick Navigation” on page 283).

Clicking an entry focuses the corresponding program line in the active program window. If the selected procedure is already displayed in a program window tab, the corresponding tab is activated. Otherwise, the current view switches to the selected procedure.

You can even select multiple lines from the search result by holding the Ctrl key. The following actions may be performed for all selected lines (either from the context menu of the search result or the corresponding menu entries): Cut, Copy, Delete, Activate, and Deactivate.

Add bookmarks to the selected program lines. This action will also add the selected program lines to the tab Bookmarks. This way you can “remember” a search result for later use; just open the quick navigation window again (Menu Window ▹ Open Quick Navigation) and go to the tab card Bookmarks.

The “find all” operation is recommended before doing a global replace to preview which program lines will be affected. An example is displayed in figure 6.10.

Figure 6.10: Finding all occurrences of the search text.

Replacing Variable Names Click Variables to specify the search context. Enter the search text and the replace text. You can replace parts of variable names by keeping Whole Words unchecked.

Click Find until the desired line is found. Afterwards, click Replace to replace all occurrences of the search text in the matched line. The next matching line is highlighted automatically.

Click Replace All to replace all occurrences of the search text in the specified scope. We recommend doing a Find All beforehand to estimate the extent of this operation.

Replacing Operator Calls You can replace one operator or procedure call with another. Because different operators very likely have different parameters, the source parameters have to be mapped to the target parameters beforehand. See figure 6.11 for an example.

Click Operators to specify the search context. Enter the source operator or procedure name and the target operator or procedure name. When both names are specified, the parameters of the target operator/procedure are listed at the bottom of the dialog. For every target parameter you have to select or enter a corresponding source parameter.

Please note that the option Whole Words is always enabled in this mode because only exact matches are valid when replacing operator calls.

Figure 6.11: Replacing operator calls.