Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1ebdb335
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,发现更多精彩内容 >>
提交
1ebdb335
编写于
3月 06, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reuse code
上级
12088887
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
61 deletion
+14
-61
src/vs/workbench/contrib/userDataSync/browser/userDataSyncView.ts
...orkbench/contrib/userDataSync/browser/userDataSyncView.ts
+14
-61
未找到文件。
src/vs/workbench/contrib/userDataSync/browser/userDataSyncView.ts
浏览文件 @
1ebdb335
...
@@ -21,9 +21,6 @@ import { fromNow } from 'vs/base/common/date';
...
@@ -21,9 +21,6 @@ import { fromNow } from 'vs/base/common/date';
import
{
pad
}
from
'
vs/base/common/strings
'
;
import
{
pad
}
from
'
vs/base/common/strings
'
;
import
{
ViewPaneContainer
}
from
'
vs/workbench/browser/parts/views/viewPaneContainer
'
;
import
{
ViewPaneContainer
}
from
'
vs/workbench/browser/parts/views/viewPaneContainer
'
;
const
CONTEXT_SHOW_USER_DATA_SYNC_REMOTE_HISTORY_VIEW
=
new
RawContextKey
<
boolean
>
(
'
showUserDataSyncRemoteHistoryView
'
,
false
);
const
CONTEXT_SHOW_USER_DATA_SYNC_LOCAL_HISTORY_VIEW
=
new
RawContextKey
<
boolean
>
(
'
showUserDataSyncLocalHistoryView
'
,
false
);
export
class
UserDataSyncViewContribution
implements
IWorkbenchContribution
{
export
class
UserDataSyncViewContribution
implements
IWorkbenchContribution
{
constructor
(
constructor
(
...
@@ -33,8 +30,8 @@ export class UserDataSyncViewContribution implements IWorkbenchContribution {
...
@@ -33,8 +30,8 @@ export class UserDataSyncViewContribution implements IWorkbenchContribution {
@
IUserDataSyncBackupStoreService
private
readonly
userDataSyncBackupStoreService
:
IUserDataSyncBackupStoreService
,
@
IUserDataSyncBackupStoreService
private
readonly
userDataSyncBackupStoreService
:
IUserDataSyncBackupStoreService
,
)
{
)
{
const
container
=
this
.
registerSyncViewContainer
();
const
container
=
this
.
registerSyncViewContainer
();
this
.
register
RemoteHistoryView
(
container
);
this
.
register
BackupView
(
container
,
true
);
this
.
register
LocalHistoryView
(
container
);
this
.
register
BackupView
(
container
,
false
);
}
}
private
registerSyncViewContainer
():
ViewContainer
{
private
registerSyncViewContainer
():
ViewContainer
{
...
@@ -51,58 +48,11 @@ export class UserDataSyncViewContribution implements IWorkbenchContribution {
...
@@ -51,58 +48,11 @@ export class UserDataSyncViewContribution implements IWorkbenchContribution {
},
ViewContainerLocation
.
Sidebar
);
},
ViewContainerLocation
.
Sidebar
);
}
}
private
registerRemoteHistoryView
(
container
:
ViewContainer
):
void
{
private
registerBackupView
(
container
:
ViewContainer
,
remote
:
boolean
):
void
{
const
id
=
'
workbench.views.sync.remoteHistory
'
;
const
id
=
`workbench.views.sync.
${
remote
?
'
remote
'
:
'
local
'
}
BackupView`
;
const
name
=
localize
(
'
title
'
,
"
Backup (Remote)
"
);
const
name
=
remote
?
localize
(
'
remote title
'
,
"
Backup (Remote)
"
)
:
localize
(
'
local title
'
,
"
Backup (Local)
"
);
const
viewEnablementContext
=
CONTEXT_SHOW_USER_DATA_SYNC_REMOTE_HISTORY_VIEW
.
bindTo
(
this
.
contextKeyService
);
const
contextKey
=
new
RawContextKey
<
boolean
>
(
`showUserDataSync
${
remote
?
'
Remote
'
:
'
Local
'
}
BackupView`
,
false
);
const
treeView
=
this
.
instantiationService
.
createInstance
(
TreeView
,
id
,
name
);
const
viewEnablementContext
=
contextKey
.
bindTo
(
this
.
contextKeyService
);
treeView
.
showCollapseAllAction
=
true
;
treeView
.
showRefreshAction
=
true
;
const
disposable
=
treeView
.
onDidChangeVisibility
(
visible
=>
{
if
(
visible
&&
!
treeView
.
dataProvider
)
{
disposable
.
dispose
();
treeView
.
dataProvider
=
this
.
instantiationService
.
createInstance
(
UserDataSyncHistoryViewDataProvider
,
id
,
(
resourceKey
:
ResourceKey
)
=>
this
.
userDataSyncStoreService
.
getAllRefs
(
resourceKey
),
(
resourceKey
:
ResourceKey
,
ref
:
string
)
=>
toRemoteSyncResource
(
resourceKey
,
ref
));
}
});
const
viewsRegistry
=
Registry
.
as
<
IViewsRegistry
>
(
Extensions
.
ViewsRegistry
);
viewsRegistry
.
registerViews
([
<
ITreeViewDescriptor
>
{
id
,
name
,
ctorDescriptor
:
new
SyncDescriptor
(
TreeViewPane
),
when
:
ContextKeyExpr
.
and
(
CONTEXT_SYNC_ENABLEMENT
,
CONTEXT_SHOW_USER_DATA_SYNC_REMOTE_HISTORY_VIEW
),
canToggleVisibility
:
true
,
canMoveView
:
true
,
treeView
,
collapsed
:
false
,
order
:
100
,
}],
container
);
registerAction2
(
class
extends
Action2
{
constructor
()
{
super
({
id
:
'
workbench.actions.showSyncRemoteHistoryView
'
,
title
:
{
value
:
localize
(
'
workbench.action.showSyncRemoteHistory
'
,
"
Show Backup (Remote)
"
),
original
:
`Show Backup (Remote)`
},
category
:
{
value
:
localize
(
'
sync
'
,
"
Sync
"
),
original
:
`Sync`
},
menu
:
{
id
:
MenuId
.
CommandPalette
,
when
:
CONTEXT_SYNC_ENABLEMENT
},
});
}
async
run
(
accessor
:
ServicesAccessor
):
Promise
<
void
>
{
viewEnablementContext
.
set
(
true
);
accessor
.
get
(
IViewsService
).
openView
(
id
,
true
);
}
});
this
.
registerActions
(
id
);
}
private
registerLocalHistoryView
(
container
:
ViewContainer
):
void
{
const
id
=
'
workbench.views.sync.localHistory
'
;
const
name
=
localize
(
'
local view title
'
,
"
Backup (Local)
"
);
const
viewEnablementContext
=
CONTEXT_SHOW_USER_DATA_SYNC_LOCAL_HISTORY_VIEW
.
bindTo
(
this
.
contextKeyService
);
const
treeView
=
this
.
instantiationService
.
createInstance
(
TreeView
,
id
,
name
);
const
treeView
=
this
.
instantiationService
.
createInstance
(
TreeView
,
id
,
name
);
treeView
.
showCollapseAllAction
=
true
;
treeView
.
showCollapseAllAction
=
true
;
treeView
.
showRefreshAction
=
true
;
treeView
.
showRefreshAction
=
true
;
...
@@ -110,7 +60,8 @@ export class UserDataSyncViewContribution implements IWorkbenchContribution {
...
@@ -110,7 +60,8 @@ export class UserDataSyncViewContribution implements IWorkbenchContribution {
if
(
visible
&&
!
treeView
.
dataProvider
)
{
if
(
visible
&&
!
treeView
.
dataProvider
)
{
disposable
.
dispose
();
disposable
.
dispose
();
treeView
.
dataProvider
=
this
.
instantiationService
.
createInstance
(
UserDataSyncHistoryViewDataProvider
,
id
,
treeView
.
dataProvider
=
this
.
instantiationService
.
createInstance
(
UserDataSyncHistoryViewDataProvider
,
id
,
(
resourceKey
:
ResourceKey
)
=>
this
.
userDataSyncBackupStoreService
.
getAllRefs
(
resourceKey
),
(
resourceKey
:
ResourceKey
,
ref
:
string
)
=>
toLocalBackupSyncResource
(
resourceKey
,
ref
));
(
resourceKey
:
ResourceKey
)
=>
remote
?
this
.
userDataSyncStoreService
.
getAllRefs
(
resourceKey
)
:
this
.
userDataSyncBackupStoreService
.
getAllRefs
(
resourceKey
),
(
resourceKey
:
ResourceKey
,
ref
:
string
)
=>
remote
?
toRemoteSyncResource
(
resourceKey
,
ref
)
:
toLocalBackupSyncResource
(
resourceKey
,
ref
));
}
}
});
});
const
viewsRegistry
=
Registry
.
as
<
IViewsRegistry
>
(
Extensions
.
ViewsRegistry
);
const
viewsRegistry
=
Registry
.
as
<
IViewsRegistry
>
(
Extensions
.
ViewsRegistry
);
...
@@ -118,7 +69,7 @@ export class UserDataSyncViewContribution implements IWorkbenchContribution {
...
@@ -118,7 +69,7 @@ export class UserDataSyncViewContribution implements IWorkbenchContribution {
id
,
id
,
name
,
name
,
ctorDescriptor
:
new
SyncDescriptor
(
TreeViewPane
),
ctorDescriptor
:
new
SyncDescriptor
(
TreeViewPane
),
when
:
ContextKeyExpr
.
and
(
CONTEXT_SYNC_ENABLEMENT
,
CONTEXT_SHOW_USER_DATA_SYNC_LOCAL_HISTORY_VIEW
),
when
:
ContextKeyExpr
.
and
(
CONTEXT_SYNC_ENABLEMENT
,
contextKey
),
canToggleVisibility
:
true
,
canToggleVisibility
:
true
,
canMoveView
:
true
,
canMoveView
:
true
,
treeView
,
treeView
,
...
@@ -129,8 +80,10 @@ export class UserDataSyncViewContribution implements IWorkbenchContribution {
...
@@ -129,8 +80,10 @@ export class UserDataSyncViewContribution implements IWorkbenchContribution {
registerAction2
(
class
extends
Action2
{
registerAction2
(
class
extends
Action2
{
constructor
()
{
constructor
()
{
super
({
super
({
id
:
'
workbench.actions.showSyncLocalHistoryView
'
,
id
:
`workbench.actions.showSync
${
remote
?
'
Remote
'
:
'
Local
'
}
BackupView`
,
title
:
{
value
:
localize
(
'
workbench.action.showSyncLocalHistory
'
,
"
Show Backup (Local)
"
),
original
:
`Show Backup (Local)`
},
title
:
remote
?
{
value
:
localize
(
'
workbench.action.showSyncRemoteBackup
'
,
"
Show Backup (Remote)
"
),
original
:
`Show Backup (Remote)`
}
:
{
value
:
localize
(
'
workbench.action.showSyncLocalBackup
'
,
"
Show Backup (Local)
"
),
original
:
`Show Backup (Local)`
},
category
:
{
value
:
localize
(
'
sync
'
,
"
Sync
"
),
original
:
`Sync`
},
category
:
{
value
:
localize
(
'
sync
'
,
"
Sync
"
),
original
:
`Sync`
},
menu
:
{
menu
:
{
id
:
MenuId
.
CommandPalette
,
id
:
MenuId
.
CommandPalette
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录