Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
918e4933
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,发现更多精彩内容 >>
提交
918e4933
编写于
5月 07, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix when no views are registered to test extension
上级
bc03bc9b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
7 deletion
+17
-7
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+17
-7
未找到文件。
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
918e4933
...
@@ -57,7 +57,7 @@ export class ActivitybarPart extends Part {
...
@@ -57,7 +57,7 @@ export class ActivitybarPart extends Part {
private
globalActivityIdToActions
:
{
[
globalActivityId
:
string
]:
GlobalActivityAction
;
};
private
globalActivityIdToActions
:
{
[
globalActivityId
:
string
]:
GlobalActivityAction
;
};
private
placeholderComposites
:
IPlaceholderComposite
[]
=
[];
private
placeholderComposites
:
IPlaceholderComposite
[]
=
[];
private
extensionsRegist
er
ed
:
boolean
=
false
;
private
extensionsRegist
rationComplet
ed
:
boolean
=
false
;
private
compositeBar
:
CompositeBar
;
private
compositeBar
:
CompositeBar
;
private
compositeActions
:
{
[
compositeId
:
string
]:
{
activityAction
:
ViewletActivityAction
,
pinnedAction
:
ToggleCompositePinnedAction
}
};
private
compositeActions
:
{
[
compositeId
:
string
]:
{
activityAction
:
ViewletActivityAction
,
pinnedAction
:
ToggleCompositePinnedAction
}
};
...
@@ -100,7 +100,7 @@ export class ActivitybarPart extends Part {
...
@@ -100,7 +100,7 @@ export class ActivitybarPart extends Part {
}
}
private
onDidRegisterExtensions
():
void
{
private
onDidRegisterExtensions
():
void
{
this
.
extensionsRegist
er
ed
=
true
;
this
.
extensionsRegist
rationComplet
ed
=
true
;
this
.
removeNotExistingPlaceholderComposites
();
this
.
removeNotExistingPlaceholderComposites
();
this
.
updateCompositebar
();
this
.
updateCompositebar
();
}
}
...
@@ -214,7 +214,7 @@ export class ActivitybarPart extends Part {
...
@@ -214,7 +214,7 @@ export class ActivitybarPart extends Part {
const
placeHolderComposite
=
this
.
placeholderComposites
.
filter
(
c
=>
c
.
id
===
compositeId
)[
0
];
const
placeHolderComposite
=
this
.
placeholderComposites
.
filter
(
c
=>
c
.
id
===
compositeId
)[
0
];
compositeActions
=
{
compositeActions
=
{
activityAction
:
this
.
instantiationService
.
createInstance
(
PlaceHolderViewletActivityAction
,
compositeId
,
placeHolderComposite
.
iconUrl
),
activityAction
:
this
.
instantiationService
.
createInstance
(
PlaceHolderViewletActivityAction
,
compositeId
,
placeHolderComposite
.
iconUrl
),
pinnedAction
:
new
PlaceHolderToggleCompositePinnedAction
(
compositeId
,
placeHolderComposite
.
iconUrl
,
this
.
compositeBar
)
pinnedAction
:
new
PlaceHolderToggleCompositePinnedAction
(
compositeId
,
this
.
compositeBar
)
};
};
}
}
this
.
compositeActions
[
compositeId
]
=
compositeActions
;
this
.
compositeActions
[
compositeId
]
=
compositeActions
;
...
@@ -225,8 +225,18 @@ export class ActivitybarPart extends Part {
...
@@ -225,8 +225,18 @@ export class ActivitybarPart extends Part {
private
updateCompositebar
():
void
{
private
updateCompositebar
():
void
{
const
viewlets
=
this
.
viewletService
.
getViewlets
();
const
viewlets
=
this
.
viewletService
.
getViewlets
();
for
(
const
viewlet
of
viewlets
)
{
for
(
const
viewlet
of
viewlets
)
{
if
(
!
this
.
extensionsRegistered
||
this
.
canShow
(
viewlet
))
{
const
hasPlaceholder
=
this
.
placeholderComposites
.
some
(
c
=>
c
.
id
===
viewlet
.
id
);
// Add the composite if it has views registered or
// If it was existing before and the extensions registration is not yet completed.
if
(
this
.
hasRegisteredViews
(
viewlet
)
||
(
hasPlaceholder
&&
!
this
.
extensionsRegistrationCompleted
)
)
{
this
.
compositeBar
.
addComposite
(
viewlet
,
false
);
this
.
compositeBar
.
addComposite
(
viewlet
,
false
);
// Pin it by default if it is new => it does not has a placeholder
if
(
!
hasPlaceholder
)
{
this
.
compositeBar
.
pin
(
viewlet
.
id
);
}
this
.
enableCompositeActions
(
viewlet
);
this
.
enableCompositeActions
(
viewlet
);
const
activeViewlet
=
this
.
viewletService
.
getActiveViewlet
();
const
activeViewlet
=
this
.
viewletService
.
getActiveViewlet
();
if
(
activeViewlet
&&
activeViewlet
.
getId
()
===
viewlet
.
id
)
{
if
(
activeViewlet
&&
activeViewlet
.
getId
()
===
viewlet
.
id
)
{
...
@@ -277,7 +287,7 @@ export class ActivitybarPart extends Part {
...
@@ -277,7 +287,7 @@ export class ActivitybarPart extends Part {
}
}
}
}
private
canShow
(
viewlet
:
ViewletDescriptor
):
boolean
{
private
hasRegisteredViews
(
viewlet
:
ViewletDescriptor
):
boolean
{
const
viewLocation
=
ViewLocation
.
get
(
viewlet
.
id
);
const
viewLocation
=
ViewLocation
.
get
(
viewlet
.
id
);
if
(
viewLocation
)
{
if
(
viewLocation
)
{
return
ViewsRegistry
.
getViews
(
viewLocation
).
length
>
0
;
return
ViewsRegistry
.
getViews
(
viewLocation
).
length
>
0
;
...
@@ -313,7 +323,7 @@ export class ActivitybarPart extends Part {
...
@@ -313,7 +323,7 @@ export class ActivitybarPart extends Part {
}
}
public
shutdown
():
void
{
public
shutdown
():
void
{
const
state
=
this
.
viewletService
.
getViewlets
().
filter
(
viewlet
=>
!!
viewlet
.
iconUrl
&&
this
.
canShow
(
viewlet
)).
map
(
viewlet
=>
({
id
:
viewlet
.
id
,
iconUrl
:
viewlet
.
iconUrl
}));
const
state
=
this
.
viewletService
.
getViewlets
().
filter
(
viewlet
=>
this
.
hasRegisteredViews
(
viewlet
)).
map
(
viewlet
=>
({
id
:
viewlet
.
id
,
iconUrl
:
viewlet
.
iconUrl
}));
this
.
storageService
.
store
(
ActivitybarPart
.
PLACEHOLDER_VIEWLETS
,
JSON
.
stringify
(
state
),
StorageScope
.
GLOBAL
);
this
.
storageService
.
store
(
ActivitybarPart
.
PLACEHOLDER_VIEWLETS
,
JSON
.
stringify
(
state
),
StorageScope
.
GLOBAL
);
this
.
compositeBar
.
shutdown
();
this
.
compositeBar
.
shutdown
();
super
.
shutdown
();
super
.
shutdown
();
...
@@ -360,7 +370,7 @@ class PlaceHolderViewletActivityAction extends ViewletActivityAction {
...
@@ -360,7 +370,7 @@ class PlaceHolderViewletActivityAction extends ViewletActivityAction {
class
PlaceHolderToggleCompositePinnedAction
extends
ToggleCompositePinnedAction
{
class
PlaceHolderToggleCompositePinnedAction
extends
ToggleCompositePinnedAction
{
constructor
(
constructor
(
id
:
string
,
iconUrl
:
string
,
compositeBar
:
ICompositeBar
id
:
string
,
compositeBar
:
ICompositeBar
)
{
)
{
super
({
id
,
name
:
id
,
cssClass
:
void
0
},
compositeBar
);
super
({
id
,
name
:
id
,
cssClass
:
void
0
},
compositeBar
);
this
.
enabled
=
false
;
this
.
enabled
=
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录