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 ) ; } }
Save the current file as the given type .