diff --git a/src/vs/platform/dialogs/browser/dialogService.ts b/src/vs/platform/dialogs/browser/dialogService.ts index 517651193d1389dfaed522631c81cea21f83c6c3..5ddc105e9935cf9d1fdf7f4116675c5a13cf818e 100644 --- a/src/vs/platform/dialogs/browser/dialogService.ts +++ b/src/vs/platform/dialogs/browser/dialogService.ts @@ -97,7 +97,9 @@ export class DialogService implements IDialogService { EventHelper.stop(event, true); } } - } + }, + checkboxLabel: options && options.checkbox ? options.checkbox.label : undefined, + checkboxChecked: options && options.checkbox ? options.checkbox.checked : undefined }); dialogDisposables.add(dialog); @@ -107,7 +109,8 @@ export class DialogService implements IDialogService { dialogDisposables.dispose(); return { - choice: result.button + choice: result.button, + checkboxChecked: result.checkboxChecked }; } } diff --git a/src/vs/platform/dialogs/common/dialogs.ts b/src/vs/platform/dialogs/common/dialogs.ts index 2081f736eb4549a1291af931f7c10083c5ac33bf..e4d2672647015c99c4d4f20ade3fa1e703b39b69 100644 --- a/src/vs/platform/dialogs/common/dialogs.ts +++ b/src/vs/platform/dialogs/common/dialogs.ts @@ -143,6 +143,10 @@ export const IDialogService = createDecorator('dialogService'); export interface IDialogOptions { cancelId?: number; detail?: string; + checkbox?: { + label: string; + checked?: boolean; + }; } /** diff --git a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts index 7e3f18bd489e567fa9cc7a2a7882d1fdadb05988..49c83de1fc2af38d841716f7c2581a4abf341150 100644 --- a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts +++ b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts @@ -137,11 +137,13 @@ class NativeDialogService implements IDialogService { buttons, type: (severity === Severity.Info) ? 'question' : (severity === Severity.Error) ? 'error' : (severity === Severity.Warning) ? 'warning' : 'none', cancelId: dialogOptions ? dialogOptions.cancelId : undefined, - detail: dialogOptions ? dialogOptions.detail : undefined + detail: dialogOptions ? dialogOptions.detail : undefined, + checkboxLabel: dialogOptions && dialogOptions.checkbox ? dialogOptions.checkbox.label : undefined, + checkboxChecked: dialogOptions && dialogOptions.checkbox ? dialogOptions.checkbox.checked : undefined }); const result = await this.windowService.showMessageBox(options); - return { choice: buttonIndexMap[result.button] }; + return { choice: buttonIndexMap[result.button], checkboxChecked: result.checkboxChecked }; } private massageMessageBoxOptions(options: Electron.MessageBoxOptions): IMassagedMessageBoxOptions {