Searching the workbench

In this section, you will search the workbench for Safe X3 elements.

In the Search dialog, you can perform file or Safe X3 searches. Safe X3 searches operate on the structure of the code. File searches operate on the files by name and/or text content. Safe X3 searches are faster, since there is an underlying indexing structure for the code structure.

Performing a Safe X3 search from the workbench

  1. Copy and paste the following code to a new Safe X3 file in an exemplary project:

    #**
    #* Display a message box !
    #*
    #* @param MESSAGE
    #*!
    Subprog DISPLAY(MESSAGE)
    Value Char MESSAGE

    If MESSAGE = ""
    MESSAGE = "# empty #"
    Endif

    Infbox MESSAGE

    End

  2. In the Safe X3 perspective, click the Search [ Search ] button in the workbench toolbar, or use Search > X3... from the menu bar, or use Ctrl+H shortcut.
  3. If it is not already selected, select the X3 Search tab.
  4. In the Search string field, type DISPLAY. In the Search For area, select Method, and in the Limit To area, select Declaration.
    Verify that the Scope is set to Workspace.

    Java Search dialog

    Then click Search. While searching you can click Cancel at any time to stop the search. Partial results will be shown.
  5. In the Safe X3 perspective, the Search view shows the search results and the first match is highlighted in the editor.

    Search results view

    You may use the Show Next Match [ Show Next Match ] and Show Previous Match [ Show Previous Match ] buttons to navigate to each match (in this example there is a single match).
    Note that if the file in which a match was found is not currently open, it is opened in an editor when you select the match in the Search view.
  6. When you navigate to a search match using the Search view buttons, the file opens in the editor at the position of the match. Search matches are tagged with a search marker in the vertical ruler as shown above.

    File search tag

Performing a file search

  1. In the Safe X3 perspective, click the Search [ Search ] button in the workbench toolbar, or use Search > File from the menu bar, or use Ctrl+H shortcut.
  2. If it is not already selected, select the File Search tab.
  3. In the Containing text field, type MESSAGE. Make sure that the File name patterns field is set to *.src. The Scope should be set to Workspace. Then click Search.

    File search tab

  4. In the Safe X3 perspective, the Search view shows the search results and the first match is highlighted in the editor.

    Search results view

    You may use the Show Next Match [ Show Next Match ] and Show Previous Match [ Show Previous Match ] buttons to navigate to each match.
    Note that if the file in which a match was found is not currently open, it is opened in an editor when you select the match in the Search view.
  5. To find all files of a given file name pattern, let the Containing Text field empty and enter file name patterns.

Viewing previous search results

In the Search Results view, click the arrow next to the Previous Search Results toolbar button to see a menu containing the list of the most recent searches. You can choose items from this menu to view previous searches.  The list can be cleared by choosing Clear History.

Previous search results menu

The Previous Search Results button will display a dialog with the list of all previous searches from the current session. Alternatively, you can select the History... item in the menu list shown above.

Previous search results dialog

Selecting a previous search from this dialog will let you view that search.

Related concepts

Safe X3 search