Supplier<SearchScope> (UsageTarget @NotNull [] searchFor) { UsageTarget target = searchFor.length > 0 ? searchFor[0] : null; DataProvider dataProvider = DataManagerImpl.getDataProviderEx(target); SearchScope scope = dataProvider != null ? UsageView.USAGE_SCOPE.getData(dataProvider) : null; if (scope != null) { return () -> scope; } DataProvider bgtProvider = dataProvider != null ? PlatformCoreDataKeys.BGT_DATA_PROVIDER.getData(dataProvider) : null; return () -> { SearchScope scope2 = bgtProvider != null ? UsageView.USAGE_SCOPE.getData(bgtProvider) : null; if (scope2 != null) return scope2; return GlobalSearchScope.everythingScope(myProject); // by default do not warn of falling out of scope }; }