public static @NotNull GlobalSearchScope directoryScope(@NotNull PsiDirectory directory, final boolean withSubdirectories) {
    return new DirectoryScope(directory, withSubdirectories);
  }
public static @NotNull GlobalSearchScope directoryScope(@NotNull PsiDirectory directory, final boolean withSubdirectories)