When we have to search for a word in one or more projects, we use Eclipse File Search Feature. This feature enables us to search for specific words in specific file types. We can also search for a word in all the files by using the wildcard (i.e *). This is how we can use File Search:
1) Open Search->File from Menu Bar.
2) A dialog box will appear that will have many tabs. Currently the tab named File Search will be selected and opened.
3) In the containing text text field, enter the word to be searched.
4) If you want to search for this word in any specific file pattern, then put that pattern in File Name Patterns text box. If the word is to be searched in all the files, then use * there (As in the Screenshot).
Example: if I want to search for word “substitute” in file that ends with .properties extension, I will do the following:
5) You can select the Scope of the search by selecting a Radio Button in the Scope section.
6) If you want the search to be Case-Sensitive or according to Regular-Expression, then you can accordingly select the check boxes next to the Containing text Text box.
Tip: It’s a good practice to keep all the projects (except the one you are working on) closed. If any of the project is closed, then this utility will not search for the word in those projects.
Using the Search Result:
The search result will be shown in the Search view, which if not opened, will be opened automatically. The result will be shown in a hierarchical fashion like this:
Just above the hierarchy, the word and its occurrences in the workspace (or the Scope selected) are shown.
The various options present in the view are:
1) Show Next Match: Shows the next match for the word in the hierarchy.
2) Show Previous Match: Show the previous match for the word in the hierarchy.
3) Run the current search again: Runs the search with same parameters again.
4) Show Previous Searches: Displays a drop down list of Previous searches conducted in the current session.
Hope this article was helpful…..Keep on checking for more helpful posts….