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


(def repl-outputstream
  (atom nil))

;;


    (make-project-window proj)
    #_(println "Switching project:" proj)))

#_(defn make-editor-window
     "Make an editor window."
     [params]
     (let [
           textArea (RSyntaxTextArea. 42 115)
           ;textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
           ;textArea.setCodeFoldingEnabled(true);      
           sp (RTextScrollPane. textArea)
           a-new (action :handler a-new :name "New" :tip "Create a new file.")
           a-open (action :handler a-open :name "Open" :tip "Open a file")
           a-save (action :handler a-save :name "Save" :tip "Save the current file.")
           a-exit (action :handler a-exit :name "Exit" :tip "Exit the editor.")
           a-copy (action :handler a-copy :name "Copy" :tip "Copy selected text to the clipboard.")
           a-paste (action :handler a-paste :name "Paste" :tip "Paste text from the clipboard.")
           a-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
           a-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
           a-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")
           a-projects (map #(action :handler (make-a-active-project %)
                                    :name (str (:group %) "/" (:name %))
                                    :tip (str (:group %) "/" (:name %)))
                           (:projects @current-profile))
           menus (menubar
                   :items [(menu :text "File" :items [a-new a-open a-save a-save-as a-exit])
                           (menu :text "Edit" :items [a-copy a-cut a-paste])
                           (menu :text "Run" :items [a-eval-file])
                           (menu :text "Projects" :items (into [] a-projects))
                           (menu :text "Git" :items [])
                           #_(menu :text "My Project" :items [(action :handler (fn [e] nil) :name "Open a project")
                                                             (action :handler (fn [e] nil) :name "in")
                                                             (action :handler (fn [e] nil) :name "projects menu")])])
           f (frame :title "Brevis - Editor Window" :menubar menus)]
       (.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
        :scroll-pane sp
        :menus menus}))

(defn make-editor-window
     "Make an editor window."
     [params]
     (let [
           textArea (RSyntaxTextArea. 42 115)
           ;textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
           ;textArea.setCodeFoldingEnabled(true);      
           sp (RTextScrollPane. textArea)
           a-new (action :handler a-new :name "New" :tip "Create a new file.")
           a-open (action :handler a-open :name "Open" :tip "Open a file")
           a-save (action :handler a-save :name "Save" :tip "Save the current file.")
           a-exit (action :handler a-exit :name "Exit" :tip "Exit the editor.")
           a-copy (action :handler a-copy :name "Copy" :tip "Copy selected text to the clipboard.")
           a-paste (action :handler a-paste :name "Paste" :tip "Paste text from the clipboard.")
           a-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
           a-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
           a-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")
           a-projects (map #(action :handler (make-a-active-project %)
                                    :name (str (:group %) "/" (:name %))
                                    :tip (str (:group %) "/" (:name %)))
                           (:projects @current-profile))
           menus (menubar
                   :items [(menu :text "File" :items [a-new a-open a-save a-save-as a-exit])
                           (menu :text "Edit" :items [a-copy a-cut a-paste])
                           (menu :text "Run" :items [a-eval-file])
                           (menu :text "Projects" :items (into [] a-projects))
                           (menu :text "Git" :items [])
                           #_(menu :text "My Project" :items [(action :handler (fn [e] nil) :name "Open a project")
                                                             (action :handler (fn [e] nil) :name "in")
                                                             (action :handler (fn [e] nil) :name "projects menu")])])
           ;f (frame :title "Brevis - Editor Window" :menubar menus)
           ]
       (.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
        :scroll-pane sp
        :menus menus}))

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