 {$, View} = require './space-pen-extensions'
 Delegator = require 'delegato'
 {deprecate} = require 'grim'
+{CompositeDisposable} = require 'event-kit'
 PropertyAccessors = require 'property-accessors'
 
 Pane = require './pane'

    @closest('.panes').view()

  beforeRemove: ->
    @model.destroy() unless @model.isDestroyed()

  remove: (selector, keepData) ->

    @handleEvents()

  handleEvents: ->
    @disposables.add @model.onDidChangeActiveItem(@onActiveItemChanged)
    @disposables.add @model.onDidAddItem(@onItemAdded)
    @disposables.add @model.onDidRemoveItem(@onItemRemoved)
    @disposables.add @model.onDidMoveItem(@onItemMoved)
    @disposables.add @model.onWillDestroyItem(@onBeforeItemDestroyed)
    @disposables.add @model.onDidActivate(@onActivated)
    @disposables.add @model.onDidChangeActive(@onActiveStatusChanged)

    @subscribe this, 'focusin', => @model.focus()
    @subscribe this, 'focusout', => @model.blur()
