Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
324bf923
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,发现更多精彩内容 >>
提交
324bf923
编写于
5月 13, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
open editors: context menu actions for closing
上级
4e9cc698
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
75 addition
and
4 deletion
+75
-4
src/vs/workbench/parts/files/browser/views/openEditorsViewer.ts
.../workbench/parts/files/browser/views/openEditorsViewer.ts
+75
-4
未找到文件。
src/vs/workbench/parts/files/browser/views/openEditorsViewer.ts
浏览文件 @
324bf923
...
@@ -11,7 +11,7 @@ import {IAction, Action} from 'vs/base/common/actions';
...
@@ -11,7 +11,7 @@ import {IAction, Action} from 'vs/base/common/actions';
import
treedefaults
=
require
(
'
vs/base/parts/tree/browser/treeDefaults
'
);
import
treedefaults
=
require
(
'
vs/base/parts/tree/browser/treeDefaults
'
);
import
tree
=
require
(
'
vs/base/parts/tree/browser/tree
'
);
import
tree
=
require
(
'
vs/base/parts/tree/browser/tree
'
);
import
{
IActionProvider
}
from
'
vs/base/parts/tree/browser/actionsRenderer
'
;
import
{
IActionProvider
}
from
'
vs/base/parts/tree/browser/actionsRenderer
'
;
import
{
IActionItem
,
ActionBar
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
IActionItem
,
ActionBar
,
Separator
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
IKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
IKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
dom
=
require
(
'
vs/base/browser/dom
'
);
import
dom
=
require
(
'
vs/base/browser/dom
'
);
import
{
IMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
IMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
...
@@ -254,7 +254,8 @@ export class Controller extends treedefaults.DefaultController {
...
@@ -254,7 +254,8 @@ export class Controller extends treedefaults.DefaultController {
if
(
event
.
target
&&
event
.
target
.
tagName
&&
event
.
target
.
tagName
.
toLowerCase
()
===
'
input
'
)
{
if
(
event
.
target
&&
event
.
target
.
tagName
&&
event
.
target
.
tagName
.
toLowerCase
()
===
'
input
'
)
{
return
false
;
return
false
;
}
}
if
(
!
(
element
instanceof
OpenEditor
))
{
// Check if clicked on some element
if
(
element
===
tree
.
getInput
())
{
return
false
;
return
false
;
}
}
...
@@ -326,11 +327,26 @@ export class ActionProvider implements IActionProvider {
...
@@ -326,11 +327,26 @@ export class ActionProvider implements IActionProvider {
}
}
public
hasSecondaryActions
(
tree
:
tree
.
ITree
,
element
:
any
):
boolean
{
public
hasSecondaryActions
(
tree
:
tree
.
ITree
,
element
:
any
):
boolean
{
return
element
instanceof
OpenEditor
;
return
element
instanceof
OpenEditor
||
element
instanceof
EditorGroup
;
}
}
public
getSecondaryActions
(
tree
:
tree
.
ITree
,
element
:
any
):
TPromise
<
IAction
[]
>
{
public
getSecondaryActions
(
tree
:
tree
.
ITree
,
element
:
any
):
TPromise
<
IAction
[]
>
{
return
TPromise
.
as
([]);
const
result
=
[];
if
(
element
instanceof
EditorGroup
)
{
result
.
push
(
this
.
instantiationService
.
createInstance
(
CloseAllEditorsInGroupAction
));
}
else
{
result
.
push
(
this
.
instantiationService
.
createInstance
(
CloseOpenEditorAction
));
result
.
push
(
new
Separator
());
result
.
push
(
this
.
instantiationService
.
createInstance
(
CloseOtherEditorsInGroupAction
));
result
.
push
(
this
.
instantiationService
.
createInstance
(
CloseAllEditorsInGroupAction
));
result
.
push
(
new
Separator
());
}
result
.
push
(
this
.
instantiationService
.
createInstance
(
CloseEditorsInOtherGroupsAction
));
result
.
push
(
new
Separator
());
result
.
push
(
this
.
instantiationService
.
createInstance
(
CloseAllEditorsAction
));
return
TPromise
.
as
(
result
);
}
}
public
getActionItem
(
tree
:
tree
.
ITree
,
element
:
any
,
action
:
IAction
):
IActionItem
{
public
getActionItem
(
tree
:
tree
.
ITree
,
element
:
any
,
action
:
IAction
):
IActionItem
{
...
@@ -351,3 +367,58 @@ class CloseOpenEditorAction extends Action {
...
@@ -351,3 +367,58 @@ class CloseOpenEditorAction extends Action {
return
this
.
editorService
.
closeEditor
(
position
,
openEditor
.
editorInput
);
return
this
.
editorService
.
closeEditor
(
position
,
openEditor
.
editorInput
);
}
}
}
}
class
CloseOtherEditorsInGroupAction
extends
Action
{
public
static
ID
=
'
workbench.files.action.closeOtherEditorsInGroup
'
;
constructor
(@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
)
{
super
(
CloseOtherEditorsInGroupAction
.
ID
,
nls
.
localize
(
'
closeOtherEditorsInGroup
'
,
"
Close Other Editors in Group
"
));
}
public
run
(
openEditor
:
OpenEditor
):
TPromise
<
any
>
{
const
position
=
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
openEditor
.
editorGroup
);
return
this
.
editorService
.
closeEditors
(
position
,
openEditor
.
editorInput
);
}
}
class
CloseAllEditorsInGroupAction
extends
Action
{
public
static
ID
=
'
workbench.files.action.closeAllEditorsInGroup
'
;
constructor
(@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
)
{
super
(
CloseAllEditorsInGroupAction
.
ID
,
nls
.
localize
(
'
closeAllEditorsInGroup
'
,
"
Close All Editors in Group
"
));
}
public
run
(
openEditor
:
OpenEditor
):
TPromise
<
any
>
{
const
position
=
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
openEditor
.
editorGroup
);
return
this
.
editorService
.
closeEditors
(
position
);
}
}
class
CloseEditorsInOtherGroupsAction
extends
Action
{
public
static
ID
=
'
workbench.files.action.closeEditorsInOtherGroups
'
;
constructor
(@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
)
{
super
(
CloseEditorsInOtherGroupsAction
.
ID
,
nls
.
localize
(
'
closeEditorsInOtherGroups
'
,
"
Close Editors in Other Groups
"
));
}
public
run
(
openEditor
:
OpenEditor
):
TPromise
<
any
>
{
const
position
=
this
.
editorService
.
getStacksModel
().
positionOfGroup
(
openEditor
.
editorGroup
);
return
this
.
editorService
.
closeAllEditors
(
position
);
}
}
class
CloseAllEditorsAction
extends
Action
{
public
static
ID
=
'
workbench.files.action.closeAllEditors
'
;
constructor
(@
IWorkbenchEditorService
private
editorService
:
IWorkbenchEditorService
)
{
super
(
CloseAllEditorsAction
.
ID
,
nls
.
localize
(
'
closeAllEditors
'
,
"
Close All Editors
"
));
}
public
run
():
TPromise
<
any
>
{
return
this
.
editorService
.
closeAllEditors
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录