code: private ProjectFile handleFileInDirectory(File directory) throws Exception
     {
        List<File> directories = new ArrayList<File>();
        File[] files = directory.listFiles();
  
        if (files != null)
        {
           // Try files first
           for (File file : files)
           {
              if (file.isDirectory())
              {
                 directories.add(file);
              }
              else
              {
                 UniversalProjectReader reader = new UniversalProjectReader();
                 ProjectFile result = reader.read(file);
                 if (result != null)
                 {
                    return result;
                 }
              }
           }
  
           // Haven't found a file we can read? Try the directories.
           for (File file : directories)
           {
              ProjectFile result = handleDirectory(file);
              if (result != null)
              {
                 return result;
              }
           }
        }
        return null;
     }
docs: Given a directory, determine if it  (or any subdirectory) contains a file
  whose format we understand.
  
  @param directory directory to process
  @return ProjectFile instance if we can process anything, or null