@Override
  public @NotNull InspectionToolWrapper<?,?> getInspectionTool(@Nullable PsiElement element) {
    if (myTools != null) {
      Project project = element == null ? null : element.getProject();
      PsiFile containingFile = element == null ? null : InjectedLanguageManager.getInstance(project).getTopLevelFile(element);
      for (ScopeToolState state : myTools) {
        if (element == null) {
          return state.getTool();
        }
        NamedScope scope = state.getScope(project);
        if (scope != null) {
          PackageSet packageSet = scope.getValue();
          if (packageSet != null) {
            if (containingFile != null && packageSet.contains(containingFile, DependencyValidationManager.getInstance(project))) {
              return state.getTool();
            }
          }
        }
      }
    }
    return myDefaultState.getTool();
  }
@Override
  public @NotNull InspectionToolWrapper<?,?> getInspectionTool(@Nullable PsiElement element)