X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FJalviewFileChooser.java;h=cb476106ab6aa2807734189a14f36bc20f02cdf6;hb=d4271d32477e99e9fbbfa5db3e11f1b79324e60d;hp=52182552317ecf9f27d4ef8e04d54d961e000c55;hpb=c1f5dd54ab8caa7e76ca50f9c3a85f2731b66862;p=jalview.git diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index 5218255..cb47610 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -45,6 +45,7 @@ import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JList; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.SpringLayout; @@ -53,6 +54,7 @@ import javax.swing.plaf.basic.BasicFileChooserUI; import jalview.bin.Cache; import jalview.gui.JvOptionPane; +import jalview.util.ChannelProperties; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.util.dialogrunner.DialogRunnerI; @@ -489,10 +491,13 @@ public class JalviewFileChooser extends JFileChooser if (selectedFile.exists()) { - int confirm = JvOptionPane.showConfirmDialog(this, - MessageManager.getString("label.overwrite_existing_file"), - MessageManager.getString("label.file_already_exists"), - JvOptionPane.YES_NO_OPTION); + int confirm = Cache.getDefault("CONFIRM_OVERWRITE_FILE", true) + ? JvOptionPane.showConfirmDialog(this, + MessageManager + .getString("label.overwrite_existing_file"), + MessageManager.getString("label.file_already_exists"), + JvOptionPane.YES_NO_OPTION) + : JOptionPane.YES_OPTION; if (confirm != JvOptionPane.YES_OPTION) { @@ -597,6 +602,24 @@ public class JalviewFileChooser extends JFileChooser } + /* + @Override + public JalviewFileChooser setResponseHandler(Object response, + Runnable action) + { + callbacks.put(response, new Callable() + { + @Override + public Void call() + { + action.run(); + return null; + } + }); + return this; + } + */ + @Override public DialogRunnerI setResponseHandler(Object response, Runnable action) { @@ -617,7 +640,13 @@ public class JalviewFileChooser extends JFileChooser Runnable action = callbacks.get(response); if (action != null) { - action.run(); + try + { + action.run(); + } catch (Exception e) + { + e.printStackTrace(); + } } } @@ -647,7 +676,7 @@ public class JalviewFileChooser extends JFileChooser protected JDialog createDialog(Component parent) throws HeadlessException { JDialog dialog = super.createDialog(parent); - dialog.setIconImage(null); + dialog.setIconImages(ChannelProperties.getIconList()); return dialog; }