private FileLocation determineFileLocation(File file, Collection<File> roots, Collection<File> excluded) {
    if (roots.isEmpty() && excluded.isEmpty()) {
      return FileLocation.NOT_IN_PROJECT; // optimization
    }
    File current = file;
    while (current != null) {
      if (excluded.contains(current)) {
        return FileLocation.EXCLUDED;
      }
      FileTypeAssocTable<Boolean> table = myExcludeFromContentRootTables.get(current);
      if (table != null && isExcludedByPattern(file, current, table)) {
        return FileLocation.EXCLUDED;
      }
      if (roots.contains(current)) {
        return FileLocation.IN_CONTENT;
      }
      current = FileUtilRt.getParentFile(current);
    }
    return FileLocation.NOT_IN_PROJECT;
  }
private FileLocation determineFileLocation(File file, Collection<File> roots, Collection<File> excluded)