Tom
Tom

Reputation: 6332

Exclude files when using "Find Usages" in IntelliJ IDEA

In Java source files, when I select a class or a method, then click the right button of mouse, in the pop up context menu, and run Find Usages, the files that use the class or methods are searched out.

But I would like to exclude certain files (e.g. JUnit test files) from the search results.

Where could I configure this?

Upvotes: 1

Views: 1262

Answers (1)

glytching
glytching

Reputation: 47865

From the docs; you can confgure the Find Usages scope by clicking on the tools icon in the top left hand corner of the Find Usages results.

Here are some screenshots:

  • Click on the tools icon here:

enter image description here

  • Click on the build button (... next to the Scope field) to create a Scope and define it like so (in this examples I have included production classes and excluded test classes):

enter image description here

  • Choose that scope in the Find Usages dialog:

enter image description here

Notes:

  1. You can also chose the precanned scope named Project Production Files from the Scope dropdown
  2. All subsequent searches will use this scope by default until you choose a different scope.

Upvotes: 4

Related Questions