This commit is contained in:
Sandeep Somavarapu 2020-05-06 17:01:02 +02:00
parent f8c59fed50
commit 682b2bd92f

View file

@ -81,9 +81,10 @@ const resolveSettingsConflictsCommand = { id: 'workbench.userData.actions.resolv
const resolveKeybindingsConflictsCommand = { id: 'workbench.userData.actions.resolveKeybindingsConflicts', title: localize('showKeybindingsConflicts', "Preferences Sync: Show Keybindings Conflicts") };
const resolveSnippetsConflictsCommand = { id: 'workbench.userData.actions.resolveSnippetsConflicts', title: localize('showSnippetsConflicts', "Preferences Sync: Show User Snippets Conflicts") };
const configureSyncCommand = { id: 'workbench.userData.actions.configureSync', title: localize('configure sync', "Preferences Sync: Configure...") };
const showSyncActivityCommand = {
id: 'workbench.userData.actions.showSyncActivity',
title: localize('show sync log', "Preferences Sync: Show Log"),
const showSyncActivityCommand = { id: 'workbench.userData.actions.showSyncActivity', title: localize('show sync log', "Preferences Sync: Show Log") };
const syncNowCommand = {
id: 'workbench.userData.actions.syncNow',
title: localize('sync now', "Preferences Sync: Sync Now"),
description(userDataSyncService: IUserDataSyncService): string | undefined {
if (userDataSyncService.status === SyncStatus.Syncing) {
return localize('sync is on with syncing', "syncing");
@ -894,6 +895,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
private registerSyncStatusAction(): void {
const that = this;
const when = ContextKeyExpr.and(CONTEXT_SYNC_ENABLEMENT, CONTEXT_ACCOUNT_STATE.isEqualTo(AccountStatus.Available), CONTEXT_SYNC_STATE.notEqualsTo(SyncStatus.Uninitialized));
this.registerSyncNowAction();
this._register(registerAction2(class SyncStatusAction extends Action2 {
constructor() {
super({
@ -946,8 +948,9 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}
items.push({ id: configureSyncCommand.id, label: configureSyncCommand.title });
items.push({ id: showSyncSettingsCommand.id, label: showSyncSettingsCommand.title });
items.push({ id: showSyncActivityCommand.id, label: showSyncActivityCommand.title, description: showSyncActivityCommand.description(that.userDataSyncService) });
items.push({ id: showSyncActivityCommand.id, label: showSyncActivityCommand.title });
items.push({ type: 'separator' });
items.push({ id: syncNowCommand.id, label: syncNowCommand.title, description: syncNowCommand.description(that.userDataSyncService) });
if (that.userDataSyncEnablementService.canToggleEnablement()) {
const account = that.userDataSyncAccounts.current;
items.push({ id: stopSyncCommand.id, label: stopSyncCommand.title, description: account ? `${account.accountName} (${that.authenticationService.getDisplayName(account.authenticationProviderId)})` : undefined });
@ -969,6 +972,21 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
}));
}
private registerSyncNowAction(): void {
const that = this;
this._register(registerAction2(class SyncNowAction extends Action2 {
constructor() {
super({
id: syncNowCommand.id,
title: syncNowCommand.title,
});
}
run(): Promise<any> {
return that.userDataSyncService.sync();
}
}));
}
private registerTurnOffSyncAction(): void {
const that = this;
this._register(registerAction2(class StopSyncAction extends Action2 {