mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Eliminate rootView.project references.
This commit is contained in:
@@ -59,7 +59,7 @@ class Editor extends View
|
||||
|
||||
@deserialize: (state) ->
|
||||
editor = new Editor(mini: state.mini, deserializing: true)
|
||||
editSessions = state.editSessions.map (state) -> EditSession.deserialize(state, rootView.project)
|
||||
editSessions = state.editSessions.map (state) -> EditSession.deserialize(state, project)
|
||||
editor.pushEditSession(editSession) for editSession in editSessions
|
||||
editor.setActiveEditSessionIndex(state.activeEditSessionIndex)
|
||||
editor.isFocused = state.isFocused
|
||||
|
||||
@@ -37,9 +37,9 @@ class GrammarView extends SelectList
|
||||
confirmed: (grammar) ->
|
||||
@cancel()
|
||||
if grammar is @autoDetect
|
||||
rootView.project.removeGrammarOverrideForPath(@path)
|
||||
project.removeGrammarOverrideForPath(@path)
|
||||
else
|
||||
rootView.project.addGrammarOverrideForPath(@path, grammar)
|
||||
project.addGrammarOverrideForPath(@path, grammar)
|
||||
@editor.reloadGrammar()
|
||||
|
||||
attach: ->
|
||||
|
||||
@@ -38,12 +38,10 @@ class RootView extends View
|
||||
window.rootView = this
|
||||
@handleEvents()
|
||||
|
||||
@project = window.project
|
||||
|
||||
if not projectOrPathToOpen or _.isString(projectOrPathToOpen)
|
||||
pathToOpen = projectOrPathToOpen
|
||||
else
|
||||
pathToOpen = @project?.getPath()
|
||||
pathToOpen = project.getPath()
|
||||
@pathToOpenIsFile = pathToOpen and fs.isFile(pathToOpen)
|
||||
|
||||
config.load()
|
||||
@@ -79,7 +77,7 @@ class RootView extends View
|
||||
|
||||
@on 'root-view:active-path-changed', (e, path) =>
|
||||
if path
|
||||
@project.setPath(path) unless @project.getRootDirectory()
|
||||
project.setPath(path) unless project.getRootDirectory()
|
||||
@setTitle(fs.base(path))
|
||||
else
|
||||
@setTitle("untitled")
|
||||
@@ -115,7 +113,7 @@ class RootView extends View
|
||||
allowActiveEditorChange = options.allowActiveEditorChange ? false
|
||||
|
||||
unless editSession = @openInExistingEditor(path, allowActiveEditorChange, changeFocus)
|
||||
editSession = @project.buildEditSessionForPath(path)
|
||||
editSession = project.buildEditSessionForPath(path)
|
||||
editor = new Editor({editSession})
|
||||
pane = new Pane(editor)
|
||||
@panes.append(pane)
|
||||
@@ -130,7 +128,7 @@ class RootView extends View
|
||||
if activeEditor = @getActiveEditor()
|
||||
activeEditor.focus() if changeFocus
|
||||
|
||||
path = @project.resolve(path) if path
|
||||
path = project.resolve(path) if path
|
||||
|
||||
if editSession = activeEditor.activateEditSessionForPath(path)
|
||||
return editSession
|
||||
@@ -141,7 +139,7 @@ class RootView extends View
|
||||
@makeEditorActive(editor, changeFocus)
|
||||
return editSession
|
||||
|
||||
editSession = @project.buildEditSessionForPath(path)
|
||||
editSession = project.buildEditSessionForPath(path)
|
||||
activeEditor.edit(editSession)
|
||||
editSession
|
||||
|
||||
@@ -170,7 +168,7 @@ class RootView extends View
|
||||
@title or "untitled"
|
||||
|
||||
setTitle: (title) ->
|
||||
projectPath = @project.getPath()
|
||||
projectPath = project.getPath()
|
||||
if not projectPath
|
||||
@title = "untitled"
|
||||
else if title
|
||||
@@ -227,7 +225,7 @@ class RootView extends View
|
||||
|
||||
remove: ->
|
||||
editor.remove() for editor in @getEditors()
|
||||
@project.destroy()
|
||||
project.destroy()
|
||||
super
|
||||
|
||||
saveAll: ->
|
||||
@@ -238,10 +236,10 @@ class RootView extends View
|
||||
@on 'editor:attached', (e, editor) -> callback(editor)
|
||||
|
||||
eachEditSession: (callback) ->
|
||||
@project.eachEditSession(callback)
|
||||
project.eachEditSession(callback)
|
||||
|
||||
eachBuffer: (callback) ->
|
||||
@project.eachBuffer(callback)
|
||||
project.eachBuffer(callback)
|
||||
|
||||
indexOfPane: (pane) ->
|
||||
index = -1
|
||||
|
||||
@@ -64,7 +64,7 @@ windowAdditions =
|
||||
$(rootViewParentSelector).append(rootView)
|
||||
|
||||
stopApplication: ->
|
||||
atom.setWindowState('pathToOpen', rootView.project.getPath())
|
||||
atom.setWindowState('pathToOpen', project.getPath())
|
||||
atom.setRootViewStateForPath project.getPath(),
|
||||
project: project.serialize()
|
||||
rootView: rootView.serialize()
|
||||
|
||||
Reference in New Issue
Block a user