diff --git a/src/atom.coffee b/src/atom.coffee index fa1307013..cc1be2ede 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -173,7 +173,7 @@ class Atom callback(showSaveDialogSync()) showSaveDialogSync: (defaultPath) -> - defaultPath ?= project?.getPath() + defaultPath ?= @project?.getPath() currentWindow = @getCurrentWindow() dialog.showSaveDialog currentWindow, {title: 'Save File', defaultPath} diff --git a/src/editor.coffee b/src/editor.coffee index 687fc0d47..df85e3835 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -107,13 +107,14 @@ class Editor when 'scrollLeft' @emit 'scroll-left-changed', newValue - project.addEditSession(this) if registerEditSession + atom.project.addEditSession(this) if registerEditSession # Private: setBuffer: (@buffer) -> @buffer.retain() @subscribe @buffer, "path-changed", => - project.setPath(path.dirname(@getPath())) unless project.getPath()? + unless atom.project.getPath()? + atom.project.setPath(path.dirname(@getPath())) @emit "title-changed" @emit "path-changed" @subscribe @buffer, "contents-modified", => @emit "contents-modified" @@ -142,7 +143,7 @@ class Editor @buffer.release() @displayBuffer.destroy() @languageMode.destroy() - project?.removeEditSession(this) + atom.project?.removeEditSession(this) @emit 'destroyed' @off() @@ -162,7 +163,7 @@ class Editor newEditSession.setScrollLeft(@getScrollLeft()) for marker in @findMarkers(editorId: @id) marker.copy(editorId: newEditSession.id, preserveFolds: true) - project.addEditSession(newEditSession) + atom.project.addEditSession(newEditSession) newEditSession # Public: Retrieves the filename of the open file. diff --git a/src/git.coffee b/src/git.coffee index c753acb2a..d032ab990 100644 --- a/src/git.coffee +++ b/src/git.coffee @@ -70,8 +70,8 @@ class Git @refreshIndex() @refreshStatus() - if project? - @subscribe project.buffers.onEach (buffer) => @subscribeToBuffer(buffer) + if atom.project? + @subscribe atom.project.buffers.onEach (buffer) => @subscribeToBuffer(buffer) # Private: Subscribes to buffer events. subscribeToBuffer: (buffer) -> @@ -145,7 +145,7 @@ class Git # Public: Returns true if at the root, false if in a subfolder of the # repository. isProjectAtRoot: -> - @projectAtRoot ?= project.relativize(@getWorkingDirectory()) is '' + @projectAtRoot ?= atom.project.relativize(@getWorkingDirectory()) is '' # Public: Makes a path relative to the repository's working directory. relativize: (path) -> @getRepo().relativize(path) diff --git a/src/root-view.coffee b/src/root-view.coffee index bbeb8101e..6d3efe956 100644 --- a/src/root-view.coffee +++ b/src/root-view.coffee @@ -105,7 +105,7 @@ class RootView extends View @command 'application:zoom', -> ipc.sendChannel('command', 'application:zoom') @command 'application:bring-all-windows-to-front', -> ipc.sendChannel('command', 'application:bring-all-windows-to-front') - @command 'window:run-package-specs', => ipc.sendChannel('run-package-specs', path.join(project.getPath(), 'spec')) + @command 'window:run-package-specs', => ipc.sendChannel('run-package-specs', path.join(atom.project.getPath(), 'spec')) @command 'window:increase-font-size', => atom.config.set("editor.fontSize", atom.config.get("editor.fontSize") + 1) @@ -176,7 +176,7 @@ class RootView extends View initialLine = options.initialLine activePane = @getActivePane() - editor = activePane.itemForUri(project.relativize(filePath)) if activePane and filePath + editor = activePane.itemForUri(atom.project.relativize(filePath)) if activePane and filePath promise = project.open(filePath, {initialLine}) if not editor Q(editor ? promise) diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee index ab08ad6c2..599b660ab 100644 --- a/src/tokenized-buffer.coffee +++ b/src/tokenized-buffer.coffee @@ -31,7 +31,7 @@ class TokenizedBuffer @state = optionsOrState # TODO: This needs to be made async, but should wait until the new Telepath changes land - @buffer = project.bufferForPathSync(optionsOrState.get('bufferPath')) + @buffer = atom.project.bufferForPathSync(optionsOrState.get('bufferPath')) else { @buffer, tabLength } = optionsOrState @state = atom.site.createDocument