From 983bf691df367eef3dff83ec809bb236f7e021af Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 11 Sep 2024 16:51:49 +0100 Subject: [PATCH] JAL-4460 Don't add .aln for an 'All known formats...' filename --- src/jalview/io/JalviewFileChooser.java | 3 ++- src/jalview/io/JalviewFileFilter.java | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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; + } } -- 1.7.10.2