From: Ben Soares Date: Wed, 11 Sep 2024 16:24:33 +0000 (+0100) Subject: JAL-4460 In save as, set format from file extension if a multi-format file filter... X-Git-Tag: Release_2_11_4_0~9^2~1^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8003658d5abb83eb5d42a1a7b957b0686c852a26;p=jalview.git JAL-4460 In save as, set format from file extension if a multi-format file filter is selected --- 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())