/**
   * Retrieves the absolute path of the file picked in the file chooser.
   *
   * @return The absolute path of the file to open.
   */
  private String getFileUrlFromUser() {
    JFileChooser fc = new JFileChooser();
    FPFileFilter fpFilter = new FPFileFilter();
    fpFilter.addExtension("XML");
    fpFilter.addExtension("DATA");
    fpFilter.setDescription("XML & Flat data files");
    fc.addChoosableFileFilter(fpFilter);

    int result = fc.showOpenDialog(projectPanel);
    return (result == JFileChooser.APPROVE_OPTION ? fc.getSelectedFile().toURI().toString() : null);
  }
 /**
  * Loads a file from the system and returns an instanciated {@link Project} object if the
  * operation was successfully executed. This method handles both flat data file types (<code>
  * *.data</code>) and XML files (<code>*.xml</code>).
  *
  * @param aFile The file to load
  * @return A project found in the loaded file
  * @throws IOException If the file could not loaded properly.
  * @throws ParseException If the content of the file could not be properly parsed.
  */
 public Project load(File aFile) throws IllegalArgumentException, IOException, ParseException {
   String extension = FPFileFilter.getExtension(aFile);
   if (extension != null && extension.toLowerCase().equals(XML_FILE_EXTENSION)) {
     return loadXOMFile(aFile);
   } else if (extension != null && extension.toLowerCase().equals(DATA_FILE_EXTENSION)) {
     return loadFlatFile(aFile);
   } else {
     throw new IllegalArgumentException(
         "Invalid filetype! The extension (" + extension + ") is not supported.");
   }
 }
 /**
  * A {@link Project} is stored to a proper file format based on it's storage representation. If
  * the extension indicates it is to be stored as (<code>*.xml</code>), the representation will be
  * in XML. Otherwise, the {@link Project} is stored in a flat file format (<code>*.data</code>).
  *
  * @param aProject The project to save.
  * @param aFile The file to save the project to.
  * @throws IOException If file I/O in some way fails
  */
 public void save(Project aProject, File aFile) throws IOException {
   String extension = FPFileFilter.getExtension(aFile);
   if (extension != null && extension.equals("data")) {
     saveFlatFile(aProject, aFile);
   } else if (extension != null && extension.equals("xml")) {
     saveXmlFile(aProject, aFile);
   } else {
     throw new IllegalArgumentException(
         "The file type (" + extension + ") is not supported as a storage format!");
   }
 }