Orion/Documentation/User Guide/Tasks/Navigating and searching
Searching for files
Type Ctrl+Shift+F to search for a file with a given name. Clicking a match will open a page for the file as if you had clicked it in the Editor folder list. In many cases, this opens the Editing page on that file. If there is only a single match, simply press 'Enter' to open that file.
Searching for text within files
Once you launch the Search page you can type search terms in the search box on the left hand side to search for terms across all files in the current scope. Matches will be displayed on the right hand side of the page.
Both literal and wild card search are supported. For example, "fo*ar" will hit all the files containing "foobar" while "fo??ar" will hit the same files.
If there are more than 1 file systems, you can also switch to the file system as your search target.
When you type, the drop-down completion box allows you to browse recent or saved searches. The options under the search and replace boxes allows you to narrow down your search.
Read the Search page documentation for more details on how to browse, filter, and process search results.
In addition to the search page, there is also a convenient in-editor search, which is triggered by CTRL+H. Refer to Searching section in the editing page for details.
Search and replace across files
- Enter the search term to be replaced in the search field.
- Enter the replace term that will replace the search term in the replace field.
- Click on the Replace button. This will bring up the replace preview on right hand side.
- Browse the changes, and use the check boxes to select the files and matches you want to replace. Note that if there are multiple matches in a single line, it will be split to multiple lines where each line represents one match. There are 3 levels of check box.
- Overall: this allows you to toggle all the files and matches on the current page.
- File level: this allows you to toggle all the matches in a file.
- Match level: this allows you to toggle each match.
- Once you have selected all the matches that you want to replace, click on Commit on the tool bar. This will write all the replacement on the server.
- After the changes are committed, the replace page displays a list of files indicating the success or failure of the replacement. It also reports on how many matches were replaced on each file. You can click on any file to see the new content in a new tab. If some body else has changed the same file while you are replacing, a failure is generated and you have to refresh the page to redo it.
- If there is more than one page of search results, click on Next Page or Previous Page to repeat the process on the next set of results.
Example: refactor a function name
This example explains a work flow where a user tries to refactor something while another user already changed the same file at the same time. It covers all the features from search, replace to the replace report.
Lets say there is a function called foo that is used in 60 files. User A creates a new function called bar and wants to replace the function name in 5 files. Meanwhile, user B modified and saved one of the files. The steps below describes the complete workflow:
- User A types the keyword foo in the search field and bar in the replace field.
- User A clicks on Replace button. There are 3 files hit.
- User A selects the 3 files and relative matches that will be replaced.
- User A compares and confirms the differences between the original and replaced lines.
- User A commits the new contents of the 3 files to the server.
- All the 3 files are written successfully indicated by the report.
- User A replaces the next page by selecting the remaining 2 files and relative matches.
- User B modifies one of the 2 files and saves it.
- User A commits the replacement.
- One of the 2 files is reported written failure because it was modified during the replacing.
- User A refreshes the page and replaces the failed file again.
- User A commits the replacement successfully.
- Optional: To undo the changes, user A checks out the changes in git status page.