Merge branch 'subtree'
[fanfix.git] / src / jexer / TFileOpenBox.java
index ac23cfd13557e58100bee15a9a878ecb55157b6d..a2cc0cf7e48f2e68efebfefec3c66d14775796c9 100644 (file)
@@ -47,7 +47,7 @@ import static jexer.TKeypress.*;
  *
  * <pre>
  * {@code
- *     filename = application.fileOpenBox("/path/to/file.ext",
+ *     filename = fileOpenBox("/path/to/file.ext",
  *         TFileOpenBox.Type.OPEN);
  *     if (filename != null) {
  *         ... the user selected a file, go open it ...
@@ -185,6 +185,7 @@ public class TFileOpenBox extends TWindow {
                     File selectedDir = ((TDirectoryTreeItem) item).getFile();
                     try {
                         directoryList.setPath(selectedDir.getCanonicalPath());
+                        entryField.setText(selectedDir.getCanonicalPath());
                         if (type == Type.OPEN) {
                             openButton.setEnabled(false);
                         }
@@ -391,7 +392,7 @@ public class TFileOpenBox extends TWindow {
     private void checkFilename(final String newFilename) throws IOException {
         File newFile = new File(newFilename);
         if (newFile.exists()) {
-            if (newFile.isFile()) {
+            if (newFile.isFile() || (type == Type.SELECT)) {
                 filename = newFilename;
                 getApplication().closeWindow(this);
                 return;