Searching

Overview

DEFT lets you search for text in chapters, code files and code snippets. You can either search within the currently active editor or perform a search over the whole repository.

Searching in a file

You can search for some text in chapters, code files and code snippets. To open the search dialog select EditFind/Replace from the menu or press Ctrl+F.

The search dialog has a number of options that affect the search:

Find The word or phrase to be searched.

Replace with Optional: the word or phrase with which to replace the search term

Direction If Forward is selected, the search will consider text below the current cursor position. If Backward is selected, the search will consider text above the current cursor position.

Scope Select whether to search in the whole file or only in selected lines. Searching in selected lines works only for code files and code snippets.

Case sensitive If checked, the case of the search term matters. Words and phrases are only found if they appear with the same uppercase and lowercase letters. If unchecked, capitalization is ignored.

Wrap search If checked, the search will continue at the top of the file when the bottom has been reached. (Similarly, if direction Backward is selected, the search will continue at the bottom of the file, when the top has been reached). If unchecked, the search will stop when bottom or top of the file are reached.

Whole word If checked, only whole words can be search results, not parts of words. For example, if the search term is "public", the word "public", will be found, whereas publicity will not, even though it contains the string "public". If unchecked, arbitrary strings can be searched, regardless of word boundaries.

Incremental If checked, the the first search result will be highlighted while typing the search term into the Find field. If the search term is not found, a little message "String Not Found" is displayed in the search dialog. If unchecked, nothing happens while the search term is being typed.

Regular expressions If checked, search terms with regular expressions can be evaluated. Regular expressions are a means to specify search patterns beyond a simple string. For example, one could search for all occurrences of the string "ident" which is followed by two numbers. Explaining regular expressions is beyond the scope of this document. Please refer to Sun's Regular Expressions Tutorial. If unchecked, the search term is treated as a simple string.

Regular expressions can only be used for search in code files and code snippets.

After the search terms have been entered and all options are set, there are four different actions than can be executed:

Find Find the next occurrence of the search term and select (highlight) it.

Replace/Find Replace the currently selected text with the replace term, then find and select the next occurrence of the search term. This action is only available in chapters.

Replace Replace the currently selected text with the text from the Replace with text field. This action is only available in chapters.

Replace All Replace all occurrences of the search term with the replace term, starting from the current cursor position. This action is only available in chapters.

Please note that in chapters it is only possible to search for manually typed text. As for now, embedded code snippets are ignored by the search. This is going to change in future versions, though.

Searching across files

It is also possible to perform a search for chapters and code files across the whole repository. To open the search dialog select EditSearch from the menu or press Ctrl+H.

The search dialog has a number of fields that affect the search.

Search The word or phrase to be searched

Case sensitive If checked, the case of the search term matters. Words and phrases are only found if they appear with the same uppercase and lowercase letters. If unchecked, capitalization is ignored.

Search only for This is a filter which lets you specify the type of file you want to search in. The available options are Chapter, CodeFile and All (both chapters and codefiles).

Search only in project This is a filter which lets you specify the projects to be included by the search. There is an entry for each project in the workspace and the entry All, which will cause a search to include all projects

After the search has been performed, a Search view is displayed, showing the files which contain the search term. Doubleclicking on a filename opens the corresponding file in the editor.

The search results can be expanded by clicking the corresponding icon in front of the file name. When an entry is expanded, all occurrences of the search term in the file are displayed. Doubleclicking on such an occurrence opens the corresponding file in the editor and highlights the searched text.