       catch error
         console.warn "Error parsing ignore pattern (#{ignoredName}): #{error.message}"
 
-  updateRoot: (expandedEntries={}) ->
+  updateRoots: (expandedEntries={}) ->
     for root in @roots
       root.directory.destroy()
       root.remove()

      @disposables.add atom.styles.onDidRemoveStyleElement(onStylesheetsChanged)
      @disposables.add atom.styles.onDidUpdateStyleElement(onStylesheetsChanged)

    @updateRoot(state.directoryExpansionStates)
    @selectEntry(root) for root in @roots

    @selectEntryForPath(state.selectedPath) if state.selectedPath
    @focusAfterAttach = state.hasFocus

    @disposables.add atom.workspace.onDidChangeActivePaneItem =>
      @selectActiveFile()
    @disposables.add atom.project.onDidChangePaths =>
      @updateRoots()
    @disposables.add atom.config.onDidChange 'tree-view.hideVcsIgnoredFiles', =>
      @updateRoots()
    @disposables.add atom.config.onDidChange 'tree-view.hideIgnoredNames', =>
      @updateRoots()
    @disposables.add atom.config.onDidChange 'core.ignoredNames', =>
      @updateRoots() if atom.config.get('tree-view.hideIgnoredNames')
    @disposables.add atom.config.onDidChange 'tree-view.showOnRightSide', ({newValue}) =>
      @onSideToggled(newValue)
    @disposables.add atom.config.onDidChange 'tree-view.sortFoldersBeforeFiles', =>
      @updateRoots()

  toggle: ->
    if @isVisible()
