Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a0850eeb
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,发现更多精彩内容 >>
提交
a0850eeb
编写于
4月 19, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
create global viewlet toolbar
上级
dd6e5ee5
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
53 addition
and
25 deletion
+53
-25
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+41
-21
src/vs/workbench/browser/viewlet.ts
src/vs/workbench/browser/viewlet.ts
+10
-3
src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts
...ts/extensions/electron-browser/extensions.contribution.ts
+2
-1
未找到文件。
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
a0850eeb
...
...
@@ -35,6 +35,7 @@ import events = require('vs/base/common/events');
export
class
ActivitybarPart
extends
Part
implements
IActivityService
{
public
serviceId
=
IActivityService
;
private
viewletSwitcherBar
:
ActionBar
;
private
globalViewletSwitcherBar
:
ActionBar
;
private
globalToolBar
:
ToolBar
;
private
activityActionItems
:
{
[
actionId
:
string
]:
IActionItem
;
};
private
viewletIdToActions
:
{
[
viewletId
:
string
]:
ActivityAction
;
};
...
...
@@ -126,12 +127,21 @@ export class ActivitybarPart extends Part implements IActivityService {
});
this
.
viewletSwitcherBar
.
getContainer
().
addClass
(
'
position-top
'
);
// Global viewlet switcher is right below
this
.
globalViewletSwitcherBar
=
new
ActionBar
(
div
,
{
actionItemProvider
:
(
action
:
Action
)
=>
this
.
activityActionItems
[
action
.
id
],
orientation
:
ActionsOrientation
.
VERTICAL
,
ariaLabel
:
nls
.
localize
(
'
globalActivityBarAriaLabel
'
,
"
Active Global View Switcher
"
)
});
this
.
globalViewletSwitcherBar
.
getContainer
().
addClass
(
'
position-bottom
'
);
// Build Viewlet Actions in correct order
let
activeViewlet
=
this
.
viewletService
.
getActiveViewlet
();
let
registry
=
(
<
ViewletRegistry
>
Registry
.
as
(
ViewletExtensions
.
Viewlets
));
let
viewletActions
:
Action
[]
=
registry
.
getViewlets
()
.
sort
((
v1
:
ViewletDescriptor
,
v2
:
ViewletDescriptor
)
=>
v1
.
order
-
v2
.
order
)
.
map
((
viewlet
:
ViewletDescriptor
)
=>
{
const
activeViewlet
=
this
.
viewletService
.
getActiveViewlet
();
const
registry
=
(
<
ViewletRegistry
>
Registry
.
as
(
ViewletExtensions
.
Viewlets
));
const
allViewletActions
=
registry
.
getViewlets
();
const
actionOptions
=
{
label
:
true
,
icon
:
true
};
const
toAction
=
(
viewlet
:
ViewletDescriptor
)
=>
{
let
action
=
this
.
instantiationService
.
createInstance
(
ViewletActivityAction
,
viewlet
.
id
+
'
.activity-bar-action
'
,
viewlet
);
let
keybinding
:
string
=
null
;
...
...
@@ -149,11 +159,21 @@ export class ActivitybarPart extends Part implements IActivityService {
}
return
action
;
}
);
};
// Add to viewlet switcher
this
.
viewletSwitcherBar
.
push
(
allViewletActions
.
filter
(
v
=>
!
v
.
isGlobal
)
.
sort
((
v1
,
v2
)
=>
v1
.
order
-
v2
.
order
)
.
map
(
toAction
)
,
actionOptions
);
// Add to viewlet switcher
this
.
viewletSwitcherBar
.
push
(
viewletActions
,
{
label
:
true
,
icon
:
true
});
this
.
globalViewletSwitcherBar
.
push
(
allViewletActions
.
filter
(
v
=>
v
.
isGlobal
)
.
sort
((
v1
,
v2
)
=>
v1
.
order
-
v2
.
order
)
.
map
(
toAction
),
actionOptions
);
}
private
createGlobalToolBarArea
(
div
:
Builder
):
void
{
...
...
src/vs/workbench/browser/viewlet.ts
浏览文件 @
a0850eeb
...
...
@@ -158,7 +158,14 @@ export abstract class ViewerViewlet extends Viewlet {
/**
* A viewlet descriptor is a leightweight descriptor of a viewlet in the monaco workbench.
*/
export
class
ViewletDescriptor
extends
CompositeDescriptor
<
Viewlet
>
{
}
export
class
ViewletDescriptor
extends
CompositeDescriptor
<
Viewlet
>
{
public
isGlobal
:
boolean
;
constructor
(
moduleId
:
string
,
ctorName
:
string
,
id
:
string
,
name
:
string
,
cssClass
?:
string
,
order
?:
number
,
isGlobal
?:
boolean
)
{
super
(
moduleId
,
ctorName
,
id
,
name
,
cssClass
,
order
);
this
.
isGlobal
=
isGlobal
||
false
;
}
}
export
const
Extensions
=
{
Viewlets
:
'
workbench.contributions.viewlets
'
...
...
@@ -178,14 +185,14 @@ export class ViewletRegistry extends CompositeRegistry<Viewlet> {
* Returns the viewlet descriptor for the given id or null if none.
*/
public
getViewlet
(
id
:
string
):
ViewletDescriptor
{
return
this
.
getComposite
(
id
);
return
this
.
getComposite
(
id
)
as
ViewletDescriptor
;
}
/**
* Returns an array of registered viewlets known to the platform.
*/
public
getViewlets
():
ViewletDescriptor
[]
{
return
this
.
getComposits
();
return
this
.
getComposits
()
as
ViewletDescriptor
[]
;
}
/**
...
...
src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts
浏览文件 @
a0850eeb
...
...
@@ -64,7 +64,8 @@ const viewletDescriptor = new ViewletDescriptor(
'
workbench.viewlet.extensions
'
,
localize
(
'
extensions
'
,
"
Extensions
"
),
'
extensions
'
,
100
100
,
true
);
Registry
.
as
<
ViewletRegistry
>
(
ViewletExtensions
.
Viewlets
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录