Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
daa71ca0
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,发现更多精彩内容 >>
提交
daa71ca0
编写于
12月 02, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
c082cc53
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
16 deletion
+29
-16
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
...workbench/browser/parts/activitybar/activitybarActions.ts
+21
-6
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+8
-10
未找到文件。
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
浏览文件 @
daa71ca0
...
...
@@ -12,7 +12,7 @@ import errors = require('vs/base/common/errors');
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Builder
,
$
}
from
'
vs/base/browser/builder
'
;
import
{
DelayedDragHandler
}
from
'
vs/base/browser/dnd
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
Action
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
BaseActionItem
,
Separator
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
IActivityBarService
,
ProgressBadge
,
TextBadge
,
NumberBadge
,
IconBadge
,
IBadge
}
from
'
vs/workbench/services/activity/common/activityBarService
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
...
...
@@ -22,6 +22,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ViewletDescriptor
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
Keybinding
}
from
'
vs/base/common/keybinding
'
;
import
{
IViewletService
,
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IPartService
,
Parts
}
from
'
vs/workbench/services/part/common/partService
'
;
...
...
@@ -120,7 +121,6 @@ export class ActivityActionItem extends BaseActionItem {
action
:
ActivityAction
,
private
viewlet
:
ViewletDescriptor
,
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
@
IViewletService
private
viewletService
:
IViewletService
,
@
IActivityBarService
private
activityBarService
:
IActivityBarService
,
@
IKeybindingService
private
keybindingService
:
IKeybindingService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
...
...
@@ -131,8 +131,6 @@ export class ActivityActionItem extends BaseActionItem {
this
.
name
=
viewlet
.
name
;
this
.
_keybinding
=
this
.
getKeybindingLabel
(
viewlet
.
id
);
action
.
onDidChangeBadge
(
this
.
handleBadgeChangeEvenet
,
this
,
this
.
_callOnDispose
);
if
(
!
ActivityActionItem
.
manageExtensionAction
)
{
ActivityActionItem
.
manageExtensionAction
=
instantiationService
.
createInstance
(
ManageExtensionAction
);
}
...
...
@@ -140,6 +138,8 @@ export class ActivityActionItem extends BaseActionItem {
if
(
!
ActivityActionItem
.
toggleViewletPinnedAction
)
{
ActivityActionItem
.
toggleViewletPinnedAction
=
instantiationService
.
createInstance
(
ToggleViewletPinnedAction
,
void
0
);
}
action
.
onDidChangeBadge
(
this
.
handleBadgeChangeEvenet
,
this
,
this
.
_callOnDispose
);
}
private
getKeybindingLabel
(
id
:
string
):
string
{
...
...
@@ -422,6 +422,7 @@ export class ViewletOverflowActivityActionItem extends BaseActionItem {
private
getBadge
:
(
viewlet
:
ViewletDescriptor
)
=>
IBadge
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IViewletService
private
viewletService
:
IViewletService
,
@
IKeybindingService
private
keybindingService
:
IKeybindingService
,
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
)
{
super
(
null
,
action
);
...
...
@@ -451,10 +452,20 @@ export class ViewletOverflowActivityActionItem extends BaseActionItem {
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
this
.
builder
.
getHTMLElement
(),
getActions
:
()
=>
TPromise
.
as
(
this
.
actions
),
getKeyBinding
:
(
action
)
=>
this
.
getKeybinding
(
action
),
onHide
:
()
=>
dispose
(
this
.
actions
)
});
}
private
getKeybinding
(
action
:
IAction
):
Keybinding
{
const
opts
=
this
.
keybindingService
.
lookupKeybindings
(
action
.
id
);
if
(
opts
.
length
>
0
)
{
return
opts
[
0
];
// only take the first one
}
return
null
;
}
private
getActions
():
OpenViewletAction
[]
{
const
activeViewlet
=
this
.
viewletService
.
getActiveViewlet
();
...
...
@@ -503,11 +514,15 @@ class ManageExtensionAction extends Action {
class
OpenViewletAction
extends
Action
{
constructor
(
p
ublic
viewlet
:
ViewletDescriptor
,
p
rivate
_
viewlet
:
ViewletDescriptor
,
@
IPartService
private
partService
:
IPartService
,
@
IViewletService
private
viewletService
:
IViewletService
)
{
super
(
viewlet
.
id
,
viewlet
.
name
);
super
(
_viewlet
.
id
,
_viewlet
.
name
);
}
public
get
viewlet
():
ViewletDescriptor
{
return
this
.
_viewlet
;
}
public
run
():
TPromise
<
any
>
{
...
...
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
daa71ca0
...
...
@@ -21,7 +21,6 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import
{
IActivityBarService
,
IBadge
}
from
'
vs/workbench/services/activity/common/activityBarService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IExtensionService
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
Scope
as
MementoScope
}
from
'
vs/workbench/common/memento
'
;
...
...
@@ -48,8 +47,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
private
viewletOverflowAction
:
ViewletOverflowActivityAction
;
private
viewletOverflowActionItem
:
ViewletOverflowActivityActionItem
;
private
activityActionItems
:
{
[
actionId
:
string
]:
IActionItem
;
};
private
viewletIdToActions
:
{
[
viewletId
:
string
]:
ActivityAction
;
};
private
viewletIdToActionItems
:
{
[
viewletId
:
string
]:
IActionItem
;
};
private
viewletIdToActivity
:
{
[
viewletId
:
string
]:
IViewletActivity
;
};
private
memento
:
any
;
...
...
@@ -60,7 +59,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
id
:
string
,
@
IViewletService
private
viewletService
:
IViewletService
,
@
IExtensionService
private
extensionService
:
IExtensionService
,
@
IKeybindingService
private
keybindingService
:
IKeybindingService
,
@
IStorageService
private
storageService
:
IStorageService
,
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
...
...
@@ -68,7 +66,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
)
{
super
(
id
);
this
.
activity
ActionItems
=
Object
.
create
(
null
);
this
.
viewletIdTo
ActionItems
=
Object
.
create
(
null
);
this
.
viewletIdToActions
=
Object
.
create
(
null
);
this
.
viewletIdToActivity
=
Object
.
create
(
null
);
...
...
@@ -168,7 +166,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
private
createViewletSwitcher
(
div
:
Builder
):
void
{
this
.
viewletSwitcherBar
=
new
ActionBar
(
div
,
{
actionItemProvider
:
(
action
:
Action
)
=>
action
instanceof
ViewletOverflowActivityAction
?
this
.
viewletOverflowActionItem
:
this
.
activity
ActionItems
[
action
.
id
],
actionItemProvider
:
(
action
:
Action
)
=>
action
instanceof
ViewletOverflowActivityAction
?
this
.
viewletOverflowActionItem
:
this
.
viewletIdTo
ActionItems
[
action
.
id
],
orientation
:
ActionsOrientation
.
VERTICAL
,
ariaLabel
:
nls
.
localize
(
'
activityBarAriaLabel
'
,
"
Active View Switcher
"
),
animated
:
false
...
...
@@ -182,7 +180,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
// Always show the active viewlet even if it is marked to be hidden
const
activeViewlet
=
this
.
viewletService
.
getActiveViewlet
();
if
(
activeViewlet
&&
!
viewletsToShow
.
some
(
v
=>
v
.
id
===
activeViewlet
.
getId
()))
{
if
(
activeViewlet
&&
!
viewletsToShow
.
some
(
v
iewlet
=>
viewlet
.
id
===
activeViewlet
.
getId
()))
{
this
.
activeUnpinnedViewlet
=
this
.
viewletService
.
getViewlet
(
activeViewlet
.
getId
());
viewletsToShow
.
push
(
this
.
activeUnpinnedViewlet
);
}
else
{
...
...
@@ -201,7 +199,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
}
const
visibleViewlets
=
Object
.
keys
(
this
.
viewletIdToActions
);
const
visibleViewletsChange
=
!
arrays
.
equals
(
viewletsToShow
.
map
(
v
=>
v
.
id
),
visibleViewlets
);
const
visibleViewletsChange
=
!
arrays
.
equals
(
viewletsToShow
.
map
(
v
iewlet
=>
viewlet
.
id
),
visibleViewlets
);
// Pull out overflow action if there is a viewlet change so that we can add it to the end later
if
(
this
.
viewletOverflowAction
&&
visibleViewletsChange
)
{
...
...
@@ -292,16 +290,16 @@ export class ActivitybarPart extends Part implements IActivityBarService {
action
.
dispose
();
delete
this
.
viewletIdToActions
[
viewletId
];
const
actionItem
=
this
.
activity
ActionItems
[
action
.
id
];
const
actionItem
=
this
.
viewletIdTo
ActionItems
[
action
.
id
];
actionItem
.
dispose
();
delete
this
.
activity
ActionItems
[
action
.
id
];
delete
this
.
viewletIdTo
ActionItems
[
action
.
id
];
}
}
private
toAction
(
viewlet
:
ViewletDescriptor
):
ActivityAction
{
const
action
=
this
.
instantiationService
.
createInstance
(
ViewletActivityAction
,
viewlet
);
this
.
activity
ActionItems
[
action
.
id
]
=
this
.
instantiationService
.
createInstance
(
ActivityActionItem
,
action
,
viewlet
);
this
.
viewletIdTo
ActionItems
[
action
.
id
]
=
this
.
instantiationService
.
createInstance
(
ActivityActionItem
,
action
,
viewlet
);
this
.
viewletIdToActions
[
viewlet
.
id
]
=
action
;
return
action
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录