Merge branch 'feature/JAL-3169cancelOverwrite' into develop
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 28 Feb 2019 15:51:18 +0000 (15:51 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 28 Feb 2019 15:51:18 +0000 (15:51 +0000)
Conflicts:
src/jalview/io/JalviewFileChooser.java

1  2 
src/jalview/io/JalviewFileChooser.java

@@@ -48,7 -44,8 +48,9 @@@ import javax.swing.JList
  import javax.swing.JPanel;
  import javax.swing.JScrollPane;
  import javax.swing.SpringLayout;
+ import javax.swing.SwingUtilities;
+ import javax.swing.border.TitledBorder;
 +import javax.swing.filechooser.FileFilter;
  import javax.swing.plaf.basic.BasicFileChooserUI;
  
  /**
@@@ -431,26 -358,20 +452,20 @@@ public class JalviewFileChooser extend
        }
      }
  
-     // TODO: ENSURE THAT FILES SAVED WITH A ':' IN THE NAME ARE REFUSED AND THE
-     // USER PROMPTED FOR A NEW FILENAME.
-     // DO NOT need to confirm file overwrite if using backup files (the files
-     // aren't being overwritten!)
-     if ((ret == JalviewFileChooser.APPROVE_OPTION)
-             && ourselectedFile.exists() && (!BackupFiles.getEnabled()))
+     if (ourselectedFile.exists())
 -      {
 -        int confirm = JvOptionPane.showConfirmDialog(this,
 -                MessageManager.getString("label.overwrite_existing_file"),
 -                MessageManager.getString("label.file_already_exists"),
 -                JvOptionPane.YES_NO_OPTION);
 +    {
-       int confirm = JvOptionPane.showConfirmDialog(parent,
++      int confirm = JvOptionPane.showConfirmDialog(this,
 +              MessageManager.getString("label.overwrite_existing_file"),
 +              MessageManager.getString("label.file_already_exists"),
 +              JvOptionPane.YES_NO_OPTION);
  
 -        if (confirm != JvOptionPane.YES_OPTION)
 -        {
 -          return;
 -        }
 +      if (confirm != JvOptionPane.YES_OPTION)
 +      {
-         ret = JalviewFileChooser.CANCEL_OPTION;
++        return;
        }
 +    }
  
-     return ret;
+     super.approveSelection();
    }
  
    void recentListSelectionChanged(Object selection)