+ if (allowBackupFiles)
+ {
+ JPanel multi = new JPanel();
+ multi.setLayout(new BoxLayout(multi, BoxLayout.PAGE_AXIS));
+ if (backupfilesCheckBox == null)
+ {
+ try
+ {
+ includeBackupFiles = Boolean.parseBoolean(
+ Cache.getProperty(BackupFiles.NS + "_FC_INCLUDE"));
+ } catch (Exception e)
+ {
+ includeBackupFiles = false;
+ }
+ backupfilesCheckBox = new JCheckBox(
+ MessageManager.getString("label.include_backup_files"),
+ includeBackupFiles);
+ backupfilesCheckBox.setAlignmentX(Component.CENTER_ALIGNMENT);
+ JalviewFileChooser jfc = this;
+ backupfilesCheckBox.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ includeBackupFiles = backupfilesCheckBox.isSelected();
+ Cache.setProperty(BackupFiles.NS + "_FC_INCLUDE",
+ String.valueOf(includeBackupFiles));
+
+ FileFilter f = jfc.getFileFilter();
+ // deselect the selected file if it's no longer choosable
+ File selectedFile = jfc.getSelectedFile();
+ if (selectedFile != null && !f.accept(selectedFile))
+ {
+ jfc.setSelectedFile(null);
+ }
+ // fake the OK button changing (to force it to upate)
+ String s = jfc.getApproveButtonText();
+ jfc.firePropertyChange(APPROVE_BUTTON_TEXT_CHANGED_PROPERTY,
+ null, s);
+ // fake the file filter changing (its behaviour actually has)
+ jfc.firePropertyChange(FILE_FILTER_CHANGED_PROPERTY, null, f);
+
+ jfc.rescanCurrentDirectory();
+ jfc.revalidate();
+ jfc.repaint();
+ }
+ });
+ }
+ multi.add(new RecentlyOpened());
+ multi.add(backupfilesCheckBox);
+ setAccessory(multi);
+ }
+ else
+ {
+ // set includeBackupFiles=false to avoid other file choosers from picking
+ // up backup files (Just In Case)
+ includeBackupFiles = false;
+ setAccessory(new RecentlyOpened());
+ }