Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c0f8a7d9
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,发现更多精彩内容 >>
提交
c0f8a7d9
编写于
9月 23, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update panel activity actions dynamically
上级
05fe07ac
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
21 deletion
+25
-21
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+25
-21
未找到文件。
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
c0f8a7d9
...
...
@@ -12,9 +12,9 @@ import {Builder, $} from 'vs/base/browser/builder';
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
{
ActionsOrientation
,
ActionBar
,
IActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
ToolBar
}
from
'
vs/base/browser/ui/toolbar/toolbar
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
IViewlet
}
from
'
vs/workbench/common/viewlet
'
;
import
{
IComposite
}
from
'
vs/workbench/common/composite
'
;
import
{
IPanel
}
from
'
vs/workbench/common/panel
'
;
import
{
ViewletDescriptor
,
ViewletRegistry
,
Extensions
as
ViewletExtensions
,
Viewlet
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
CompositeDescriptor
,
Composite
}
from
'
vs/workbench/browser/composite
'
;
import
{
Panel
,
PanelRegistry
,
Extensions
as
PanelExtensions
}
from
'
vs/workbench/browser/panel
'
;
...
...
@@ -33,7 +33,6 @@ import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
export
class
ActivitybarPart
extends
Part
implements
IActivityService
{
public
_serviceBrand
:
any
;
private
compositeSwitcherBar
:
ActionBar
;
private
globalToolBar
:
ToolBar
;
private
activityActionItems
:
{
[
actionId
:
string
]:
IActionItem
;
};
private
compositeIdToActions
:
{
[
compositeId
:
string
]:
ActivityAction
;
};
private
viewletActions
:
Action
[];
...
...
@@ -62,31 +61,36 @@ export class ActivitybarPart extends Part implements IActivityService {
private
registerListeners
():
void
{
// Activate viewlet action on opening of a viewlet
this
.
toUnbind
.
push
(
this
.
viewletService
.
onDidViewletOpen
(
viewlet
=>
this
.
onActiveViewletChanged
(
viewlet
)));
this
.
toUnbind
.
push
(
this
.
viewletService
.
onDidViewletOpen
(
viewlet
=>
this
.
onActiveCompositeChanged
(
viewlet
)));
this
.
toUnbind
.
push
(
this
.
panelService
.
onDidPanelOpen
(
panel
=>
this
.
onActivePanelChanged
(
panel
)));
// Deactivate viewlet action on close
this
.
toUnbind
.
push
(
this
.
viewletService
.
onDidViewletClose
(
viewlet
=>
this
.
onViewletClosed
(
viewlet
)));
this
.
toUnbind
.
push
(
this
.
viewletService
.
onDidViewletClose
(
viewlet
=>
this
.
onCompositeClosed
(
viewlet
)));
this
.
toUnbind
.
push
(
this
.
panelService
.
onDidPanelClose
(
panel
=>
this
.
onPanelClosed
(
panel
)));
}
private
onActiveViewletChanged
(
viewlet
:
IViewlet
):
void
{
if
(
this
.
compositeIdToActions
[
viewlet
.
getId
()])
{
this
.
compositeIdToActions
[
viewlet
.
getId
()].
activate
();
// There can only be one active viewlet action
for
(
let
key
in
this
.
compositeIdToActions
)
{
if
(
this
.
compositeIdToActions
.
hasOwnProperty
(
key
)
&&
key
!==
viewlet
.
getId
()
&&
this
.
compositeIdToActions
[
key
]
instanceof
ViewletActivityAction
)
{
this
.
compositeIdToActions
[
key
].
deactivate
();
}
}
private
onActiveCompositeChanged
(
composite
:
IComposite
):
void
{
if
(
this
.
compositeIdToActions
[
composite
.
getId
()])
{
this
.
compositeIdToActions
[
composite
.
getId
()].
activate
();
}
}
private
onViewletClosed
(
viewlet
:
IViewlet
):
void
{
if
(
this
.
compositeIdToActions
[
viewlet
.
getId
()])
{
this
.
compositeIdToActions
[
viewlet
.
getId
()].
deactivate
();
private
onActivePanelChanged
(
panel
:
IPanel
):
void
{
this
.
updateActionBar
();
this
.
onActiveCompositeChanged
(
panel
);
}
private
onCompositeClosed
(
composite
:
IComposite
):
void
{
if
(
this
.
compositeIdToActions
[
composite
.
getId
()])
{
this
.
compositeIdToActions
[
composite
.
getId
()].
deactivate
();
}
}
private
onPanelClosed
(
panel
:
IPanel
):
void
{
this
.
updateActionBar
();
this
.
onCompositeClosed
(
panel
);
}
public
showActivity
(
compositeId
:
string
,
badge
:
IBadge
,
clazz
?:
string
):
void
{
const
action
=
this
.
compositeIdToActions
[
compositeId
];
if
(
action
)
{
...
...
@@ -149,6 +153,7 @@ export class ActivitybarPart extends Part implements IActivityService {
};
this
.
viewletActions
=
allViewlets
.
sort
((
v1
,
v2
)
=>
v1
.
order
-
v2
.
order
).
map
(
toAction
);
this
.
showPanelAction
=
this
.
instantiationService
.
createInstance
(
ShowPanelAction
);
this
.
activityActionItems
[
this
.
showPanelAction
.
id
]
=
new
ActivityActionItem
(
this
.
showPanelAction
);
this
.
panelActions
=
allPanels
.
sort
((
p1
,
p2
)
=>
p1
.
order
-
p2
.
order
).
map
(
toAction
);
...
...
@@ -169,9 +174,8 @@ export class ActivitybarPart extends Part implements IActivityService {
this
.
compositeSwitcherBar
=
null
;
}
if
(
this
.
globalToolBar
)
{
this
.
globalToolBar
.
dispose
();
this
.
globalToolBar
=
null
;
if
(
this
.
showPanelAction
)
{
this
.
showPanelAction
.
dispose
();
}
super
.
dispose
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录