提交 1a547383 编写于 作者: S sj.hwang

Add NavigateRightAction implementation

上级 2125ae6f
......@@ -1079,3 +1079,58 @@ export class NavigateLeftAction extends BaseNavigationAction {
return TPromise.as(false);
}
}
export class NavigateRightAction extends BaseNavigationAction {
public static ID = 'workbench.action.navigateRight';
public static LABEL = nls.localize('navigateRight', "Navigate Right");
constructor(
id: string,
label: string,
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
@IEditorGroupService groupService: IEditorGroupService,
@IPanelService panelService: IPanelService,
@IPartService partService: IPartService,
@IViewletService viewletService: IViewletService
) {
super(id, label, editorService, groupService, panelService, partService, viewletService);
}
protected navigateOnEditorFocus(isEditorGroupVertical, isSidebarPositionLeft): TPromise<boolean> {
if (isEditorGroupVertical) {
return this.navigateRightFromEditor(true, isSidebarPositionLeft);
}
return this.navigateRightFromEditor(false, isSidebarPositionLeft);
}
protected navigateOnPanelFocus(isEditorGroupVertical, isSidebarPositionLeft): TPromise<boolean> {
if (!isSidebarPositionLeft) {
return this.navigateToSidebar();
}
return TPromise.as(false);
}
protected navigateOnSidebarFocus(isEditorGroupVertical, isSidebarPositionLeft): TPromise<boolean> {
if (!isSidebarPositionLeft) {
return TPromise.as(false);
}
if (isEditorGroupVertical) {
return this.navigateToStartOfEditor();
}
return this.navigateToLastActiveEditor();
}
private navigateRightFromEditor(jumpGroups: boolean, isSidebarPositionLeft: boolean): TPromise<boolean> {
const model = this.groupService.getStacksModel();
let result = model.next(jumpGroups, false);
if (result) {
return this.editorService.openEditor(result.editor, null, model.positionOfGroup(result.group))
.then(ok => true);
}
if (!isSidebarPositionLeft) {
return this.navigateToSidebar();
}
return TPromise.as(false);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册