     isAttr: (attr) ->
       attr.length > 0 and attr[0] != '_'
 
-    node: (text, type, icon, children, open) ->
+    node: (text, obj, icon, children, open) ->
       text: text
-      type: type
+      data: {obj: if obj instanceof HasProperties then {type: obj.type, id: obj.id} else null }
       icon: if icon then "bk-icon-type-#{icon}" else null
       children: children or []
       state: { open: open or false }

    createContextMenu: (node) =>
      data = node.original
      menu = {}

      if data.type != "collection"
        menu["remove"] = {label: "Remove"}

      menu

    renderTree: () ->
      $('<div/>').jstree
        core:
          data: @createTree()
          themes:

    default_view: ObjectExplorerView

    defaults: () ->
      return {
        data_widget: null
      }

  class ObjectExplorers extends Backbone.Collection
    model: ObjectExplorer
