}
return null;
}
+
+ File ourselectedFile = null;
+
+ @Override
+ public File getSelectedFile()
+ {
+ File selfile = super.getSelectedFile();
+ if (selfile == null && ourselectedFile != null)
+ {
+ return ourselectedFile;
+ }
+ return selfile;
+ }
Component saveparent;
RunResponse overwriteCheck = new RunResponse(
@Override
public void run()
{
+ ourselectedFile = getSelectedFile();
+
+ if (getSelectedFile() == null)
+ {
+ // Workaround for Java 9,10 on OSX - no selected file, but there is a
+ // filename typed in
+ try
+ {
+ String filename = ((BasicFileChooserUI) getUI()).getFileName();
+ if (filename != null && filename.length() > 0)
+ {
+ ourselectedFile = new File(getCurrentDirectory(), filename);
+ }
+ } catch (Throwable x)
+ {
+ System.err.println(
+ "Unexpected exception when trying to get filename.");
+ x.printStackTrace();
+ }
+ }
+ if (ourselectedFile == null)
+ {
+ returned = new Response(JalviewFileChooser.CANCEL_OPTION);
+ return;
+ }
// JBP Note - this code was executed regardless of 'SAVE' being pressed
// need to see if there were side effects
if (getFileFilter() instanceof JalviewFileFilter)
}
setDialogType(SAVE_DIALOG);
+
+ // Java 9,10,11 on OSX - clear selected file so name isn't auto populated
+ this.setSelectedFile(null);
+
saveparent = parent;
int value = showDialog(parent, MessageManager.getString("action.save"));