Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
724f3176
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,发现更多精彩内容 >>
提交
724f3176
编写于
11月 16, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename placeholders to cached
上级
f8a3d948
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
21 deletion
+21
-21
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
...workbench/browser/parts/activitybar/activitybarActions.ts
+2
-2
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
...vs/workbench/browser/parts/activitybar/activitybarPart.ts
+19
-19
未找到文件。
src/vs/workbench/browser/parts/activitybar/activitybarActions.ts
浏览文件 @
724f3176
...
@@ -166,7 +166,7 @@ export class GlobalActivityActionItem extends ActivityActionItem {
...
@@ -166,7 +166,7 @@ export class GlobalActivityActionItem extends ActivityActionItem {
}
}
}
}
export
class
PlaceHolder
ViewletActivityAction
extends
ViewletActivityAction
{
export
class
Cached
ViewletActivityAction
extends
ViewletActivityAction
{
constructor
(
constructor
(
id
:
string
,
iconUrl
:
URI
,
id
:
string
,
iconUrl
:
URI
,
...
@@ -185,7 +185,7 @@ export class PlaceHolderViewletActivityAction extends ViewletActivityAction {
...
@@ -185,7 +185,7 @@ export class PlaceHolderViewletActivityAction extends ViewletActivityAction {
}
}
}
}
export
class
PlaceHolder
ToggleCompositePinnedAction
extends
ToggleCompositePinnedAction
{
export
class
Cached
ToggleCompositePinnedAction
extends
ToggleCompositePinnedAction
{
constructor
(
id
:
string
,
compositeBar
:
ICompositeBar
)
{
constructor
(
id
:
string
,
compositeBar
:
ICompositeBar
)
{
super
({
id
,
name
:
id
,
cssClass
:
void
0
},
compositeBar
);
super
({
id
,
name
:
id
,
cssClass
:
void
0
},
compositeBar
);
...
...
src/vs/workbench/browser/parts/activitybar/activitybarPart.ts
浏览文件 @
724f3176
...
@@ -10,7 +10,7 @@ import { ActionsOrientation, ActionBar } from 'vs/base/browser/ui/actionbar/acti
...
@@ -10,7 +10,7 @@ import { ActionsOrientation, ActionBar } from 'vs/base/browser/ui/actionbar/acti
import
{
GlobalActivityExtensions
,
IGlobalActivityRegistry
}
from
'
vs/workbench/common/activity
'
;
import
{
GlobalActivityExtensions
,
IGlobalActivityRegistry
}
from
'
vs/workbench/common/activity
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Part
}
from
'
vs/workbench/browser/part
'
;
import
{
Part
}
from
'
vs/workbench/browser/part
'
;
import
{
GlobalActivityActionItem
,
GlobalActivityAction
,
ViewletActivityAction
,
ToggleViewletAction
,
PlaceHolderToggleCompositePinnedAction
,
PlaceHolder
ViewletActivityAction
}
from
'
vs/workbench/browser/parts/activitybar/activitybarActions
'
;
import
{
GlobalActivityActionItem
,
GlobalActivityAction
,
ViewletActivityAction
,
ToggleViewletAction
,
CachedToggleCompositePinnedAction
,
Cached
ViewletActivityAction
}
from
'
vs/workbench/browser/parts/activitybar/activitybarActions
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
IBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
IPartService
,
Parts
,
Position
as
SideBarPosition
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IPartService
,
Parts
,
Position
as
SideBarPosition
}
from
'
vs/workbench/services/part/common/partService
'
;
...
@@ -33,12 +33,12 @@ import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
...
@@ -33,12 +33,12 @@ import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
import
{
IViewsService
,
IViewContainersRegistry
,
Extensions
as
ViewContainerExtensions
}
from
'
vs/workbench/common/views
'
;
import
{
IViewsService
,
IViewContainersRegistry
,
Extensions
as
ViewContainerExtensions
}
from
'
vs/workbench/common/views
'
;
import
{
IContextKeyService
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextKeyService
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
interface
I
Placeholder
Composite
{
interface
I
Cached
Composite
{
id
:
string
;
id
:
string
;
iconUrl
:
URI
;
iconUrl
:
URI
;
}
}
interface
ISerialized
PlaceholderComposite
extends
IPlaceholder
Composite
{
interface
ISerialized
CachedComposite
extends
ICached
Composite
{
whens
?:
string
[];
whens
?:
string
[];
}
}
...
@@ -46,14 +46,14 @@ export class ActivitybarPart extends Part {
...
@@ -46,14 +46,14 @@ export class ActivitybarPart extends Part {
private
static
readonly
ACTION_HEIGHT
=
50
;
private
static
readonly
ACTION_HEIGHT
=
50
;
private
static
readonly
PINNED_VIEWLETS
=
'
workbench.activity.pinnedViewlets
'
;
private
static
readonly
PINNED_VIEWLETS
=
'
workbench.activity.pinnedViewlets
'
;
private
static
readonly
PLACEHOLDER
_VIEWLETS
=
'
workbench.activity.placeholderViewlets
'
;
private
static
readonly
CACHED
_VIEWLETS
=
'
workbench.activity.placeholderViewlets
'
;
private
dimension
:
Dimension
;
private
dimension
:
Dimension
;
private
globalActionBar
:
ActionBar
;
private
globalActionBar
:
ActionBar
;
private
globalActivityIdToActions
:
{
[
globalActivityId
:
string
]:
GlobalActivityAction
;
}
=
Object
.
create
(
null
);
private
globalActivityIdToActions
:
{
[
globalActivityId
:
string
]:
GlobalActivityAction
;
}
=
Object
.
create
(
null
);
private
placeholderComposites
:
IPlaceholder
Composite
[]
=
[];
private
cachedComposites
:
ICached
Composite
[]
=
[];
private
compositeBar
:
CompositeBar
;
private
compositeBar
:
CompositeBar
;
private
compositeActions
:
{
[
compositeId
:
string
]:
{
activityAction
:
ViewletActivityAction
,
pinnedAction
:
ToggleCompositePinnedAction
}
}
=
Object
.
create
(
null
);
private
compositeActions
:
{
[
compositeId
:
string
]:
{
activityAction
:
ViewletActivityAction
,
pinnedAction
:
ToggleCompositePinnedAction
}
}
=
Object
.
create
(
null
);
...
@@ -87,17 +87,17 @@ export class ActivitybarPart extends Part {
...
@@ -87,17 +87,17 @@ export class ActivitybarPart extends Part {
overflowActionSize
:
ActivitybarPart
.
ACTION_HEIGHT
overflowActionSize
:
ActivitybarPart
.
ACTION_HEIGHT
}));
}));
const
previousState
=
this
.
storageService
.
get
(
ActivitybarPart
.
PLACEHOLDER
_VIEWLETS
,
StorageScope
.
GLOBAL
,
'
[]
'
);
const
previousState
=
this
.
storageService
.
get
(
ActivitybarPart
.
CACHED
_VIEWLETS
,
StorageScope
.
GLOBAL
,
'
[]
'
);
const
serialized
PlaceholderComposites
=
<
ISerializedPlaceholder
Composite
[]
>
JSON
.
parse
(
previousState
);
const
serialized
CachedComposites
=
<
ISerializedCached
Composite
[]
>
JSON
.
parse
(
previousState
);
this
.
placeholder
Composites
=
[];
this
.
cached
Composites
=
[];
for
(
const
{
id
,
iconUrl
,
whens
}
of
serialized
Placeholder
Composites
)
{
for
(
const
{
id
,
iconUrl
,
whens
}
of
serialized
Cached
Composites
)
{
if
(
whens
&&
whens
.
length
>
0
)
{
if
(
whens
&&
whens
.
length
>
0
)
{
if
(
whens
.
every
(
when
=>
!
contextKeyService
.
contextMatchesRules
(
ContextKeyExpr
.
deserialize
(
when
))))
{
if
(
whens
.
every
(
when
=>
!
contextKeyService
.
contextMatchesRules
(
ContextKeyExpr
.
deserialize
(
when
))))
{
// Hidden by default
// Hidden by default
continue
;
continue
;
}
}
}
}
this
.
placeholder
Composites
.
push
({
this
.
cached
Composites
.
push
({
id
,
id
,
iconUrl
:
typeof
iconUrl
===
'
object
'
?
URI
.
revive
(
iconUrl
)
:
void
0
iconUrl
:
typeof
iconUrl
===
'
object
'
?
URI
.
revive
(
iconUrl
)
:
void
0
});
});
...
@@ -253,10 +253,10 @@ export class ActivitybarPart extends Part {
...
@@ -253,10 +253,10 @@ export class ActivitybarPart extends Part {
pinnedAction
:
new
ToggleCompositePinnedAction
(
viewlet
,
this
.
compositeBar
)
pinnedAction
:
new
ToggleCompositePinnedAction
(
viewlet
,
this
.
compositeBar
)
};
};
}
else
{
}
else
{
const
placeHolderComposite
=
this
.
placeholder
Composites
.
filter
(
c
=>
c
.
id
===
compositeId
)[
0
];
const
cachedComposite
=
this
.
cached
Composites
.
filter
(
c
=>
c
.
id
===
compositeId
)[
0
];
compositeActions
=
{
compositeActions
=
{
activityAction
:
this
.
instantiationService
.
createInstance
(
PlaceHolderViewletActivityAction
,
compositeId
,
placeHolderComposite
&&
placeHolder
Composite
.
iconUrl
),
activityAction
:
this
.
instantiationService
.
createInstance
(
CachedViewletActivityAction
,
compositeId
,
cachedComposite
&&
cached
Composite
.
iconUrl
),
pinnedAction
:
new
PlaceHolder
ToggleCompositePinnedAction
(
compositeId
,
this
.
compositeBar
)
pinnedAction
:
new
Cached
ToggleCompositePinnedAction
(
compositeId
,
this
.
compositeBar
)
};
};
}
}
...
@@ -271,8 +271,8 @@ export class ActivitybarPart extends Part {
...
@@ -271,8 +271,8 @@ export class ActivitybarPart extends Part {
for
(
const
viewlet
of
viewlets
)
{
for
(
const
viewlet
of
viewlets
)
{
this
.
compositeBar
.
addComposite
(
viewlet
);
this
.
compositeBar
.
addComposite
(
viewlet
);
// Pin it by default if it is new => it
does not has a placeholder
// Pin it by default if it is new => it
is not in cache
if
(
this
.
placeholder
Composites
.
every
(
c
=>
c
.
id
!==
viewlet
.
id
))
{
if
(
this
.
cached
Composites
.
every
(
c
=>
c
.
id
!==
viewlet
.
id
))
{
this
.
compositeBar
.
pin
(
viewlet
.
id
);
this
.
compositeBar
.
pin
(
viewlet
.
id
);
}
}
...
@@ -309,10 +309,10 @@ export class ActivitybarPart extends Part {
...
@@ -309,10 +309,10 @@ export class ActivitybarPart extends Part {
private
enableCompositeActions
(
viewlet
:
ViewletDescriptor
):
void
{
private
enableCompositeActions
(
viewlet
:
ViewletDescriptor
):
void
{
const
{
activityAction
,
pinnedAction
}
=
this
.
getCompositeActions
(
viewlet
.
id
);
const
{
activityAction
,
pinnedAction
}
=
this
.
getCompositeActions
(
viewlet
.
id
);
if
(
activityAction
instanceof
PlaceHolder
ViewletActivityAction
)
{
if
(
activityAction
instanceof
Cached
ViewletActivityAction
)
{
activityAction
.
setActivity
(
viewlet
);
activityAction
.
setActivity
(
viewlet
);
}
}
if
(
pinnedAction
instanceof
PlaceHolder
ToggleCompositePinnedAction
)
{
if
(
pinnedAction
instanceof
Cached
ToggleCompositePinnedAction
)
{
pinnedAction
.
setActivity
(
viewlet
);
pinnedAction
.
setActivity
(
viewlet
);
}
}
}
}
...
@@ -347,7 +347,7 @@ export class ActivitybarPart extends Part {
...
@@ -347,7 +347,7 @@ export class ActivitybarPart extends Part {
protected
saveState
():
void
{
protected
saveState
():
void
{
const
viewContainerRegistry
=
Registry
.
as
<
IViewContainersRegistry
>
(
ViewContainerExtensions
.
ViewContainersRegistry
);
const
viewContainerRegistry
=
Registry
.
as
<
IViewContainersRegistry
>
(
ViewContainerExtensions
.
ViewContainersRegistry
);
const
state
:
ISerialized
Placeholder
Composite
[]
=
[];
const
state
:
ISerialized
Cached
Composite
[]
=
[];
for
(
const
{
id
,
iconUrl
}
of
this
.
viewletService
.
getAllViewlets
())
{
for
(
const
{
id
,
iconUrl
}
of
this
.
viewletService
.
getAllViewlets
())
{
const
viewContainer
=
viewContainerRegistry
.
get
(
id
);
const
viewContainer
=
viewContainerRegistry
.
get
(
id
);
const
whens
:
string
[]
=
[];
const
whens
:
string
[]
=
[];
...
@@ -360,7 +360,7 @@ export class ActivitybarPart extends Part {
...
@@ -360,7 +360,7 @@ export class ActivitybarPart extends Part {
}
}
state
.
push
({
id
,
iconUrl
,
whens
});
state
.
push
({
id
,
iconUrl
,
whens
});
}
}
this
.
storageService
.
store
(
ActivitybarPart
.
PLACEHOLDER
_VIEWLETS
,
JSON
.
stringify
(
state
),
StorageScope
.
GLOBAL
);
this
.
storageService
.
store
(
ActivitybarPart
.
CACHED
_VIEWLETS
,
JSON
.
stringify
(
state
),
StorageScope
.
GLOBAL
);
super
.
saveState
();
super
.
saveState
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录