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