private static boolean isInProject(@NotNull VirtualFile virtualFile, @NotNull Project project) {
    PsiManager psiManager = PsiManager.getInstance(project);
    PsiDirectory psiDirectory = psiManager.findDirectory(virtualFile);
    if (psiDirectory == null) return false;
    if (!psiManager.isInProject(psiDirectory)) return false;
    return true;
  }
private static boolean isInProject(@NotNull VirtualFile virtualFile, @NotNull Project project)