Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d9b64b48
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d9b64b48
编写于
3月 09, 2017
作者:
S
sj.hwang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add abstract class BaseNavigationAction
上级
c8313702
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
111 addition
and
0 deletion
+111
-0
src/vs/workbench/common/editor/editorStacksModel.ts
src/vs/workbench/common/editor/editorStacksModel.ts
+6
-0
src/vs/workbench/electron-browser/actions.ts
src/vs/workbench/electron-browser/actions.ts
+105
-0
未找到文件。
src/vs/workbench/common/editor/editorStacksModel.ts
浏览文件 @
d9b64b48
...
@@ -972,6 +972,9 @@ export class EditorStacksModel implements IEditorStacksModel {
...
@@ -972,6 +972,9 @@ export class EditorStacksModel implements IEditorStacksModel {
// Return first if we are not jumping groups
// Return first if we are not jumping groups
if
(
!
jumpGroups
)
{
if
(
!
jumpGroups
)
{
if
(
!
cycleAtEnd
)
{
return
null
;
}
return
{
group
:
this
.
activeGroup
,
editor
:
this
.
activeGroup
.
getEditor
(
0
)
};
return
{
group
:
this
.
activeGroup
,
editor
:
this
.
activeGroup
.
getEditor
(
0
)
};
}
}
...
@@ -1008,6 +1011,9 @@ export class EditorStacksModel implements IEditorStacksModel {
...
@@ -1008,6 +1011,9 @@ export class EditorStacksModel implements IEditorStacksModel {
// Return last if we are not jumping groups
// Return last if we are not jumping groups
if
(
!
jumpGroups
)
{
if
(
!
jumpGroups
)
{
if
(
!
cycleAtStart
)
{
return
null
;
}
return
{
group
:
this
.
activeGroup
,
editor
:
this
.
activeGroup
.
getEditor
(
this
.
activeGroup
.
count
-
1
)
};
return
{
group
:
this
.
activeGroup
,
editor
:
this
.
activeGroup
.
getEditor
(
this
.
activeGroup
.
count
-
1
)
};
}
}
...
...
src/vs/workbench/electron-browser/actions.ts
浏览文件 @
d9b64b48
...
@@ -30,6 +30,10 @@ import * as browser from 'vs/base/browser/browser';
...
@@ -30,6 +30,10 @@ import * as browser from 'vs/base/browser/browser';
import
{
IIntegrityService
}
from
'
vs/platform/integrity/common/integrity
'
;
import
{
IIntegrityService
}
from
'
vs/platform/integrity/common/integrity
'
;
import
{
IEntryRunContext
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
IEntryRunContext
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
ITimerService
,
IStartupMetrics
}
from
'
vs/workbench/services/timer/common/timerService
'
;
import
{
ITimerService
,
IStartupMetrics
}
from
'
vs/workbench/services/timer/common/timerService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
IPartService
,
Parts
,
Position
as
SidebarPosition
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
*
as
os
from
'
os
'
;
import
*
as
os
from
'
os
'
;
import
{
webFrame
}
from
'
electron
'
;
import
{
webFrame
}
from
'
electron
'
;
...
@@ -905,3 +909,104 @@ export class OpenIntroductoryVideosUrlAction extends Action {
...
@@ -905,3 +909,104 @@ export class OpenIntroductoryVideosUrlAction extends Action {
return
null
;
return
null
;
}
}
}
}
export
abstract
class
BaseNavigationAction
extends
Action
{
constructor
(
id
:
string
,
label
:
string
,
@
IWorkbenchEditorService
protected
editorService
:
IWorkbenchEditorService
,
@
IEditorGroupService
protected
groupService
:
IEditorGroupService
,
@
IPanelService
protected
panelService
:
IPanelService
,
@
IPartService
protected
partService
:
IPartService
,
@
IViewletService
protected
viewletService
:
IViewletService
)
{
super
(
id
,
label
);
}
public
run
():
TPromise
<
any
>
{
const
isEditorFocus
=
this
.
partService
.
hasFocus
(
Parts
.
EDITOR_PART
);
const
isPanelFocus
=
this
.
partService
.
hasFocus
(
Parts
.
PANEL_PART
);
const
isSidebarFocus
=
this
.
partService
.
hasFocus
(
Parts
.
SIDEBAR_PART
);
const
isEditorGroupVertical
=
this
.
groupService
.
getGroupOrientation
()
===
'
vertical
'
;
const
isSidebarPositionLeft
=
this
.
partService
.
getSideBarPosition
()
===
SidebarPosition
.
LEFT
;
if
(
isEditorFocus
)
{
return
this
.
navigateOnEditorFocus
(
isEditorGroupVertical
,
isSidebarPositionLeft
);
}
if
(
isPanelFocus
)
{
return
this
.
navigateOnPanelFocus
(
isEditorGroupVertical
,
isSidebarPositionLeft
);
}
if
(
isSidebarFocus
)
{
return
this
.
navigateOnSidebarFocus
(
isEditorGroupVertical
,
isSidebarPositionLeft
);
}
return
TPromise
.
as
(
false
);
}
protected
navigateOnEditorFocus
(
isEditorGroupVertical
:
boolean
,
isSidebarPositionLeft
:
boolean
):
TPromise
<
boolean
>
{
return
TPromise
.
as
(
true
);
}
protected
navigateOnPanelFocus
(
isEditorGroupVertical
:
boolean
,
isSidebarPositionLeft
:
boolean
):
TPromise
<
boolean
>
{
return
TPromise
.
as
(
true
);
}
protected
navigateOnSidebarFocus
(
isEditorGroupVertical
:
boolean
,
isSidebarPositionLeft
:
boolean
):
TPromise
<
boolean
>
{
return
TPromise
.
as
(
true
);
}
protected
navigateToPanel
():
TPromise
<
any
>
{
if
(
!
this
.
partService
.
isVisible
(
Parts
.
PANEL_PART
))
{
return
TPromise
.
as
(
false
);
}
const
activePanelId
=
this
.
panelService
.
getActivePanel
().
getId
();
return
this
.
panelService
.
openPanel
(
activePanelId
,
true
);
}
protected
navigateToSidebar
():
TPromise
<
any
>
{
if
(
!
this
.
partService
.
isVisible
(
Parts
.
SIDEBAR_PART
))
{
return
TPromise
.
as
(
false
);
}
const
activeViewletId
=
this
.
viewletService
.
getActiveViewlet
().
getId
();
return
this
.
viewletService
.
openViewlet
(
activeViewletId
,
true
);
}
protected
navigateToLastActiveEditor
():
TPromise
<
any
>
{
const
model
=
this
.
groupService
.
getStacksModel
();
if
(
model
.
groups
.
length
<
1
)
{
return
null
;
}
const
lastGroup
=
model
.
activeGroup
;
const
activeEditor
=
lastGroup
.
activeEditor
;
return
this
.
editorService
.
openEditor
(
activeEditor
,
null
,
model
.
positionOfGroup
(
lastGroup
));
}
protected
navigateToStartOfEditor
():
TPromise
<
any
>
{
const
model
=
this
.
groupService
.
getStacksModel
();
if
(
model
.
groups
.
length
<
1
)
{
return
null
;
}
const
firstGroup
=
model
.
getGroup
(
0
);
const
firstEditor
=
firstGroup
.
getEditor
(
0
);
return
this
.
editorService
.
openEditor
(
firstEditor
,
null
,
model
.
positionOfGroup
(
firstGroup
));
}
protected
navigateToEndOfEditor
():
TPromise
<
any
>
{
const
model
=
this
.
groupService
.
getStacksModel
();
if
(
model
.
groups
.
length
<
1
)
{
return
null
;
}
const
lastGroup
=
model
.
getGroup
(
model
.
groups
[
model
.
groups
.
length
-
1
].
id
);
const
lastEditor
=
lastGroup
.
getEditor
(
lastGroup
.
count
-
1
);
return
this
.
editorService
.
openEditor
(
lastEditor
,
null
,
model
.
positionOfGroup
(
lastGroup
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录