Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
f4df42f1
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,发现更多精彩内容 >>
提交
f4df42f1
编写于
6月 19, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #51234
上级
a979c738
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
16 deletion
+38
-16
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+5
-6
src/vs/workbench/browser/parts/compositebar/compositeBarActions.ts
...rkbench/browser/parts/compositebar/compositeBarActions.ts
+33
-10
未找到文件。
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
f4df42f1
...
...
@@ -306,10 +306,10 @@ export class ActivitybarPart extends Part {
private
enableCompositeActions
(
viewlet
:
ViewletDescriptor
):
void
{
const
{
activityAction
,
pinnedAction
}
=
this
.
getCompositeActions
(
viewlet
.
id
);
if
(
activityAction
instanceof
PlaceHolderViewletActivityAction
)
{
activityAction
.
enable
(
viewlet
);
activityAction
.
setActivity
(
viewlet
);
}
if
(
pinnedAction
instanceof
PlaceHolderToggleCompositePinnedAction
)
{
pinnedAction
.
enable
(
viewlet
);
pinnedAction
.
setActivity
(
viewlet
);
}
}
...
...
@@ -376,9 +376,8 @@ class PlaceHolderViewletActivityAction extends ViewletActivityAction {
this
.
enabled
=
false
;
}
enable
(
activity
:
IActivity
):
void
{
this
.
label
=
activity
.
name
;
this
.
class
=
activity
.
cssClass
;
setActivity
(
activity
:
IActivity
):
void
{
this
.
activity
=
activity
;
this
.
enabled
=
true
;
}
...
...
@@ -393,7 +392,7 @@ class PlaceHolderToggleCompositePinnedAction extends ToggleCompositePinnedAction
this
.
enabled
=
false
;
}
enable
(
activity
:
IActivity
):
void
{
setActivity
(
activity
:
IActivity
):
void
{
this
.
label
=
activity
.
name
;
this
.
enabled
=
true
;
}
...
...
src/vs/workbench/browser/parts/compositebar/compositeBarActions.ts
浏览文件 @
f4df42f1
...
...
@@ -54,6 +54,7 @@ export interface ICompositeBar {
export
class
ActivityAction
extends
Action
{
private
badge
:
IBadge
;
private
clazz
:
string
|
undefined
;
private
_onDidChangeActivity
=
new
Emitter
<
this
>
();
private
_onDidChangeBadge
=
new
Emitter
<
this
>
();
constructor
(
private
_activity
:
IActivity
)
{
...
...
@@ -66,6 +67,15 @@ export class ActivityAction extends Action {
return
this
.
_activity
;
}
public
set
activity
(
activity
:
IActivity
)
{
this
.
_activity
=
activity
;
this
.
_onDidChangeActivity
.
fire
(
this
);
}
public
get
onDidChangeActivity
():
Event
<
this
>
{
return
this
.
_onDidChangeActivity
.
event
;
}
public
get
onDidChangeBadge
():
Event
<
this
>
{
return
this
.
_onDidChangeBadge
.
event
;
}
...
...
@@ -127,6 +137,7 @@ export class ActivityActionItem extends BaseActionItem {
super
(
null
,
action
,
options
);
this
.
themeService
.
onThemeChange
(
this
.
onThemeChange
,
this
,
this
.
_callOnDispose
);
action
.
onDidChangeActivity
(
this
.
updateActivity
,
this
,
this
.
_callOnDispose
);
action
.
onDidChangeBadge
(
this
.
updateBadge
,
this
,
this
.
_callOnDispose
);
}
...
...
@@ -165,8 +176,7 @@ export class ActivityActionItem extends BaseActionItem {
// Make the container tab-able for keyboard navigation
this
.
$container
=
$
(
container
).
attr
({
tabIndex
:
'
0
'
,
role
:
'
button
'
,
title
:
this
.
activity
.
name
role
:
'
button
'
});
// Try hard to prevent keyboard only focus feedback when using mouse
...
...
@@ -186,27 +196,26 @@ export class ActivityActionItem extends BaseActionItem {
// Label
this
.
$label
=
$
(
'
a.action-label
'
).
appendTo
(
this
.
builder
);
if
(
this
.
activity
.
cssClass
)
{
this
.
$label
.
addClass
(
this
.
activity
.
cssClass
);
}
if
(
!
this
.
options
.
icon
)
{
this
.
$label
.
text
(
this
.
getAction
().
label
);
}
this
.
$badge
=
this
.
builder
.
clone
().
div
({
'
class
'
:
'
badge
'
},
badge
=>
{
this
.
$badgeContent
=
badge
.
div
({
'
class
'
:
'
badge-content
'
});
});
this
.
$badge
.
hide
();
this
.
updateActivity
();
this
.
updateStyles
();
this
.
updateBadge
();
}
private
onThemeChange
(
theme
:
ITheme
):
void
{
this
.
updateStyles
();
}
protected
updateActivity
():
void
{
this
.
updateLabel
();
this
.
updateTitle
(
this
.
activity
.
name
);
this
.
updateBadge
();
}
protected
updateBadge
():
void
{
const
action
=
this
.
getAction
();
if
(
!
this
.
$badge
||
!
this
.
$badgeContent
||
!
(
action
instanceof
ActivityAction
))
{
...
...
@@ -271,7 +280,19 @@ export class ActivityActionItem extends BaseActionItem {
}
else
{
title
=
this
.
activity
.
name
;
}
this
.
updateTitle
(
title
);
}
private
updateLabel
():
void
{
if
(
this
.
activity
.
cssClass
)
{
this
.
$label
.
addClass
(
this
.
activity
.
cssClass
);
}
if
(
!
this
.
options
.
icon
)
{
this
.
$label
.
text
(
this
.
getAction
().
label
);
}
}
private
updateTitle
(
title
:
string
):
void
{
[
this
.
$label
,
this
.
$badge
,
this
.
$container
].
forEach
(
b
=>
{
if
(
b
)
{
b
.
attr
(
'
aria-label
'
,
title
);
...
...
@@ -409,6 +430,8 @@ export class CompositeActionItem extends ActivityActionItem {
if
(
!
CompositeActionItem
.
manageExtensionAction
)
{
CompositeActionItem
.
manageExtensionAction
=
instantiationService
.
createInstance
(
ManageExtensionAction
);
}
compositeActivityAction
.
onDidChangeActivity
(()
=>
{
this
.
compositeActivity
=
null
;
this
.
updateActivity
();
},
this
,
this
.
_callOnDispose
);
}
protected
get
activity
():
IActivity
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录