     @restoreFocus() if filterEditorViewFocused
     @cancelling = false
     clearTimeout(@scheduleTimeout)
+
+  # Public: Store the currently focused element. This element will be given
+  # back focus when {::cancel} is called.
+  storeFocusedElement: ->
+    @previouslyFocusedElement = $(':focus')
+
+  ###
+  Section: Private
+  ###
+
+  selectPreviousItemView: ->
+    view = @getSelectedItemView().prev()
+    view = @list.find('li:last') unless view.length
+    @selectItemView(view)
+
+  selectNextItemView: ->
+    view = @getSelectedItemView().next()
+    view = @list.find('li:first') unless view.length
+    @selectItemView(view)
+
+  selectItemView: (view) ->
+    return unless view.length
+    @list.find('.selected').removeClass('selected')
+    view.addClass('selected')
+    @scrollToItemView(view)
+
+  scrollToItemView: (view) ->
+    scrollTop = @list.scrollTop()
+    desiredTop = view.position().top + scrollTop
+    desiredBottom = desiredTop + view.outerHeight()
+
+    if desiredTop < scrollTop
+      @list.scrollTop(desiredTop)
+    else if desiredBottom > @list.scrollBottom()
+      @list.scrollBottom(desiredBottom)
+
+  restoreFocus: ->
+    if @previouslyFocusedElement?.isOnDom()
+      @previouslyFocusedElement.focus()
+    else
+      atom.workspaceView.focus()
+
+  cancelled: ->
+    @filterEditorView.getEditor().setText('')
+
+  getSelectedItemView: ->
+    @list.find('li.selected')
+
+  confirmSelection: ->
+    item = @getSelectedItem()
+    if item?
+      @confirmed(item)
+    else
+      @cancel()
+
+  schedulePopulateList: ->
+    clearTimeout(@scheduleTimeout)
+    populateCallback = =>
+      @populateList() if @isOnDom()
+    @scheduleTimeout = setTimeout(populateCallback,  @inputThrottle)

  # Returns a {String} message (default: 'No matches found').
  getEmptyMessage: (itemCount, filteredItemCount) -> 'No matches found'

  # Public: Set the maximum numbers of items to display in the list.
  #
  # * `maxItems` The maximum {Number} of items to display.
  setMaxItems: (@maxItems) ->

  selectPreviousItemView: ->
    view = @getSelectedItemView().prev()
    view = @list.find('li:last') unless view.length
    @selectItemView(view)

  selectNextItemView: ->
    view = @getSelectedItemView().next()
    view = @list.find('li:first') unless view.length
    @selectItemView(view)

  selectItemView: (view) ->
    return unless view.length
    @list.find('.selected').removeClass('selected')
    view.addClass('selected')
    @scrollToItemView(view)

  scrollToItemView: (view) ->
    scrollTop = @list.scrollTop()
    desiredTop = view.position().top + scrollTop
    desiredBottom = desiredTop + view.outerHeight()

    if desiredTop < scrollTop
      @list.scrollTop(desiredTop)
    else if desiredBottom > @list.scrollBottom()
      @list.scrollBottom(desiredBottom)

  getSelectedItemView: ->
    @list.find('li.selected')

  # Public: Get the model item that is currently selected in the list view.
  #
  # Returns a model item.
  getSelectedItem: ->
    @getSelectedItemView().data('select-list-item')

  confirmSelection: ->
    item = @getSelectedItem()
    if item?
      @confirmed(item)
    else
      @cancel()

  # Public: Create a view for the given model item.
  #
  # This method must be overridden by subclasses.
  #
  # This is called when the item is about to appended to the list view.
  #
  # * `item` The model item being rendered. This will always be one of the items
  #   previously passed to {::setItems}.
  #
  # Returns a String of HTML, DOM element, jQuery object, or View.
  viewForItem: (item) ->
    throw new Error("Subclass must implement a viewForItem(item) method")

  # Public: Callback function for when an item is selected.
  #
  # This method must be overridden by subclasses.
  #
  # * `item` The selected model item. This will always be one of the items
  #   previously passed to {::setItems}.
  #
  # Returns a DOM element, jQuery object, or {View}.
  confirmed: (item) ->
    throw new Error("Subclass must implement a confirmed(item) method")

  # Public: Get the property name to use when filtering items.
  #
  # This method may be overridden by classes to allow fuzzy filtering based
  # on a specific property of the item objects.
  #
  # For example if the objects you pass to {::setItems} are of the type
  # `{"id": 3, "name": "Atom"}` then you would return `"name"` from this method
  # to fuzzy filter by that property when text is entered into this view's
  # editor.
  #
  # Returns the property name to fuzzy filter by.
  getFilterKey: ->

  # Public: Focus the fuzzy filter editor view.
  focusFilterEditor: ->
    @filterEditorView.focus()

  # Public: Store the currently focused element. This element will be given
  # back focus when {::cancel} is called.
  storeFocusedElement: ->
    @previouslyFocusedElement = $(':focus')

  restoreFocus: ->
    if @previouslyFocusedElement?.isOnDom()
      @previouslyFocusedElement.focus()
    else
      atom.workspaceView.focus()

  cancelled: ->
    @filterEditorView.getEditor().setText('')

  # Public: Cancel and close this select list view.
  #

      @confirmSelection() if $(e.target).closest('li').hasClass('selected')
      e.preventDefault()

  ###
  Section: Methods that must be overridden
  ###

  # Public: Create a view for the given model item.
  #
  # This method must be overridden by subclasses.
  #
  # This is called when the item is about to appended to the list view.
  #
  # * `item` The model item being rendered. This will always be one of the items
  #   previously passed to {::setItems}.
  #
  # Returns a String of HTML, DOM element, jQuery object, or View.
  viewForItem: (item) ->
    throw new Error("Subclass must implement a viewForItem(item) method")

  # Public: Callback function for when an item is selected.
  #
  # This method must be overridden by subclasses.
  #
  # * `item` The selected model item. This will always be one of the items
  #   previously passed to {::setItems}.
  #
  # Returns a DOM element, jQuery object, or {View}.
  confirmed: (item) ->
    throw new Error("Subclass must implement a confirmed(item) method")

  ###
  Section: Managing the list of items
  ###

  # Public: Set the array of items to display in the list.
  #
