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

remove unused actions

上级 74a96010
......@@ -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);
......
......@@ -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();
}
}
......
......@@ -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];
......
......@@ -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);
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册