private boolean readyToClose() {
   File f;
   if (newFile.isSelected()) {
     if (newNameTf.getText().isEmpty()) {
       if (tableModel.getRowCount() > 0) {
         JOptionPane.showMessageDialog(
             this,
             Localization.lang("You must choose a filename to store journal abbreviations"),
             Localization.lang("Store journal abbreviations"),
             JOptionPane.ERROR_MESSAGE);
         return false;
       } else {
         return true;
       }
     } else {
       f = new File(newNameTf.getText());
       return !f.exists()
           || (JOptionPane.showConfirmDialog(
                   this,
                   Localization.lang("'%0' exists. Overwrite file?", f.getName()),
                   Localization.lang("Store journal abbreviations"),
                   JOptionPane.OK_CANCEL_OPTION)
               == JOptionPane.OK_OPTION);
     }
   }
   return true;
 }
  private void setupUserTable() {
    JournalAbbreviationRepository userAbbr = new JournalAbbreviationRepository();
    String filename = personalFile.getText();
    if (!"".equals(filename) && new File(filename).exists()) {
      try {
        userAbbr.readJournalListFromFile(new File(filename));
      } catch (FileNotFoundException e) {
        LOGGER.warn("Problem reading abbreviation file", e);
      }
    }

    tableModel.setJournals(userAbbr.getAbbreviations());
    userTable = new JTable(tableModel);
    userTable.addMouseListener(tableModel.getMouseListener());
    userPanel.add(new JScrollPane(userTable), BorderLayout.CENTER);
  }
  private void storeSettings() throws FileNotFoundException {
    File f = null;
    if (newFile.isSelected()) {
      if (!newNameTf.getText().isEmpty()) {
        f = new File(newNameTf.getText());
      } // else {
      //    return; // Nothing to do.
      // }
    } else {
      f = new File(personalFile.getText());
    }

    if (f != null) {
      if (!f.exists()) {
        throw new FileNotFoundException(f.getAbsolutePath());
      }
      try (FileWriter fw = new FileWriter(f, false)) {
        for (JournalEntry entry : tableModel.getJournals()) {
          fw.write(entry.name);
          fw.write(" = ");
          fw.write(entry.abbreviation);
          fw.write(Globals.NEWLINE);
        }
      } catch (IOException e) {
        LOGGER.warn("Problem writing abbreviation file", e);
      }
      String filename = f.getPath();
      if ("".equals(filename)) {
        filename = null;
      }
      Globals.prefs.put(JabRefPreferences.PERSONAL_JOURNAL_LIST, filename);
    }

    // Store the list of external files set up:
    List<String> extFiles = new ArrayList<>();
    for (ExternalFileEntry efe : externals) {
      if (!"".equals(efe.getValue())) {
        extFiles.add(efe.getValue());
      }
    }
    Globals.prefs.putStringList(JabRefPreferences.EXTERNAL_JOURNAL_LISTS, extFiles);

    Abbreviations.initializeJournalNames(Globals.prefs);

    // Update the autocompleter for the "journal" field in all base panels,
    // so added journal names are available:
    for (int i = 0; i < frame.getBasePanelCount(); i++) {
      frame.getBasePanelAt(i).getAutoCompleters().addJournalListToAutoCompleter();
    }
  }