mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Move PaneContainerView::saveAll to the model
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Serializable = require 'serializable'
|
||||
Delegator = require 'delegato'
|
||||
{$, View} = require './space-pen-extensions'
|
||||
PaneView = require './pane-view'
|
||||
PaneContainer = require './pane-container'
|
||||
@@ -8,6 +9,7 @@ module.exports =
|
||||
class PaneContainerView extends View
|
||||
atom.deserializers.add(this)
|
||||
Serializable.includeInto(this)
|
||||
Delegator.includeInto(this)
|
||||
|
||||
@deserialize: (state) ->
|
||||
new this(PaneContainer.deserialize(state.model))
|
||||
@@ -62,9 +64,6 @@ class PaneContainerView extends View
|
||||
@setRoot(null)
|
||||
@trigger 'pane:removed', [child] if child instanceof PaneView
|
||||
|
||||
saveAll: ->
|
||||
pane.saveItems() for pane in @getPanes()
|
||||
|
||||
confirmClose: ->
|
||||
saved = true
|
||||
for pane in @getPanes()
|
||||
|
||||
@@ -40,6 +40,9 @@ class PaneContainer extends Model
|
||||
paneForUri: (uri) ->
|
||||
find @getPanes(), (pane) -> pane.itemForUri(uri)?
|
||||
|
||||
saveAll: ->
|
||||
pane.saveItems() for pane in @getPanes()
|
||||
|
||||
activateNextPane: ->
|
||||
panes = @getPanes()
|
||||
if panes.length > 1
|
||||
|
||||
@@ -46,7 +46,7 @@ class WorkspaceView extends View
|
||||
|
||||
@delegatesProperty 'fullScreen', 'destroyedItemUris', toProperty: 'model'
|
||||
@delegatesMethods 'open', 'openSync', 'openSingletonSync', 'reopenItemSync',
|
||||
'saveActivePaneItem', 'saveActivePaneItemAs', toProperty: 'model'
|
||||
'saveActivePaneItem', 'saveActivePaneItemAs', 'saveAll', toProperty: 'model'
|
||||
|
||||
@version: 4
|
||||
|
||||
@@ -231,10 +231,6 @@ class WorkspaceView extends View
|
||||
# FIXME: Difference between active and focused pane?
|
||||
getFocusedPane: -> @panes.getFocusedPane()
|
||||
|
||||
# Public: Saves all of the open items within panes.
|
||||
saveAll: ->
|
||||
@panes.saveAll()
|
||||
|
||||
# Public: Fires a callback on each open {PaneView}.
|
||||
eachPane: (callback) ->
|
||||
@panes.eachPane(callback)
|
||||
|
||||
@@ -12,7 +12,7 @@ class Workspace extends Model
|
||||
Serializable.includeInto(this)
|
||||
|
||||
@delegatesProperty 'activePane', 'activePaneItem', toProperty: 'paneContainer'
|
||||
@delegatesMethod 'getPanes', toProperty: 'paneContainer'
|
||||
@delegatesMethod 'getPanes', 'saveAll', toProperty: 'paneContainer'
|
||||
|
||||
@properties
|
||||
paneContainer: -> new PaneContainer
|
||||
|
||||
Reference in New Issue
Block a user