提交 3d3d8c6c 编写于 作者: B Benjamin Pasero

remove unused actions

上级 74a96010
...@@ -34,7 +34,7 @@ import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; ...@@ -34,7 +34,7 @@ import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
import {EditorStacksModel} from 'vs/workbench/common/editor/editorStacksModel'; import {EditorStacksModel} from 'vs/workbench/common/editor/editorStacksModel';
import {CloseEditorsInGroupAction, CloseEditorsInOtherGroupsAction, CloseAllEditorsAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, PinEditorAction, UnpinEditorAction, CloseOtherEditorsInGroupAction, OpenToSideAction, import {CloseEditorsInGroupAction, CloseEditorsInOtherGroupsAction, CloseAllEditorsAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, PinEditorAction, UnpinEditorAction, CloseOtherEditorsInGroupAction, OpenToSideAction,
NavigateBetweenGroupsAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction, EvenGroupWidthsAction, MaximizeGroupAction, MinimizeOtherGroupsAction, FocusPreviousGroup, FocusNextGroup, NavigateBetweenGroupsAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction, EvenGroupWidthsAction, MaximizeGroupAction, MinimizeOtherGroupsAction, FocusPreviousGroup, FocusNextGroup,
toEditorQuickOpenEntry, CloseLeftEditorsInGroupAction, CloseRightEditorsInGroupAction, OpenNextEditor, OpenNextEditorInGroup, OpenPreviousEditor, OpenPreviousEditorInGroup, NavigateBackwardsAction, NavigateForwardAction toEditorQuickOpenEntry, CloseLeftEditorsInGroupAction, CloseRightEditorsInGroupAction, OpenNextEditor, OpenPreviousEditor, NavigateBackwardsAction, NavigateForwardAction
} from 'vs/workbench/browser/parts/editor/editorActions'; } from 'vs/workbench/browser/parts/editor/editorActions';
// Register String Editor // Register String Editor
...@@ -252,12 +252,10 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenNextEditor, OpenNe ...@@ -252,12 +252,10 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenNextEditor, OpenNe
primary: KeyMod.CtrlCmd | KeyCode.PageDown, primary: KeyMod.CtrlCmd | KeyCode.PageDown,
mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow } mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow }
}), 'View: Open Next Editor', category); }), '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, { registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousEditor, OpenPreviousEditor.ID, OpenPreviousEditor.LABEL, {
primary: KeyMod.CtrlCmd | KeyCode.PageUp, primary: KeyMod.CtrlCmd | KeyCode.PageUp,
mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow } mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow }
}), 'View: Open Previous Editor', category); }), '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(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(UnpinEditorAction, UnpinEditorAction.ID, UnpinEditorAction.LABEL), 'View: Unpin Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(CloseAllEditorsAction, CloseAllEditorsAction.ID, CloseAllEditorsAction.LABEL), 'View: Close All Editors', category); registry.registerWorkbenchAction(new SyncActionDescriptor(CloseAllEditorsAction, CloseAllEditorsAction.ID, CloseAllEditorsAction.LABEL), 'View: Close All Editors', category);
......
...@@ -780,21 +780,7 @@ export class OpenNextEditor extends BaseNavigateEditorAction { ...@@ -780,21 +780,7 @@ export class OpenNextEditor extends BaseNavigateEditorAction {
} }
protected navigate(): IEditorIdentifier { protected navigate(): IEditorIdentifier {
return this.editorService.getStacksModel().next(false); return this.editorService.getStacksModel().next();
}
}
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);
} }
} }
...@@ -808,21 +794,7 @@ export class OpenPreviousEditor extends BaseNavigateEditorAction { ...@@ -808,21 +794,7 @@ export class OpenPreviousEditor extends BaseNavigateEditorAction {
} }
protected navigate(): IEditorIdentifier { protected navigate(): IEditorIdentifier {
return this.editorService.getStacksModel().previous(false); return this.editorService.getStacksModel().previous();
}
}
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);
} }
} }
......
...@@ -57,8 +57,8 @@ export interface IEditorStacksModel { ...@@ -57,8 +57,8 @@ export interface IEditorStacksModel {
positionOfGroup(group: IEditorGroup): Position; positionOfGroup(group: IEditorGroup): Position;
next(inGroup: boolean): IEditorIdentifier; next(): IEditorIdentifier;
previous(inGroup: boolean): IEditorIdentifier; previous(): IEditorIdentifier;
toString(): string; toString(): string;
} }
...@@ -773,7 +773,7 @@ export class EditorStacksModel implements IEditorStacksModel { ...@@ -773,7 +773,7 @@ export class EditorStacksModel implements IEditorStacksModel {
return this.indexOf(group); return this.indexOf(group);
} }
public next(inGroup: boolean): IEditorIdentifier { public next(): IEditorIdentifier {
this.ensureLoaded(); this.ensureLoaded();
if (!this.activeGroup) { if (!this.activeGroup) {
...@@ -787,11 +787,6 @@ export class EditorStacksModel implements IEditorStacksModel { ...@@ -787,11 +787,6 @@ export class EditorStacksModel implements IEditorStacksModel {
return { group: this.activeGroup, editor: this.activeGroup.getEditor(index + 1) }; 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 // Return first in next group
const indexOfGroup = this.indexOf(this.activeGroup); const indexOfGroup = this.indexOf(this.activeGroup);
const nextGroup = this.groups[indexOfGroup + 1]; const nextGroup = this.groups[indexOfGroup + 1];
...@@ -804,7 +799,7 @@ export class EditorStacksModel implements IEditorStacksModel { ...@@ -804,7 +799,7 @@ export class EditorStacksModel implements IEditorStacksModel {
return { group: firstGroup, editor: firstGroup.getEditor(0) }; return { group: firstGroup, editor: firstGroup.getEditor(0) };
} }
public previous(inGroup: boolean): IEditorIdentifier { public previous(): IEditorIdentifier {
this.ensureLoaded(); this.ensureLoaded();
if (!this.activeGroup) { if (!this.activeGroup) {
...@@ -818,11 +813,6 @@ export class EditorStacksModel implements IEditorStacksModel { ...@@ -818,11 +813,6 @@ export class EditorStacksModel implements IEditorStacksModel {
return { group: this.activeGroup, editor: this.activeGroup.getEditor(index - 1) }; 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 // Return last in previous group
const indexOfGroup = this.indexOf(this.activeGroup); const indexOfGroup = this.indexOf(this.activeGroup);
const previousGroup = this.groups[indexOfGroup - 1]; const previousGroup = this.groups[indexOfGroup - 1];
......
...@@ -1297,44 +1297,6 @@ suite('Editor Stacks Model', () => { ...@@ -1297,44 +1297,6 @@ suite('Editor Stacks Model', () => {
assert.equal(model.groups.length, 0); 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 () { test('Stack - Multiple Editors - Navigation (across groups)', function () {
const model = create(); const model = create();
...@@ -1360,28 +1322,28 @@ suite('Editor Stacks Model', () => { ...@@ -1360,28 +1322,28 @@ suite('Editor Stacks Model', () => {
model.setActive(group1); model.setActive(group1);
group1.setActive(input1); group1.setActive(input1);
let previous = model.previous(false); let previous = model.previous();
assert.equal(previous.group, group2); assert.equal(previous.group, group2);
assert.equal(previous.editor, input6); assert.equal(previous.editor, input6);
model.setActive(previous.group); model.setActive(previous.group);
previous.group.setActive(previous.editor); previous.group.setActive(previous.editor);
let next = model.next(false); let next = model.next();
assert.equal(next.group, group1); assert.equal(next.group, group1);
assert.equal(next.editor, input1); assert.equal(next.editor, input1);
model.setActive(group1); model.setActive(group1);
group1.setActive(input3); group1.setActive(input3);
next = model.next(false); next = model.next();
assert.equal(next.group, group2); assert.equal(next.group, group2);
assert.equal(next.editor, input4); assert.equal(next.editor, input4);
model.setActive(next.group); model.setActive(next.group);
next.group.setActive(next.editor); next.group.setActive(next.editor);
previous = model.previous(false); previous = model.previous();
assert.equal(previous.group, group1); assert.equal(previous.group, group1);
assert.equal(previous.editor, input3); assert.equal(previous.editor, input3);
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册