Rename Project::open to Project::openSync

…and Project::openAsync to Project::open
This commit is contained in:
probablycorey
2013-10-11 10:41:27 -07:00
parent 894cae7c9c
commit 92c6ad66eb
16 changed files with 83 additions and 84 deletions

View File

@@ -191,7 +191,7 @@ class Project
# Options that you can pass to the {EditSession} constructor
#
# Returns a promise that resolves to an {EditSession}.
openAsync: (filePath, options={}) ->
open: (filePath, options={}) ->
filePath = @resolve(filePath)
resource = null
_.find @openers, (opener) -> resource = opener(filePath, options)
@@ -200,10 +200,10 @@ class Project
Q(resource)
else
@bufferForPathAsync(filePath).then (buffer) =>
editSession = @buildEditSessionForBuffer(buffer, options)
@buildEditSessionForBuffer(buffer, options)
# Private: Only be used in specs
open: (filePath, options={}) ->
openSync: (filePath, options={}) ->
filePath = @resolve(filePath)
for opener in @openers
return resource if resource = opener(filePath, options)

View File

@@ -177,20 +177,19 @@ class RootView extends View
activePane = @getActivePane()
editSession = activePane.itemForUri(project.relativize(filePath)) if activePane and filePath
promise = project.openAsync(filePath, {initialLine}) if not editSession
promise = project.open(filePath, {initialLine}) if not editSession
fileSize = 0
fileSize = fs.statSync(filePath).size if fsUtils.exists(filePath)
Q(editSession ? promise)
.then (editSession) =>
if not activePane
activePane = new Pane(editSession)
@panes.setRoot(activePane)
Q(editSession ? promise).then (editSession) =>
if not activePane
activePane = new Pane(editSession)
@panes.setRoot(activePane)
activePane.showItem(editSession)
activePane.focus()
editSession
activePane.showItem(editSession)
activePane.focus()
editSession
# Private: Only used in specs
openSync: (filePath, options = {}) ->
@@ -199,12 +198,12 @@ class RootView extends View
filePath = project.relativize(filePath)
if activePane = @getActivePane()
if filePath
editSession = activePane.itemForUri(filePath) ? project.open(filePath, {initialLine})
editSession = activePane.itemForUri(filePath) ? project.openSync(filePath, {initialLine})
else
editSession = project.open()
editSession = project.openSync()
activePane.showItem(editSession)
else
editSession = project.open(filePath, {initialLine})
editSession = project.openSync(filePath, {initialLine})
activePane = new Pane(editSession)
@panes.setRoot(activePane)