public void openSpreadsheet(Path file) {
   try {
     setSpreadsheet(mPersistenceManager.readSpreadsheetFromFile(file));
     setCurrentFile(file);
   } catch (IOException e) {
     JOptionPane.showMessageDialog(
         this, e.toString(), "Failed to open document", JOptionPane.ERROR_MESSAGE);
   }
 }
 private boolean saveToDisk(boolean mustChooseFile) {
   Path fileToSave = mustChooseFile ? null : mCurrentFile;
   if (fileToSave == null) {
     fileToSave = chooseFile(JFileChooser.SAVE_DIALOG);
   }
   if (fileToSave != null) {
     try {
       mPersistenceManager.writeSpreadsheetToFile(mSpreadsheet, fileToSave);
       setCurrentFile(fileToSave);
       mHasEdits = false;
       return true;
     } catch (IOException ex) {
       JOptionPane.showMessageDialog(
           this, ex.toString(), "Failed to save document", JOptionPane.ERROR_MESSAGE);
     }
   }
   return false;
 }