Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8ae184a4
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,发现更多精彩内容 >>
提交
8ae184a4
编写于
9月 22, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "restore global actions to activitybar"
This reverts commit
d4841dd0
.
上级
0a9bc827
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
1 addition
and
94 deletion
+1
-94
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+1
-94
未找到文件。
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
8ae184a4
...
...
@@ -12,7 +12,7 @@ import {Builder, $} from 'vs/base/browser/builder';
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
{
ActionsOrientation
,
ActionBar
,
IActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
CONTEXT
,
ToolBar
}
from
'
vs/base/browser/ui/toolbar/toolbar
'
;
import
{
ToolBar
}
from
'
vs/base/browser/ui/toolbar/toolbar
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
import
{
IViewlet
}
from
'
vs/workbench/common/viewlet
'
;
import
{
ViewletDescriptor
,
ViewletRegistry
,
Extensions
as
ViewletExtensions
}
from
'
vs/workbench/browser/viewlet
'
;
...
...
@@ -26,15 +26,10 @@ import {IInstantiationService} from 'vs/platform/instantiation/common/instantiat
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
Scope
,
IActionBarRegistry
,
Extensions
as
ActionBarExtensions
,
prepareActions
}
from
'
vs/workbench/browser/actionBarRegistry
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
IAction
}
from
'
vs/base/common/actions
'
;
import
events
=
require
(
'
vs/base/common/events
'
);
export
class
ActivitybarPart
extends
Part
implements
IActivityService
{
public
_serviceBrand
:
any
;
private
viewletSwitcherBar
:
ActionBar
;
private
globalViewletSwitcherBar
:
ActionBar
;
private
globalToolBar
:
ToolBar
;
private
activityActionItems
:
{
[
actionId
:
string
]:
IActionItem
;
};
private
viewletIdToActions
:
{
[
viewletId
:
string
]:
ActivityAction
;
};
...
...
@@ -105,9 +100,6 @@ export class ActivitybarPart extends Part implements IActivityService {
// Top Actionbar with action items for each viewlet action
this
.
createViewletSwitcher
(
$result
.
clone
());
// Bottom Toolbar with action items for global actions
this
.
createGlobalToolBarArea
(
$result
.
clone
());
// not used currently
return
$result
;
}
...
...
@@ -121,14 +113,6 @@ 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
const
activeViewlet
=
this
.
viewletService
.
getActiveViewlet
();
const
registry
=
(
<
ViewletRegistry
>
Registry
.
as
(
ViewletExtensions
.
Viewlets
));
...
...
@@ -161,83 +145,6 @@ export class ActivitybarPart extends Part implements IActivityService {
.
sort
((
v1
,
v2
)
=>
v1
.
order
-
v2
.
order
)
.
map
(
toAction
)
,
actionOptions
);
// Add to viewlet switcher
this
.
globalViewletSwitcherBar
.
push
(
allViewletActions
.
filter
(
v
=>
v
.
isGlobal
)
.
sort
((
v1
,
v2
)
=>
v1
.
order
-
v2
.
order
)
.
map
(
toAction
),
actionOptions
);
}
private
createGlobalToolBarArea
(
div
:
Builder
):
void
{
// Global action bar is on the bottom
this
.
globalToolBar
=
new
ToolBar
(
div
.
getHTMLElement
(),
this
.
contextMenuService
,
{
actionItemProvider
:
(
action
:
Action
)
=>
this
.
activityActionItems
[
action
.
id
],
orientation
:
ActionsOrientation
.
VERTICAL
});
this
.
globalToolBar
.
getContainer
().
addClass
(
'
global
'
);
this
.
globalToolBar
.
actionRunner
.
addListener2
(
events
.
EventType
.
RUN
,
(
e
:
any
)
=>
{
// Check for Error
if
(
e
.
error
&&
!
errors
.
isPromiseCanceledError
(
e
.
error
))
{
this
.
messageService
.
show
(
Severity
.
Error
,
e
.
error
);
}
// Log in telemetry
if
(
this
.
telemetryService
)
{
this
.
telemetryService
.
publicLog
(
'
workbenchActionExecuted
'
,
{
id
:
e
.
action
.
id
,
from
:
'
activityBar
'
});
}
});
// Build Global Actions in correct order
let
primaryActions
=
this
.
getGlobalActions
(
true
);
let
secondaryActions
=
this
.
getGlobalActions
(
false
);
if
(
primaryActions
.
length
+
secondaryActions
.
length
>
0
)
{
this
.
globalToolBar
.
getContainer
().
addClass
(
'
position-bottom
'
);
}
// Add to global action bar
this
.
globalToolBar
.
setActions
(
prepareActions
(
primaryActions
),
prepareActions
(
secondaryActions
))();
}
private
getGlobalActions
(
primary
:
boolean
):
IAction
[]
{
let
actionBarRegistry
=
<
IActionBarRegistry
>
Registry
.
as
(
ActionBarExtensions
.
Actionbar
);
// Collect actions from actionbar contributor
let
actions
:
IAction
[];
if
(
primary
)
{
actions
=
actionBarRegistry
.
getActionBarActionsForContext
(
Scope
.
GLOBAL
,
CONTEXT
);
}
else
{
actions
=
actionBarRegistry
.
getSecondaryActionBarActionsForContext
(
Scope
.
GLOBAL
,
CONTEXT
);
}
return
actions
.
map
((
action
:
ActivityAction
)
=>
{
if
(
primary
)
{
let
keybinding
:
string
=
null
;
let
keys
=
this
.
keybindingService
.
lookupKeybindings
(
action
.
id
).
map
(
k
=>
this
.
keybindingService
.
getLabelFor
(
k
));
if
(
keys
&&
keys
.
length
)
{
keybinding
=
keys
[
0
];
}
let
actionItem
=
actionBarRegistry
.
getActionItemForContext
(
Scope
.
GLOBAL
,
CONTEXT
,
action
);
if
(
!
actionItem
)
{
actionItem
=
new
ActivityActionItem
(
action
,
action
.
label
,
keybinding
);
}
if
(
actionItem
instanceof
ActivityActionItem
)
{
(
<
ActivityActionItem
>
actionItem
).
keybinding
=
keybinding
;
}
this
.
activityActionItems
[
action
.
id
]
=
actionItem
;
}
return
action
;
});
}
public
dispose
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录