code: public void saveFile(File file, String type)
     {
        try
        {
           Class<? extends ProjectWriter> fileClass = WRITER_MAP.get(type);
           if (fileClass == null)
           {
              throw new IllegalArgumentException("Cannot write files of type: " + type);
           }
  
           ProjectWriter writer = fileClass.newInstance();
           writer.write(m_projectFile, file);
        }
  
        catch (Exception ex)
        {
           throw new RuntimeException(ex);
        }
     }
docs: Save the current file as the given type.
  
  @param file target file
  @param type file type