From 8003658d5abb83eb5d42a1a7b957b0686c852a26 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 11 Sep 2024 17:24:33 +0100 Subject: [PATCH] JAL-4460 In save as, set format from file extension if a multi-format file filter is selected --- src/jalview/io/JalviewFileChooser.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index ee39458..9a0640c 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -518,6 +518,18 @@ public class JalviewFileChooser extends JFileChooser selectedFile = (new File(getCurrentDirectory(), withExtension)); setSelectedFile(selectedFile); } + else if (jvf.isMultiFormat() && jvf.accept(selectedFile)) + { + // if a multiFormat filter is selected, with an acceptable file + // extension, see if we can set the format from the file extension + for (FileFilter jff : this.getChoosableFileFilters()) + { + if (jff.accept(selectedFile)) + { + this.setFileFilter(jff); + } + } + } } if (selectedFile.exists()) -- 1.7.10.2