Move management of destroyedItemUris to Workspace model

This commit is contained in:
Nathan Sobo
2014-01-13 18:26:00 -07:00
parent a8ddc530a2
commit 27c03ae3f3
2 changed files with 12 additions and 15 deletions

View File

@@ -1,3 +1,4 @@
{remove} = require 'underscore-plus'
{Model} = require 'theorist'
Serializable = require 'serializable'
PaneContainer = require './pane-container'
@@ -10,6 +11,7 @@ class Workspace extends Model
@properties
paneContainer: -> new PaneContainer
fullScreen: false
destroyedItemUris: -> []
constructor: ->
super
@@ -23,5 +25,12 @@ class Workspace extends Model
paneContainer: @paneContainer.serialize()
fullScreen: atom.isFullScreen()
# Private: Removes the item's uri from the list of potential items to reopen.
itemOpened: (item) ->
if uri = item.getUri?()
remove(@destroyedItemUris, uri)
# Private: Adds the destroyed item's uri to the list of items to reopen.
onPaneItemDestroyed: (item) =>
@emit 'pane-item-destroyed', item
if uri = item.getUri?()
@destroyedItemUris.push(uri)