From 35a66e003e7fc9ef05d963a0a310d279b4e1e161 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 21 Apr 2014 18:13:56 +0100 Subject: [PATCH] fix for JAL-1438 --- src/jalview/io/JalviewFileChooser.java | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index e9651ad..46ecf41 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -215,22 +215,24 @@ public class JalviewFileChooser extends JFileChooser return ret; } - void recentListSelectionChanged(String selection) + void recentListSelectionChanged(Object selection) { setSelectedFile(null); - - File file = new File(selection); - if (getFileFilter() instanceof JalviewFileFilter) + if (selection != null) { - JalviewFileFilter jvf = (JalviewFileFilter) this.getFileFilter(); - - if (!jvf.accept(file)) + File file = new File((String) selection); + if (getFileFilter() instanceof JalviewFileFilter) { - setFileFilter(getChoosableFileFilters()[0]); + JalviewFileFilter jvf = (JalviewFileFilter) this.getFileFilter(); + + if (!jvf.accept(file)) + { + setFileFilter(getChoosableFileFilters()[0]); + } } - } - setSelectedFile(file); + setSelectedFile(file); + } } class RecentlyOpened extends JPanel @@ -263,7 +265,7 @@ public class JalviewFileChooser extends JFileChooser { public void mousePressed(MouseEvent evt) { - recentListSelectionChanged(list.getSelectedValue().toString()); + recentListSelectionChanged(list.getSelectedValue()); } }); -- 1.7.10.2