From: Ben Soares Date: Wed, 11 Sep 2024 15:51:49 +0000 (+0100) Subject: JAL-4460 Don't add .aln for an 'All known formats...' filename X-Git-Tag: Release_2_11_4_0~9^2~1^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=983bf691df367eef3dff83ec809bb236f7e021af;p=jalview.git JAL-4460 Don't add .aln for an 'All known formats...' filename --- diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index 588a2b8..ee39458 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -284,6 +284,7 @@ public class JalviewFileChooser extends JFileChooser JalviewFileFilter alljvf = new JalviewFileFilter( allExtensions.toArray(new String[] {}), MessageManager.getString("label.all_known_alignment_files")); + alljvf.setMultiFormat(true); alljvf.setExtensionListInDescription(false); addChoosableFileFilter(alljvf); @@ -510,7 +511,7 @@ public class JalviewFileChooser extends JFileChooser { JalviewFileFilter jvf = (JalviewFileFilter) getFileFilter(); - if (!jvf.accept(selectedFile)) + if (!jvf.accept(selectedFile) && !jvf.isMultiFormat()) { String withExtension = getSelectedFile().getName() + "." + jvf.getAcceptableExtension(); diff --git a/src/jalview/io/JalviewFileFilter.java b/src/jalview/io/JalviewFileFilter.java index 5e9a242..c24cbd4 100755 --- a/src/jalview/io/JalviewFileFilter.java +++ b/src/jalview/io/JalviewFileFilter.java @@ -42,6 +42,8 @@ public class JalviewFileFilter extends FileFilter private boolean useExtensionsInDescription = true; + private boolean multiFormat = false; + private JalviewFileChooser parentJFC = null; public JalviewFileFilter(String extension, String description) @@ -211,4 +213,13 @@ public class JalviewFileFilter extends FileFilter this.parentJFC = p; } + protected boolean isMultiFormat() + { + return multiFormat; + } + + protected void setMultiFormat(boolean b) + { + multiFormat = b; + } }