Revert "Merge pull request #1844 from atom/cj-move-functionality-to-workspace"

This reverts commit 2d7dda066c, reversing
changes made to 96e3c63291.
This commit is contained in:
probablycorey
2014-04-08 10:41:30 -07:00
parent 4a55c90c63
commit 87d008c337
5 changed files with 82 additions and 78 deletions

View File

@@ -1,5 +1,5 @@
{deprecate} = require 'grim'
_ = require 'underscore-plus'
{remove, last} = require 'underscore-plus'
{join} = require 'path'
{Model} = require 'theorist'
Q = require 'q'
@@ -28,10 +28,6 @@ class Workspace extends Model
constructor: ->
super
@openers = []
@editors = []
@subscribe @paneContainer, 'item-destroyed', @onPaneItemDestroyed
@registerOpener (filePath) =>
switch filePath
@@ -54,14 +50,6 @@ class Workspace extends Model
paneContainer: @paneContainer.serialize()
fullScreen: atom.isFullScreen()
addEditor: (editor) ->
@editors.push editor
@emit 'editor-created', editor
editor
removeEditor: (editor) ->
_.remove(@editors, editor)
# Public: Register a function to be called for every current and future
# {Editor} in the workspace.
#
@@ -70,14 +58,13 @@ class Workspace extends Model
# Returns a subscription object with an `.off` method that you can call to
# unregister the callback.
eachEditor: (callback) ->
callback(editor) for editor in @getEditors()
@subscribe this, 'editor-created', (editor) -> callback(editor)
atom.project.eachEditor(callback)
# Public: Get all current editors in the workspace.
#
# Returns an {Array} of {Editor}s.
getEditors: ->
_.clone(@editors)
atom.project.getEditors()
# Public: Open a given a URI in Atom asynchronously.
#
@@ -185,14 +172,14 @@ class Workspace extends Model
#
# opener - A {Function} to be called when a path is being opened.
registerOpener: (opener) ->
@openers.push(opener)
atom.project.registerOpener(opener)
# Public: Unregister an opener registered with {::registerOpener}.
unregisterOpener: (opener) ->
_.remove(@openers, opener)
atom.project.unregisterOpener(opener)
getOpeners: ->
@openers
atom.project.openers
# Public: Get the active {Pane}.
#
@@ -275,7 +262,7 @@ class Workspace extends Model
# Removes the item's uri from the list of potential items to reopen.
itemOpened: (item) ->
if uri = item.getUri?()
_.remove(@destroyedItemUris, uri)
remove(@destroyedItemUris, uri)
# Adds the destroyed item's uri to the list of items to reopen.
onPaneItemDestroyed: (item) =>
@@ -284,5 +271,4 @@ class Workspace extends Model
# Called by Model superclass when destroyed
destroyed: ->
editor.destroy() for editor in @getEditors()
@paneContainer.destroy()