Rename Project.buildEditSession -> Project.open

This commit is contained in:
Nathan Sobo
2013-05-14 19:58:10 -06:00
parent 74c889062b
commit 6104927cb6
16 changed files with 54 additions and 54 deletions

View File

@@ -24,7 +24,7 @@ class EditSession
session = project.buildEditSessionForBuffer(Buffer.deserialize(state.buffer))
if !session?
console.warn "Could not build edit session for path '#{state.buffer}' because that file no longer exists" if state.buffer
session = project.buildEditSession(null)
session = project.open(null)
session.setScrollTop(state.scrollTop)
session.setScrollLeft(state.scrollLeft)
session.setCursorScreenPosition(state.cursorScreenPosition)

View File

@@ -12,7 +12,7 @@ class ImageEditSession
@deserialize: (state) ->
if fsUtils.exists(state.path)
project.buildEditSession(state.path)
project.open(state.path)
else
console.warn "Could not build edit session for path '#{state.path}' because that file no longer exists"

View File

@@ -148,7 +148,7 @@ class Project
# editSessionOptions - Options that you can pass to the `EditSession` constructor
#
# Returns either an {EditSession} (for text) or {ImageEditSession} (for images).
buildEditSession: (filePath, editSessionOptions={}) ->
open: (filePath, editSessionOptions={}) ->
if ImageEditSession.canOpen(filePath)
new ImageEditSession(filePath)
else

View File

@@ -109,10 +109,10 @@ class RootView extends View
changeFocus = options.changeFocus ? true
path = project.resolve(path) if path?
if activePane = @getActivePane()
editSession = activePane.itemForUri(path) ? project.buildEditSession(path)
editSession = activePane.itemForUri(path) ? project.open(path)
activePane.showItem(editSession)
else
editSession = project.buildEditSession(path)
editSession = project.open(path)
activePane = new Pane(editSession)
@panes.append(activePane)

View File

@@ -40,7 +40,7 @@ describe "AutocompleteView", ->
beforeEach ->
window.rootView = new RootView
editor = new Editor(editSession: project.buildEditSession('sample.js'))
editor = new Editor(editSession: project.open('sample.js'))
atom.activatePackage('autocomplete')
autocomplete = new AutocompleteView(editor)
miniEditor = autocomplete.miniEditor

View File

@@ -10,7 +10,7 @@ describe "CommandInterpreter", ->
beforeEach ->
interpreter = new CommandInterpreter(project)
editSession = project.buildEditSession('sample.js')
editSession = project.open('sample.js')
buffer = editSession.buffer
afterEach ->
@@ -445,7 +445,7 @@ describe "CommandInterpreter", ->
runs ->
expect(operationsToPreview.length).toBeGreaterThan 3
for operation in operationsToPreview
editSession = project.buildEditSession(operation.getPath())
editSession = project.open(operation.getPath())
editSession.setSelectedBufferRange(operation.execute(editSession))
expect(editSession.getSelectedText()).toMatch /a+/
editSession.destroy()

View File

@@ -69,7 +69,7 @@ class FuzzyFinderView extends SelectList
path = @getSelectedElement()
return unless path
if pane = rootView.getActivePane()
fn(pane, project.buildEditSession(path))
fn(pane, project.open(path))
else
@openPath(path)

View File

@@ -36,7 +36,7 @@ describe "TabBarView", ->
registerDeserializer(TestView)
item1 = new TestView('Item 1')
item2 = new TestView('Item 2')
editSession1 = project.buildEditSession('sample.js')
editSession1 = project.open('sample.js')
paneContainer = new PaneContainer
pane = new Pane(item1, editSession1, item2)
pane.showItem(item2)
@@ -77,7 +77,7 @@ describe "TabBarView", ->
expect(tabBar.tabAtIndex(1).find('.title')).toHaveText 'Item 3'
it "adds the 'modified' class to the new tab if the item is initially modified", ->
editSession2 = project.buildEditSession('sample.txt')
editSession2 = project.open('sample.txt')
editSession2.insertText('x')
pane.showItem(editSession2)
expect(tabBar.tabForItem(editSession2)).toHaveClass 'modified'