From a8fc2bd9be2339fff59c9325a350d73ed470c95f Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 2 Oct 2019 15:12:46 +0200 Subject: [PATCH] fix #81763 --- .../dialogs/electron-browser/dialogService.ts | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts index 3c564000389..43caf27af2e 100644 --- a/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts +++ b/src/vs/workbench/services/dialogs/electron-browser/dialogService.ts @@ -43,10 +43,11 @@ export class DialogService implements IDialogService { _serviceBrand: undefined; - private impl: IDialogService; + private nativeImpl: IDialogService; + private customImpl: IDialogService; constructor( - @IConfigurationService configurationService: IConfigurationService, + @IConfigurationService private configurationService: IConfigurationService, @ILogService logService: ILogService, @ILayoutService layoutService: ILayoutService, @IThemeService themeService: IThemeService, @@ -56,27 +57,32 @@ export class DialogService implements IDialogService { @IClipboardService clipboardService: IClipboardService, @IElectronService electronService: IElectronService ) { + this.customImpl = new HTMLDialogService(logService, layoutService, themeService, keybindingService, productService, clipboardService); + this.nativeImpl = new NativeDialogService(logService, sharedProcessService, electronService, clipboardService); + } - // Use HTML based dialogs - if (configurationService.getValue('workbench.dialogs.customEnabled') === true) { - this.impl = new HTMLDialogService(logService, layoutService, themeService, keybindingService, productService, clipboardService); - } - // Electron dialog service - else { - this.impl = new NativeDialogService(logService, sharedProcessService, electronService, clipboardService); - } + private get useCustomDialog(): boolean { + return this.configurationService.getValue('workbench.dialogs.customEnabled') === true; } confirm(confirmation: IConfirmation): Promise { - return this.impl.confirm(confirmation); + if (this.useCustomDialog) { + return this.customImpl.confirm(confirmation); + } + + return this.nativeImpl.confirm(confirmation); } show(severity: Severity, message: string, buttons: string[], options?: IDialogOptions | undefined): Promise { - return this.impl.show(severity, message, buttons, options); + if (this.useCustomDialog) { + return this.customImpl.show(severity, message, buttons, options); + } + + return this.nativeImpl.show(severity, message, buttons, options); } about(): Promise { - return this.impl.about(); + return this.nativeImpl.about(); } } -- GitLab