               (if-let [dir (last (selection e))]
                 (let [files (.listFiles dir)]
                   (when (and (.isFile dir)
-                             (or (.contains (.toString dir) "clj") (.contains (.toString dir) "java")))
-                    (reset! current-filename (.toString dir))
-                    (.setText (:text-area (get-editor)) (slurp @current-filename)))
+                             (or (.contains (.toString dir) "clj")
+                                 (.contains (.toString dir) "java")))
+                    #_(reset! current-filename (.toString dir))
+                    #_(.setText (:text-area (get-editor)) (slurp @current-filename))
+                    (open-file (.toString dir)))
                   #_(println dir)
                   (config! (select f [:#current-dir]) :text (.getAbsolutePath dir))
                   (config! (select f [:#status]) :text (format "Ready (%d items)" (count files)))

    [leiningen.core.main :as lein-main])
  (:use [clojure.java.io :only [file]] 
        [clojure.pprint]
        [seesaw core font color graphics chooser mig tree]
        [brevis.ui.profile])
  (:gen-class

           ;f (frame :title "Brevis - Editor Window" :menubar menus)
           ]
       #_(.addKeyListener textArea input-text-keyhandler)
       #_(when (:keybinds params)
          (doseq [keybind (:keybinds params)]
            #_(println keybind)
            (.put (.getInputMap textArea)
              (:keystroke keybind)
              (:action keybind))
            #_(.put (.getActionMap textArea)
               (:name keybind)
               (:action keybind))))
       #_(.setSyntaxEditingStyle textArea (cond (= (:language params) :java) 
                                               (SyntaxConstants/SYNTAX_STYLE_JAVA)
                                               :else
                                               (SyntaxConstants/SYNTAX_STYLE_CLOJURE)))
       #_(.setCodeFoldingEnabled textArea true)      
       #_(display f sp)
       #_(-> f pack! show!)
       #_(.setLocation f 0 0)      
       {;:frame f
        ;:text-area textArea
        :tabbed-panel tabs
        ;:scroll-pane sp
        :menus menus
        }))

(defn get-repl-inputstream
  "Return the input stream for the REPL."
