From 3d3d8c6cb38497ed231b2534d0e9ecdb27b91aea Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 16 May 2016 18:02:20 +0200 Subject: [PATCH] remove unused actions --- .../parts/editor/editor.contribution.ts | 6 +-- .../browser/parts/editor/editorActions.ts | 32 +------------ .../common/editor/editorStacksModel.ts | 18 ++------ .../common/editor/editorStacksModel.test.ts | 46 ++----------------- 4 files changed, 12 insertions(+), 90 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index e36da8a7375..142eb968127 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -33,8 +33,8 @@ import {SyncDescriptor} from 'vs/platform/instantiation/common/descriptors'; import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; import {EditorStacksModel} from 'vs/workbench/common/editor/editorStacksModel'; import {CloseEditorsInGroupAction, CloseEditorsInOtherGroupsAction, CloseAllEditorsAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, PinEditorAction, UnpinEditorAction, CloseOtherEditorsInGroupAction, OpenToSideAction, - NavigateBetweenGroupsAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction, EvenGroupWidthsAction, MaximizeGroupAction, MinimizeOtherGroupsAction, FocusPreviousGroup, FocusNextGroup, - toEditorQuickOpenEntry, CloseLeftEditorsInGroupAction, CloseRightEditorsInGroupAction, OpenNextEditor, OpenNextEditorInGroup, OpenPreviousEditor, OpenPreviousEditorInGroup, NavigateBackwardsAction, NavigateForwardAction + NavigateBetweenGroupsAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction, EvenGroupWidthsAction, MaximizeGroupAction, MinimizeOtherGroupsAction, FocusPreviousGroup, FocusNextGroup, + toEditorQuickOpenEntry, CloseLeftEditorsInGroupAction, CloseRightEditorsInGroupAction, OpenNextEditor, OpenPreviousEditor, NavigateBackwardsAction, NavigateForwardAction } from 'vs/workbench/browser/parts/editor/editorActions'; // Register String Editor @@ -252,12 +252,10 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenNextEditor, OpenNe primary: KeyMod.CtrlCmd | KeyCode.PageDown, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow } }), 'View: Open Next Editor', category); -registry.registerWorkbenchAction(new SyncActionDescriptor(OpenNextEditorInGroup, OpenNextEditorInGroup.ID, OpenNextEditorInGroup.LABEL), 'View: Open Next Editor in Group', category); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousEditor, OpenPreviousEditor.ID, OpenPreviousEditor.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.PageUp, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow } }), 'View: Open Previous Editor', category); -registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousEditorInGroup, OpenPreviousEditorInGroup.ID, OpenPreviousEditorInGroup.LABEL), 'View: Open Previous Editor in Group', category); registry.registerWorkbenchAction(new SyncActionDescriptor(PinEditorAction, PinEditorAction.ID, PinEditorAction.LABEL, { primary: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.Enter) }), 'View: Pin Editor', category); registry.registerWorkbenchAction(new SyncActionDescriptor(UnpinEditorAction, UnpinEditorAction.ID, UnpinEditorAction.LABEL), 'View: Unpin Editor', category); registry.registerWorkbenchAction(new SyncActionDescriptor(CloseAllEditorsAction, CloseAllEditorsAction.ID, CloseAllEditorsAction.LABEL), 'View: Close All Editors', category); diff --git a/src/vs/workbench/browser/parts/editor/editorActions.ts b/src/vs/workbench/browser/parts/editor/editorActions.ts index dc90ac16c18..0049eeebbbd 100644 --- a/src/vs/workbench/browser/parts/editor/editorActions.ts +++ b/src/vs/workbench/browser/parts/editor/editorActions.ts @@ -780,21 +780,7 @@ export class OpenNextEditor extends BaseNavigateEditorAction { } protected navigate(): IEditorIdentifier { - return this.editorService.getStacksModel().next(false); - } -} - -export class OpenNextEditorInGroup extends BaseNavigateEditorAction { - - public static ID = 'workbench.action.nextEditorInGroup'; - public static LABEL = nls.localize('openNextEditorInGroup', "Open Next Editor in Group"); - - constructor(id: string, label: string, @IWorkbenchEditorService editorService: IWorkbenchEditorService) { - super(id, label, editorService); - } - - protected navigate(): IEditorIdentifier { - return this.editorService.getStacksModel().next(true); + return this.editorService.getStacksModel().next(); } } @@ -808,21 +794,7 @@ export class OpenPreviousEditor extends BaseNavigateEditorAction { } protected navigate(): IEditorIdentifier { - return this.editorService.getStacksModel().previous(false); - } -} - -export class OpenPreviousEditorInGroup extends BaseNavigateEditorAction { - - public static ID = 'workbench.action.previousEditorInGroup'; - public static LABEL = nls.localize('openPreviousEditorInGroup', "Open Previous Editor in Group"); - - constructor(id: string, label: string, @IWorkbenchEditorService editorService: IWorkbenchEditorService) { - super(id, label, editorService); - } - - protected navigate(): IEditorIdentifier { - return this.editorService.getStacksModel().previous(true); + return this.editorService.getStacksModel().previous(); } } diff --git a/src/vs/workbench/common/editor/editorStacksModel.ts b/src/vs/workbench/common/editor/editorStacksModel.ts index 050a59dc75b..ee0d3f79009 100644 --- a/src/vs/workbench/common/editor/editorStacksModel.ts +++ b/src/vs/workbench/common/editor/editorStacksModel.ts @@ -57,8 +57,8 @@ export interface IEditorStacksModel { positionOfGroup(group: IEditorGroup): Position; - next(inGroup: boolean): IEditorIdentifier; - previous(inGroup: boolean): IEditorIdentifier; + next(): IEditorIdentifier; + previous(): IEditorIdentifier; toString(): string; } @@ -773,7 +773,7 @@ export class EditorStacksModel implements IEditorStacksModel { return this.indexOf(group); } - public next(inGroup: boolean): IEditorIdentifier { + public next(): IEditorIdentifier { this.ensureLoaded(); if (!this.activeGroup) { @@ -787,11 +787,6 @@ export class EditorStacksModel implements IEditorStacksModel { return { group: this.activeGroup, editor: this.activeGroup.getEditor(index + 1) }; } - // Return first in group - if (inGroup) { - return { group: this.activeGroup, editor: this.activeGroup.getEditor(0) }; - } - // Return first in next group const indexOfGroup = this.indexOf(this.activeGroup); const nextGroup = this.groups[indexOfGroup + 1]; @@ -804,7 +799,7 @@ export class EditorStacksModel implements IEditorStacksModel { return { group: firstGroup, editor: firstGroup.getEditor(0) }; } - public previous(inGroup: boolean): IEditorIdentifier { + public previous(): IEditorIdentifier { this.ensureLoaded(); if (!this.activeGroup) { @@ -818,11 +813,6 @@ export class EditorStacksModel implements IEditorStacksModel { return { group: this.activeGroup, editor: this.activeGroup.getEditor(index - 1) }; } - // Return last in group - if (inGroup) { - return { group: this.activeGroup, editor: this.activeGroup.getEditor(this.activeGroup.count - 1) }; - } - // Return last in previous group const indexOfGroup = this.indexOf(this.activeGroup); const previousGroup = this.groups[indexOfGroup - 1]; diff --git a/src/vs/workbench/test/common/editor/editorStacksModel.test.ts b/src/vs/workbench/test/common/editor/editorStacksModel.test.ts index e12c6b13a24..f2ef1499482 100644 --- a/src/vs/workbench/test/common/editor/editorStacksModel.test.ts +++ b/src/vs/workbench/test/common/editor/editorStacksModel.test.ts @@ -1297,44 +1297,6 @@ suite('Editor Stacks Model', () => { assert.equal(model.groups.length, 0); }); - test('Stack - Multiple Editors - Navigation (in group)', function () { - const model = create(); - const group = model.openGroup('group'); - - const input1 = input(); - const input2 = input(); - const input3 = input(); - - group.openEditor(input1, { pinned: true, active: true }); - group.openEditor(input2, { pinned: true, active: true }); - group.openEditor(input3, { pinned: true, active: true }); - - let next = model.next(true); - assert.equal(next.group, group); - assert.equal(next.editor, input1); - - group.setActive(next.editor); - next = model.next(true); - assert.equal(next.editor, input2); - - group.setActive(next.editor); - next = model.next(true); - assert.equal(next.editor, input3); - - group.setActive(next.editor); - let previous = model.previous(true); - assert.equal(previous.group, group); - assert.equal(previous.editor, input2); - - group.setActive(previous.editor); - previous = model.previous(true); - assert.equal(previous.editor, input1); - - group.setActive(previous.editor); - previous = model.previous(true); - assert.equal(previous.editor, input3); - }); - test('Stack - Multiple Editors - Navigation (across groups)', function () { const model = create(); @@ -1360,28 +1322,28 @@ suite('Editor Stacks Model', () => { model.setActive(group1); group1.setActive(input1); - let previous = model.previous(false); + let previous = model.previous(); assert.equal(previous.group, group2); assert.equal(previous.editor, input6); model.setActive(previous.group); previous.group.setActive(previous.editor); - let next = model.next(false); + let next = model.next(); assert.equal(next.group, group1); assert.equal(next.editor, input1); model.setActive(group1); group1.setActive(input3); - next = model.next(false); + next = model.next(); assert.equal(next.group, group2); assert.equal(next.editor, input4); model.setActive(next.group); next.group.setActive(next.editor); - previous = model.previous(false); + previous = model.previous(); assert.equal(previous.group, group1); assert.equal(previous.editor, input3); }); -- GitLab