2010/06/01

Intellij Idea - Searching in Single Library with Scopes

Do you have a package in your dependencies and need to seach for some string in just this package, excluding others ?

You can do it using not so known scopes. If you do not know them, you should try, it's one of the most practical things Idea includes. It can be used e.g. for coloring your tabs but it's also more than useful for searching.

1/ Open Find in Path dialog, either from menu or via Ctrl+Shift+F shortcut 

 2/ Select Scopes - Custom.
 3/ For creating of a new scope, click on three dot buton on the right side of the scopes list.
 4/ in Scopes dialog, use the Add Scope icon (yellow plus in topl left corner). In the right panel select packages belonging to the library in which you want to search and include them recursively and press Apply.
 5/ Giving OK you'll get back to the search dialog now with your newly created scope available.