          :widget root
          :table table
          :control (get-control table)
+         :context (ref nil)
+
+         :associate-context
+         (fn-doc "Associates a context with the widget object and implicitly
+  updates the control
+
+  Parameters:
+    ectx      _editable context"
+           [ectx]
+           (let [ ctx (if (editable-context? ectx) ectx 
+                       (make-editable-context ectx))
+                  ctx-ref (@self :context)
+                  old-ctx @ctx-ref]
+             (do
+               (dosync-wait (ref-set ctx-ref nil))
+               (if (not (nil? old-ctx)) (!! old-ctx :remove-widget- @self))
+               (!! ctx :add-widget- @self))
+               (dosync-wait (ref-set ctx-ref ctx))))
+
 
          }
 

   editable context structure.

  Parameters:
    ctx     _context or editable context"
  ([ctx]
    (let [editable-ctx 
           {:editable-context 1
           :context (ref (get-context ctx))
           :associated-widgets (ref [])}]
      editable-ctx))
  ([]
    (make-editable-context (make-context [] [] []))))

(def ctx (conexp.fca/make-context ["a" "b" "c"] [1 2 3] [["a" 1] ["c" 3]]))

(def context-pane (ref nil))
(def context-workspace (ref nil))
(def context-workspace-tree (ref nil))
(def +debug+ (ref nil))

(defn update-workspace-tree
  "Updates the data displayed in the current workspace tree

        (do
          (add-tab-with-name-icon-tooltip frame (get-widget pane)
            "Contexts" nil "View and edit contexts")
          (dosync-wait 
            (ref-set context-workspace-tree workspace-tree)
            (ref-set context-pane pane)
            (ref-set +debug+ right)) 
          (+debug-hook+)))) ) )

(defn plug-unload-hook
  "Unloads the context-editor plugin.
