Using filters

To reduce the number of matches shown in the Similar Code view, you can use filters. They can be accessed from the view menu:

There are several filters available. They can be turned on and off directly from the view menu. The ones you will use frequently are:

— Hide matches shorter than 10 lines filter hides short matches from the view; there are usually lots of false short matches.

Only matches with possible errors filter is automatically turned on when you use For possible renaming errors search mode, but you can also turn it on yourself; it hides the matches which do not have any possible errors identified.

Hide matches with all locations in the same file filter can be used when you want to see the big picture and concentrate on matches which span more than one file (there are usually lots of matches which match several snippets in a single file, and they often are too local and obvious to be interesting).

Advanced setup

You can change all filter options by selecting Setup filters item. You will see the following dialog box:

It allows you to change the 10 lines threshold for Hide matches shorter than 10 lines filter, and also gives access to two other filters:

Hide matches by pattern filter hides matches (and also projects, packages and files) whose label in Similar Code view matches the specified pattern; adding this filter is an Eclipse tradition and the cases it is useful in are not clear.

Hide matches with less than 20 matching tokens filter (with configurable threshold) can be used to remove matches that span many lines, but consist primary of comment lines (because comments are not counted as tokens).

Please press Tab key on your keyboard after you type a new threshold value before clicking the OK button.