Orion/Documentation/User Guide/Tasks/Navigating and searching

From Eclipsepedia

Jump to: navigation, search

Contents

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.

Search pane

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

  1. Enter the search term to be replaced in the search field.
  2. Enter the replace term that will replace the search term in the replace field.
  3. Click on the Replace button. This will bring up the replace preview on right hand side.
  4. 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.
    Filtering matches
    • 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.
  5. 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.
  6. 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. Search replace report
  7. 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:

  1. User A types the keyword foo in the search field and bar in the replace field.
  2. User A clicks on Replace button. There are 3 files hit.
  3. User A selects the 3 files and relative matches that will be replaced.
  4. User A compares and confirms the differences between the original and replaced lines.
  5. User A commits the new contents of the 3 files to the server.
  6. All the 3 files are written successfully indicated by the report.
  7. User A replaces the next page by selecting the remaining 2 files and relative matches.
  8. User B modifies one of the 2 files and saves it.
  9. User A commits the replacement.
  10. One of the 2 files is reported written failure because it was modified during the replacing.
  11. User A refreshes the page and replaces the failed file again.
  12. User A commits the replacement successfully.
  13. Optional: To undo the changes, user A checks out the changes in git status page.