private void realSave(
     Project project,
     ProjectSerializer serializer,
     boolean forceShowDialog,
     boolean cacheFileName,
     String title,
     String extensionDescription,
     String extension) {
   if (project == null) {
     JOptionPane.showMessageDialog(null, "Please select a project!");
     return;
   }
   File f = (File) project.getValue("file");
   if (forceShowDialog || f == null) {
     f =
         getFileChooser(title, extensionDescription, extension, project.getName())
             .showSaveDialog(null);
     if (f == null) {
       return;
     }
   }
   try (FileOutputStream out = new FileOutputStream(f)) {
     serializer.toStream(project, out);
     if (cacheFileName) {
       project.setValue("file", f);
     }
   } catch (Exception e) {
     mDialogsHelper.showException(e);
   }
 }
 public Project open(
     ProjectSerializer serializer, String title, String extensionDescription, String extension) {
   File file = getFileChooser(title, extensionDescription, extension, null).showOpenDialog(null);
   if (file == null) {
     return null;
   }
   Project p = null;
   try (FileInputStream in = new FileInputStream(file)) {
     p = serializer.parseStream(in);
     p.setValue("file", file);
     if (p.getName() == null || p.getName().trim().isEmpty()) {
       p.setName("Untitled");
     }
   } catch (Exception e) {
     mDialogsHelper.showException(e);
   }
   return p;
 }