Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
88e869a9
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,发现更多精彩内容 >>
提交
88e869a9
编写于
10月 18, 2016
作者:
P
Pine Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor activitybar and clean up
上级
13641598
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
28 addition
and
16 deletion
+28
-16
src/vs/platform/explorers/browser/explorerExtensionPoint.ts
src/vs/platform/explorers/browser/explorerExtensionPoint.ts
+3
-2
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+24
-13
src/vs/workbench/browser/viewlet.ts
src/vs/workbench/browser/viewlet.ts
+1
-1
未找到文件。
src/vs/platform/explorers/browser/explorerExtensionPoint.ts
浏览文件 @
88e869a9
...
@@ -43,7 +43,7 @@ namespace schema {
...
@@ -43,7 +43,7 @@ namespace schema {
}
}
ExtensionsRegistry
.
registerExtensionPoint
<
schema
.
IExplorer
>
(
'
explorer
'
,
schema
.
explorerContribtion
).
setHandler
(
extensions
=>
{
ExtensionsRegistry
.
registerExtensionPoint
<
schema
.
IExplorer
>
(
'
explorer
'
,
schema
.
explorerContribtion
).
setHandler
(
extensions
=>
{
let
baseOrder
=
200
;
let
baseOrder
=
200
;
// Stock viewlet order goes up to 100
let
descriptors
=
[];
let
descriptors
=
[];
for
(
let
extension
of
extensions
)
{
for
(
let
extension
of
extensions
)
{
...
@@ -69,7 +69,8 @@ ExtensionsRegistry.registerExtensionPoint<schema.IExplorer>('explorer', schema.e
...
@@ -69,7 +69,8 @@ ExtensionsRegistry.registerExtensionPoint<schema.IExplorer>('explorer', schema.e
'
workbench.view.customTreeExplorerViewlet.
'
+
treeExplorerNodeProviderId
,
'
workbench.view.customTreeExplorerViewlet.
'
+
treeExplorerNodeProviderId
,
treeLabel
,
treeLabel
,
treeExplorerNodeProviderId
,
treeExplorerNodeProviderId
,
baseOrder
++
baseOrder
++
,
true
));
));
}
}
Registry
.
as
<
ViewletRegistry
>
(
ViewletExtensions
.
Viewlets
).
registerExternalViewlets
(
descriptors
);
Registry
.
as
<
ViewletRegistry
>
(
ViewletExtensions
.
Viewlets
).
registerExternalViewlets
(
descriptors
);
...
...
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
88e869a9
...
@@ -33,7 +33,7 @@ export class ActivitybarPart extends Part implements IActivityService {
...
@@ -33,7 +33,7 @@ export class ActivitybarPart extends Part implements IActivityService {
private
viewletsToggleStatus
:
{
[
viewletId
:
string
]:
boolean
;
};
private
viewletsToggleStatus
:
{
[
viewletId
:
string
]:
boolean
;
};
private
registeredViewlets
:
string
[];
private
registeredViewlets
:
string
[];
private
VIEWLETS_TOGGLE_STATUS
=
"
workbench.activityBar.
enabledExternalViewlet
s
"
;
private
VIEWLETS_TOGGLE_STATUS
=
"
workbench.activityBar.
viewletsToggleStatu
s
"
;
constructor
(
constructor
(
id
:
string
,
id
:
string
,
...
@@ -103,6 +103,7 @@ export class ActivitybarPart extends Part implements IActivityService {
...
@@ -103,6 +103,7 @@ export class ActivitybarPart extends Part implements IActivityService {
public
toggleViewlet
(
viewletId
:
string
):
void
{
public
toggleViewlet
(
viewletId
:
string
):
void
{
this
.
viewletsToggleStatus
[
viewletId
]
=
!
this
.
viewletsToggleStatus
[
viewletId
];
this
.
viewletsToggleStatus
[
viewletId
]
=
!
this
.
viewletsToggleStatus
[
viewletId
];
this
.
setViewletsToggleStatus
();
this
.
setViewletsToggleStatus
();
this
.
refreshViewletSwitcher
();
}
}
private
setViewletsToggleStatus
():
void
{
private
setViewletsToggleStatus
():
void
{
...
@@ -128,25 +129,40 @@ export class ActivitybarPart extends Part implements IActivityService {
...
@@ -128,25 +129,40 @@ export class ActivitybarPart extends Part implements IActivityService {
const
$result
=
$
(
'
.content
'
).
appendTo
(
$el
);
const
$result
=
$
(
'
.content
'
).
appendTo
(
$el
);
// Top Actionbar with action items for each viewlet action
// Top Actionbar with action items for each viewlet action
this
.
createViewletSwitcher
(
$result
.
clone
());
this
.
createViewletSwitcher
(
$result
.
clone
()
.
addClass
(
'
position-top
'
)
);
return
$result
;
return
$result
;
}
}
private
createViewletSwitcher
(
div
:
Builder
):
void
{
private
createViewletSwitcher
(
div
:
Builder
):
void
{
// Composite switcher is on top
this
.
viewletSwitcherBar
=
new
ActionBar
(
div
,
{
this
.
viewletSwitcherBar
=
new
ActionBar
(
div
,
{
actionItemProvider
:
(
action
:
Action
)
=>
this
.
activityActionItems
[
action
.
id
],
actionItemProvider
:
(
action
:
Action
)
=>
this
.
activityActionItems
[
action
.
id
],
orientation
:
ActionsOrientation
.
VERTICAL
,
orientation
:
ActionsOrientation
.
VERTICAL
,
ariaLabel
:
nls
.
localize
(
'
activityBarAriaLabel
'
,
"
Active View Switcher
"
)
ariaLabel
:
nls
.
localize
(
'
activityBarAriaLabel
'
,
"
Active View Switcher
"
)
});
});
this
.
viewletSwitcherBar
.
getContainer
().
addClass
(
'
position-top
'
);
// Build Viewlet Actions in correct order
// Load stock viewlets
const
allViewlets
=
(
<
ViewletRegistry
>
Registry
.
as
(
ViewletExtensions
.
Viewlets
)).
getViewlets
();
const
allViewlets
=
(
<
ViewletRegistry
>
Registry
.
as
(
ViewletExtensions
.
Viewlets
)).
getViewlets
().
filter
(
v
=>
!
v
.
isExternal
);
const
viewletActions
=
allViewlets
.
sort
((
v1
,
v2
)
=>
v1
.
order
-
v2
.
order
).
map
(
viewlet
=>
this
.
toAction
(
viewlet
));
this
.
fillViewletSwitcher
(
allViewlets
);
}
private
refreshViewletSwitcher
():
void
{
this
.
viewletSwitcherBar
.
clear
();
// Load stock viewlets + enabled external viewlets
const
allEnabledViewlets
=
(
<
ViewletRegistry
>
Registry
.
as
(
ViewletExtensions
.
Viewlets
)).
getViewlets
().
filter
(
descriptor
=>
{
if
(
!
descriptor
.
isExternal
)
{
return
true
;
}
else
{
return
this
.
viewletsToggleStatus
[
descriptor
.
id
];
}
});
this
.
fillViewletSwitcher
(
allEnabledViewlets
);
}
private
fillViewletSwitcher
(
viewlets
:
ViewletDescriptor
[])
{
// Build Viewlet Actions in correct order
const
viewletActions
=
viewlets
.
sort
((
v1
,
v2
)
=>
v1
.
order
-
v2
.
order
).
map
(
v
=>
this
.
toAction
(
v
));
this
.
viewletSwitcherBar
.
push
(
viewletActions
,
{
label
:
true
,
icon
:
true
});
this
.
viewletSwitcherBar
.
push
(
viewletActions
,
{
label
:
true
,
icon
:
true
});
}
}
...
@@ -157,11 +173,6 @@ export class ActivitybarPart extends Part implements IActivityService {
...
@@ -157,11 +173,6 @@ export class ActivitybarPart extends Part implements IActivityService {
this
.
activityActionItems
[
action
.
id
]
=
new
ActivityActionItem
(
action
,
composite
.
name
,
this
.
getKeybindingLabel
(
composite
.
id
));
this
.
activityActionItems
[
action
.
id
]
=
new
ActivityActionItem
(
action
,
composite
.
name
,
this
.
getKeybindingLabel
(
composite
.
id
));
this
.
compositeIdToActions
[
composite
.
id
]
=
action
;
this
.
compositeIdToActions
[
composite
.
id
]
=
action
;
// Mark active viewlet as active
if
(
activeViewlet
&&
activeViewlet
.
getId
()
===
composite
.
id
)
{
action
.
activate
();
}
return
action
;
return
action
;
};
};
...
...
src/vs/workbench/browser/viewlet.ts
浏览文件 @
88e869a9
...
@@ -154,7 +154,7 @@ export abstract class ViewerViewlet extends Viewlet {
...
@@ -154,7 +154,7 @@ export abstract class ViewerViewlet extends Viewlet {
*/
*/
export
class
ViewletDescriptor
extends
CompositeDescriptor
<
Viewlet
>
{
export
class
ViewletDescriptor
extends
CompositeDescriptor
<
Viewlet
>
{
constructor
(
moduleId
:
string
,
ctorName
:
string
,
id
:
string
,
name
:
string
,
cssClass
?:
string
,
order
?:
number
)
{
constructor
(
moduleId
:
string
,
ctorName
:
string
,
id
:
string
,
name
:
string
,
cssClass
?:
string
,
order
?:
number
,
public
isExternal
:
boolean
=
false
)
{
super
(
moduleId
,
ctorName
,
id
,
name
,
cssClass
,
order
);
super
(
moduleId
,
ctorName
,
id
,
name
,
cssClass
,
order
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录