 (ns org.micromanager.reloader
   (:use [clojure.java.io :only (file copy)]
         [clojure.data :only (diff)]
-        [org.micromanager.mm :only (load-mm mmc core)]
-        [clojure.pprint :only (pprint)]))
+        [org.micromanager.mm :only (edt load-mm mmc core gui)]
+        [clojure.pprint :only (pprint)])
+  (:import (javax.swing JLabel JWindow)
+           (java.awt Color)))
 
 
 (load-mm (org.micromanager.MMStudioMainFrame/getInstance))

      (startup-device dev (dev-settings-map dev)))))

(defmacro reload-module
  [module & housekeeping]
  `(reload-module-fn ~module (fn [] ~@housekeeping)))

(defn file-dates [path]
  (let [files (.listFiles (file path))]
    (zipmap files (map #(.lastModified %) files))))

(defn changed-file [path old-dates]
  (diff old-dates (file-dates path)))

(defn follow-dir-dates
  "Polls a directory and keeps an up-to-date

  (apply-state-device-labels dev state-labels))

(defn reload-device
  "Reload a single device."
  [dev]
  (let [startup-settings (read-device-startup-settings dev)]
    (core unloadDevice dev)
    (startup-device dev startup-settings)))

(defn reload-module-fn
  "Function version of reload-module macro."
  [module housekeeping-fn]
  (let [devs (doall (get (devices-in-each-module) module))
        dev-settings-map (zipmap devs
