From a35aa77bb8c6b9550a2504e9fca4ba0943b5a34d Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 8 Aug 2014 16:44:35 +0000 Subject: [PATCH] * make sure to apply dialog titles for all providers --- source/net/filebot/UserFiles.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source/net/filebot/UserFiles.java b/source/net/filebot/UserFiles.java index 5fa1a2ec..98a04bab 100644 --- a/source/net/filebot/UserFiles.java +++ b/source/net/filebot/UserFiles.java @@ -72,9 +72,11 @@ public class UserFiles { public enum FileChooser { Swing { + @Override public List showLoadDialogSelectFiles(boolean folderMode, boolean multiSelection, File defaultFile, ExtensionFileFilter filter, String title, Object parent) { JFileChooser chooser = new JFileChooser(); + chooser.setDialogTitle(title); chooser.setMultiSelectionEnabled(multiSelection); chooser.setFileSelectionMode(folderMode && filter == null ? JFileChooser.DIRECTORIES_ONLY : JFileChooser.FILES_AND_DIRECTORIES); chooser.setSelectedFile(defaultFile); @@ -94,6 +96,7 @@ public class UserFiles { @Override public File showSaveDialogSelectFile(boolean folderMode, File defaultFile, String title, Object parent) { JFileChooser chooser = new JFileChooser(); + chooser.setDialogTitle(title); chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(folderMode ? JFileChooser.DIRECTORIES_ONLY : JFileChooser.FILES_AND_DIRECTORIES); chooser.setSelectedFile(defaultFile); @@ -106,15 +109,24 @@ public class UserFiles { }, AWT { + @Override public List showLoadDialogSelectFiles(boolean folderMode, boolean multiSelection, File defaultFile, ExtensionFileFilter filter, String title, Object parent) { FileDialog fileDialog = createFileDialog(parent, title, FileDialog.LOAD, folderMode); + fileDialog.setTitle(title); fileDialog.setMultipleMode(multiSelection); if (filter != null) { fileDialog.setFilenameFilter(filter); } if (defaultFile != null) { - fileDialog.setFile(defaultFile.getPath()); + if (folderMode && defaultFile.isDirectory()) { + fileDialog.setDirectory(defaultFile.getPath()); + } else { + if (defaultFile.getParentFile() != null) { + fileDialog.setDirectory(defaultFile.getParentFile().getPath()); + } + fileDialog.setFile(defaultFile.getName()); + } } fileDialog.setVisible(true); @@ -124,6 +136,7 @@ public class UserFiles { @Override public File showSaveDialogSelectFile(boolean folderMode, File defaultFile, String title, Object parent) { FileDialog fileDialog = createFileDialog(getWindow(parent), title, FileDialog.SAVE, folderMode); + fileDialog.setTitle(title); fileDialog.setMultipleMode(false); if (defaultFile != null) { if (defaultFile.getParentFile() != null) {