From b042dffc2cccf424da85f7e684973e31804ea1b0 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 18 Feb 2014 15:13:27 -0800 Subject: [PATCH] Rename Workspace::getPanes to Workspace::getPaneViews --- spec/pane-container-view-spec.coffee | 4 ++-- spec/workspace-view-spec.coffee | 4 ++-- src/pane-container-view.coffee | 15 +++++++++------ src/pane-view.coffee | 2 +- src/workspace-view.coffee | 8 ++++++-- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/spec/pane-container-view-spec.coffee b/spec/pane-container-view-spec.coffee index 1b923c329..c382c5f8f 100644 --- a/spec/pane-container-view-spec.coffee +++ b/spec/pane-container-view-spec.coffee @@ -66,7 +66,7 @@ describe "PaneContainerView", -> container.saveAll() - for pane in container.getPanes() + for pane in container.getPaneViews() for item in pane.getItems() expect(item.saved).toBeTruthy() @@ -255,7 +255,7 @@ describe "PaneContainerView", -> describe ".focusPreviousPane()", -> it "focuses the pane preceding the focused pane or the last pane if no pane has focus", -> container.attachToDom() - container.getPanes()[0].focus() # activate first pane + container.getPaneViews()[0].focus() # activate first pane container.focusPreviousPane() expect(pane3.activeItem).toMatchSelector ':focus' diff --git a/spec/workspace-view-spec.coffee b/spec/workspace-view-spec.coffee index d13ca3323..245666c23 100644 --- a/spec/workspace-view-spec.coffee +++ b/spec/workspace-view-spec.coffee @@ -36,12 +36,12 @@ describe "WorkspaceView", -> editorView1 = atom.workspaceView.getActiveView() buffer = editorView1.getEditor().getBuffer() editorView1.splitRight() - expect(atom.workspaceView.getActivePane()).toBe atom.workspaceView.getPanes()[1] + expect(atom.workspaceView.getActivePane()).toBe atom.workspaceView.getPaneViews()[1] simulateReload() expect(atom.workspaceView.getEditorViews().length).toBe 2 - expect(atom.workspaceView.getActivePane()).toBe atom.workspaceView.getPanes()[1] + expect(atom.workspaceView.getActivePane()).toBe atom.workspaceView.getPaneViews()[1] expect(atom.workspaceView.title).toBe "untitled - #{atom.project.getPath()}" describe "when there are open editors", -> diff --git a/src/pane-container-view.coffee b/src/pane-container-view.coffee index 1710f61ff..5e0378f6f 100644 --- a/src/pane-container-view.coffee +++ b/src/pane-container-view.coffee @@ -54,24 +54,24 @@ class PaneContainerView extends View confirmClose: -> saved = true - for pane in @getPanes() + for pane in @getPaneViews() for item in pane.getItems() if not pane.promptToSaveItem(item) saved = false break saved - getPanes: -> + getPaneViews: -> @find('.pane').views() indexOfPane: (pane) -> - @getPanes().indexOf(pane.view()) + @getPaneViews().indexOf(pane.view()) paneAtIndex: (index) -> - @getPanes()[index] + @getPaneViews()[index] eachPaneView: (callback) -> - callback(pane) for pane in @getPanes() + callback(pane) for pane in @getPaneViews() paneAttached = (e) -> callback($(e.target).view()) @on 'pane:attached', paneAttached off: => @off 'pane:attached', paneAttached @@ -117,7 +117,7 @@ class PaneContainerView extends View pane = @getActivePane() box = @boundingBoxForPane(pane) - panes = @getPanes() + panes = @getPaneViews() .filter (otherPane) => otherBox = @boundingBoxForPane(otherPane) switch direction @@ -143,3 +143,6 @@ class PaneContainerView extends View right: {x: boundingBox.right, y: boundingBox.top} top: {x: boundingBox.left, y: boundingBox.top} bottom: {x: boundingBox.left, y: boundingBox.bottom} + + getPanes: -> + @getPaneViews() diff --git a/src/pane-view.coffee b/src/pane-view.coffee index 09cc2a62b..59fb98074 100644 --- a/src/pane-view.coffee +++ b/src/pane-view.coffee @@ -117,7 +117,7 @@ class PaneView extends View # Public: Returns the next pane, ordered by creation. getNextPane: -> - panes = @container?.getPanes() + panes = @container?.getPaneViews() return unless panes.length > 1 nextIndex = (panes.indexOf(this) + 1) % panes.length panes[nextIndex] diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index 4c7ce45c1..d0b5e55a9 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -272,8 +272,8 @@ class WorkspaceView extends View eachPaneView: (callback) -> @panes.eachPaneView(callback) - # Public: Returns an Array of all open {PaneView}s. - getPanes: -> + # Returns an Array of all open {PaneView}s. + getPaneViews: -> @panes.getPanes() # Public: Return the id of the given a {PaneView} @@ -294,3 +294,7 @@ class WorkspaceView extends View # Deprecated: eachPane: (callback) -> @eachPaneView(callback) + + # Deprecated: + getPanes: -> + @getPaneViews()