Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
13a24e5c
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
13a24e5c
编写于
5月 26, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simplify context menu actions on editor/group actions (fixes #6596)
上级
29507354
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
42 deletion
+16
-42
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
...workbench/browser/parts/editor/sideBySideEditorControl.ts
+6
-20
src/vs/workbench/parts/files/browser/views/openEditorsViewer.ts
.../workbench/parts/files/browser/views/openEditorsViewer.ts
+10
-22
未找到文件。
src/vs/workbench/browser/parts/editor/sideBySideEditorControl.ts
浏览文件 @
13a24e5c
...
...
@@ -34,7 +34,7 @@ import {QuickOpenAction} from 'vs/workbench/browser/quickopen';
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybindingService
'
;
import
{
ShowEditorsInLeftGroupAction
,
ShowEditorsInCenterGroupAction
,
ShowEditorsInRightGroupAction
,
CloseEditorsInGroupAction
,
CloseEditorsInOtherGroupsAction
,
CloseAllEditorsAction
,
MoveGroupLeftAction
,
MoveGroupRightAction
,
SplitEditorAction
,
CloseEditorAction
}
from
'
vs/workbench/browser/parts/editor/editorActions
'
;
import
{
ShowEditorsInLeftGroupAction
,
ShowEditorsInCenterGroupAction
,
ShowEditorsInRightGroupAction
,
CloseEditorsInGroupAction
,
MoveGroupLeftAction
,
MoveGroupRightAction
,
SplitEditorAction
,
CloseEditorAction
}
from
'
vs/workbench/browser/parts/editor/editorActions
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
export
enum
Rochade
{
...
...
@@ -128,8 +128,6 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
private
moveGroupLeftActions
:
MoveGroupLeftAction
[];
private
moveGroupRightActions
:
MoveGroupRightAction
[];
private
closeEditorsInGroupActions
:
CloseEditorsInGroupAction
[];
private
closeEditorsInOtherGroupsActions
:
CloseEditorsInOtherGroupsAction
[];
private
closeAllEditorsAction
:
CloseAllEditorsAction
;
private
splitEditorAction
:
SplitEditorAction
;
private
leftSash
:
Sash
;
...
...
@@ -211,19 +209,13 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
this
.
splitEditorAction
=
this
.
instantiationService
.
createInstance
(
SplitEditorAction
,
SplitEditorAction
.
ID
,
SplitEditorAction
.
LABEL
);
// Move Group Left
this
.
moveGroupLeftActions
=
POSITIONS
.
map
((
position
)
=>
this
.
instantiationService
.
createInstance
(
MoveGroupLeftAction
,
MoveGroupLeftAction
.
ID
,
MoveGroupLeftAction
.
LABEL
));
this
.
moveGroupLeftActions
=
POSITIONS
.
map
((
position
)
=>
this
.
instantiationService
.
createInstance
(
MoveGroupLeftAction
,
MoveGroupLeftAction
.
ID
,
nls
.
localize
(
'
moveLeft
'
,
"
Move Left
"
)
));
// Move Group Right
this
.
moveGroupRightActions
=
POSITIONS
.
map
((
position
)
=>
this
.
instantiationService
.
createInstance
(
MoveGroupRightAction
,
MoveGroupRightAction
.
ID
,
MoveGroupRightAction
.
LABEL
));
this
.
moveGroupRightActions
=
POSITIONS
.
map
((
position
)
=>
this
.
instantiationService
.
createInstance
(
MoveGroupRightAction
,
MoveGroupRightAction
.
ID
,
nls
.
localize
(
'
moveRight
'
,
"
Move Right
"
)
));
// Close All Editors in Group
this
.
closeEditorsInGroupActions
=
POSITIONS
.
map
((
position
)
=>
this
.
instantiationService
.
createInstance
(
CloseEditorsInGroupAction
,
CloseEditorsInGroupAction
.
ID
,
CloseEditorsInGroupAction
.
LABEL
));
// Close Editors in Other Groups
this
.
closeEditorsInOtherGroupsActions
=
POSITIONS
.
map
((
position
)
=>
this
.
instantiationService
.
createInstance
(
CloseEditorsInOtherGroupsAction
,
CloseEditorsInOtherGroupsAction
.
ID
,
CloseEditorsInOtherGroupsAction
.
LABEL
));
// Close All Editors
this
.
closeAllEditorsAction
=
this
.
instantiationService
.
createInstance
(
CloseAllEditorsAction
,
CloseAllEditorsAction
.
ID
,
CloseAllEditorsAction
.
LABEL
);
this
.
closeEditorsInGroupActions
=
POSITIONS
.
map
((
position
)
=>
this
.
instantiationService
.
createInstance
(
CloseEditorsInGroupAction
,
CloseEditorsInGroupAction
.
ID
,
nls
.
localize
(
'
closeAll
'
,
"
Close All
"
)));
}
private
initStyles
():
void
{
...
...
@@ -1374,10 +1366,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
this
.
moveGroupLeftActions
[
position
],
this
.
moveGroupRightActions
[
position
],
new
Separator
(),
this
.
closeEditorsInGroupActions
[
position
],
this
.
closeEditorsInOtherGroupsActions
[
position
],
new
Separator
(),
this
.
closeAllEditorsAction
this
.
closeEditorsInGroupActions
[
position
]
];
}
...
...
@@ -1390,9 +1379,6 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
this
.
moveGroupRightActions
[
Position
.
LEFT
].
enabled
=
this
.
getVisibleEditorCount
()
>
1
;
this
.
moveGroupRightActions
[
Position
.
CENTER
].
enabled
=
this
.
getVisibleEditorCount
()
>
2
;
this
.
moveGroupRightActions
[
Position
.
RIGHT
].
enabled
=
false
;
// Close Editors in Other Groups
POSITIONS
.
map
((
position
)
=>
this
.
closeEditorsInOtherGroupsActions
[
position
].
enabled
=
this
.
getVisibleEditorCount
()
>
1
);
}
public
clearTitleArea
(
position
:
Position
):
void
{
...
...
@@ -1755,7 +1741,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
});
// Actions
[
this
.
splitEditorAction
,
this
.
closeAllEditorsAction
,
...
this
.
closeEditorActions
,
...
this
.
moveGroupLeftActions
,
...
this
.
moveGroupRightActions
,
...
this
.
closeEditorsInGroupActions
,
...
this
.
closeEditorsInOtherGroups
Actions
].
forEach
((
action
)
=>
{
[
this
.
splitEditorAction
,
...
this
.
closeEditorActions
,
...
this
.
moveGroupLeftActions
,
...
this
.
moveGroupRightActions
,
...
this
.
closeEditorsInGroup
Actions
].
forEach
((
action
)
=>
{
action
.
dispose
();
});
...
...
src/vs/workbench/parts/files/browser/views/openEditorsViewer.ts
浏览文件 @
13a24e5c
...
...
@@ -20,7 +20,7 @@ import {IMouseEvent, DragMouseEvent} from 'vs/base/browser/mouseEvent';
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IContextMenuService
,
ContextSubMenu
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybindingService
'
;
import
{
EditorOptions
,
EditorInput
,
UntitledEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
ITextFileService
,
AutoSaveMode
,
FileEditorInput
,
asFileResource
}
from
'
vs/workbench/parts/files/common/files
'
;
...
...
@@ -30,7 +30,7 @@ import {keybindingForAction, SaveFileAction, RevertFileAction, SaveFileAsAction,
import
{
CopyPathAction
,
RevealInOSAction
}
from
'
vs/workbench/parts/files/electron-browser/electronFileActions
'
;
import
{
OpenConsoleAction
}
from
'
vs/workbench/parts/execution/electron-browser/terminal.contribution
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
CloseOtherEditorsInGroupAction
,
CloseEditor
sInOtherGroupsAction
,
CloseEditorAction
,
CloseAllEditors
Action
,
CloseAllEditorsInGroupAction
}
from
'
vs/workbench/browser/parts/editor/editorActions
'
;
import
{
CloseOtherEditorsInGroupAction
,
CloseEditorAction
,
CloseAllEditorsInGroupAction
}
from
'
vs/workbench/browser/parts/editor/editorActions
'
;
const
$
=
dom
.
emmet
;
...
...
@@ -383,16 +383,14 @@ export class ActionProvider implements IActionProvider {
public
getSecondaryActions
(
tree
:
ITree
,
element
:
any
):
TPromise
<
IAction
[]
>
{
const
result
=
[];
const
autoSaveEnabled
=
this
.
textFileService
.
getAutoSaveMode
()
===
AutoSaveMode
.
AFTER_SHORT_DELAY
;
const
multipleGroups
=
this
.
model
.
groups
.
length
>
1
;
const
closeActions
=
[];
if
(
element
instanceof
EditorGroup
)
{
if
(
!
autoSaveEnabled
)
{
result
.
push
(
this
.
instantiationService
.
createInstance
(
SaveAllInGroupAction
,
SaveAllInGroupAction
.
ID
,
SaveAllInGroupAction
.
LABEL
));
result
.
push
(
this
.
instantiationService
.
createInstance
(
SaveAllInGroupAction
,
SaveAllInGroupAction
.
ID
,
nls
.
localize
(
'
saveAll
'
,
"
Save All
"
)
));
result
.
push
(
new
Separator
());
}
closeActions
.
push
(
this
.
instantiationService
.
createInstance
(
CloseAllEditorsInGroupAction
,
CloseAllEditorsInGroupAction
.
ID
,
CloseAllEditorsInGroupAction
.
LABEL
));
result
.
push
(
this
.
instantiationService
.
createInstance
(
CloseAllEditorsInGroupAction
,
CloseAllEditorsInGroupAction
.
ID
,
nls
.
localize
(
'
closeAll
'
,
"
Close All
"
)
));
}
else
{
const
openEditor
=
<
OpenEditor
>
element
;
const
resource
=
openEditor
.
getResource
();
...
...
@@ -410,12 +408,12 @@ export class ActionProvider implements IActionProvider {
result
.
push
(
this
.
instantiationService
.
createInstance
(
CopyPathAction
,
resource
));
// Files: Save / Revert
if
(
!
autoSaveEnabled
&&
openEditor
.
isDirty
()
)
{
if
(
!
autoSaveEnabled
)
{
result
.
push
(
new
Separator
());
const
saveAction
=
this
.
instantiationService
.
createInstance
(
SaveFileAction
,
SaveFileAction
.
ID
,
SaveFileAction
.
LABEL
);
saveAction
.
setResource
(
resource
);
saveAction
.
enabled
=
true
;
saveAction
.
enabled
=
openEditor
.
isDirty
()
;
result
.
push
(
saveAction
);
const
revertAction
=
this
.
instantiationService
.
createInstance
(
RevertFileAction
,
RevertFileAction
.
ID
,
RevertFileAction
.
LABEL
);
...
...
@@ -451,23 +449,13 @@ export class ActionProvider implements IActionProvider {
result
.
push
(
new
Separator
());
}
closeActions
.
push
(
this
.
instantiationService
.
createInstance
(
CloseEditorAction
,
CloseEditorAction
.
ID
,
CloseEditorAction
.
LABEL
));
closeActions
.
push
(
new
Separator
());
const
closeOtherEditorsInGroupAction
=
this
.
instantiationService
.
createInstance
(
CloseOtherEditorsInGroupAction
,
CloseOtherEditorsInGroupAction
.
ID
,
CloseOtherEditorsInGroupAction
.
LABEL
);
result
.
push
(
this
.
instantiationService
.
createInstance
(
CloseEditorAction
,
CloseEditorAction
.
ID
,
nls
.
localize
(
'
close
'
,
"
Close
"
)));
const
closeOtherEditorsInGroupAction
=
this
.
instantiationService
.
createInstance
(
CloseOtherEditorsInGroupAction
,
CloseOtherEditorsInGroupAction
.
ID
,
nls
.
localize
(
'
closeOthers
'
,
"
Close Others
"
));
closeOtherEditorsInGroupAction
.
enabled
=
openEditor
.
editorGroup
.
count
>
1
;
closeActions
.
push
(
closeOtherEditorsInGroupAction
);
closeActions
.
push
(
this
.
instantiationService
.
createInstance
(
CloseAllEditorsInGroupAction
,
CloseAllEditorsInGroupAction
.
ID
,
CloseAllEditorsInGroupAction
.
LABEL
));
closeActions
.
push
(
new
Separator
());
result
.
push
(
closeOtherEditorsInGroupAction
);
result
.
push
(
this
.
instantiationService
.
createInstance
(
CloseAllEditorsInGroupAction
,
CloseAllEditorsInGroupAction
.
ID
,
nls
.
localize
(
'
closeAll
'
,
"
Close All
"
)));
}
const
closeEditorInOtherGroupsAction
=
this
.
instantiationService
.
createInstance
(
CloseEditorsInOtherGroupsAction
,
CloseEditorsInOtherGroupsAction
.
ID
,
CloseEditorsInOtherGroupsAction
.
LABEL
);
closeEditorInOtherGroupsAction
.
enabled
=
multipleGroups
;
closeActions
.
push
(
closeEditorInOtherGroupsAction
);
closeActions
.
push
(
new
Separator
());
closeActions
.
push
(
this
.
instantiationService
.
createInstance
(
CloseAllEditorsAction
,
CloseAllEditorsAction
.
ID
,
CloseAllEditorsAction
.
LABEL
));
result
.
push
(
new
ContextSubMenu
(
nls
.
localize
(
'
close
'
,
"
Close
"
),
closeActions
));
return
TPromise
.
as
(
result
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录