mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Serialize project in window state
This commit is contained in:
committed by
Nathan Sobo
parent
89192c2ee2
commit
cd4622fbeb
@@ -15,6 +15,10 @@ BufferedProcess = require 'buffered-process'
|
||||
# of directories and files that you can operate on.
|
||||
module.exports =
|
||||
class Project
|
||||
registerDeserializer(this)
|
||||
|
||||
@deserialize: (state) -> new Project(state.path)
|
||||
|
||||
@openers: []
|
||||
|
||||
@registerOpener: (opener) ->
|
||||
@@ -45,6 +49,10 @@ class Project
|
||||
@editSessions = []
|
||||
@buffers = []
|
||||
|
||||
serialize: ->
|
||||
deserializer: 'Project'
|
||||
path: @getPath()
|
||||
|
||||
# Retrieves the project path.
|
||||
#
|
||||
# Returns a {String}.
|
||||
|
||||
@@ -116,14 +116,19 @@ window.deserializeEditorWindow = ->
|
||||
Project = require 'project'
|
||||
Git = require 'git'
|
||||
|
||||
{initialPath} = atom.getLoadSettings()
|
||||
|
||||
windowState = atom.getWindowState()
|
||||
|
||||
atom.packageStates = windowState.getObject('packageStates') ? {}
|
||||
window.project = new Project(initialPath)
|
||||
window.rootView = deserialize(windowState.get('rootView')) ? new RootView
|
||||
windowState.set('rootView', window.rootView.serialize())
|
||||
|
||||
window.project = deserialize(windowState.get('project'))
|
||||
unless window.project?
|
||||
window.project = new Project(atom.getLoadSettings().initialPath)
|
||||
windowState.set('project', window.project.serialize())
|
||||
|
||||
window.rootView = deserialize(windowState.get('rootView'))
|
||||
unless window.rootView?
|
||||
window.rootView = new RootView()
|
||||
windowState.set('rootView', window.rootView.serialize())
|
||||
|
||||
$(rootViewParentSelector).append(rootView)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user