diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index c484a93693db7b043642f47496bbe4acda643dac..a10c9f18e9923433bbf89ab07b681f162a0e38ab 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -148,7 +148,7 @@ export class WindowsManager implements IWindowsMainService { this.windowsState.openedWindows = []; } - this.dialogs = new Dialogs(environmentService, telemetryService, stateService, this); + this.dialogs = new Dialogs(environmentService, telemetryService, stateService, this, this.logService); this.workspacesManager = new WorkspacesManager(workspacesMainService, backupMainService, environmentService, this); } @@ -1564,7 +1564,8 @@ class Dialogs { private environmentService: IEnvironmentService, private telemetryService: ITelemetryService, private stateService: IStateService, - private windowsMainService: IWindowsMainService + private windowsMainService: IWindowsMainService, + private logService: ILogService ) { this.mapWindowToDialogQueue = new Map>(); this.noWindowDialogQueue = new Queue(); @@ -1644,22 +1645,33 @@ class Dialogs { private getDialogQueue(window?: ICodeWindow): Queue { if (!window) { + this.logService.info('getDialogQueue: using NO WINDOW queue. size: ', this.noWindowDialogQueue.size); return this.noWindowDialogQueue; } let windowDialogQueue = this.mapWindowToDialogQueue.get(window.id); if (!windowDialogQueue) { + this.logService.info('getDialogQueue: creating window dialog queue for window:', window.id); windowDialogQueue = new Queue(); this.mapWindowToDialogQueue.set(window.id, windowDialogQueue); + } else { + this.logService.info('getDialogQueue: found existing window dialog queue for window:', window.id); } + this.logService.info('getDialogQueue: size: ', windowDialogQueue.size); + return windowDialogQueue; } public showMessageBox(options: Electron.MessageBoxOptions, window?: ICodeWindow): TPromise { + this.logService.info('showMessageBox begin: ', options, window ? window.id : 'No Window'); return this.getDialogQueue(window).queue(() => { return new TPromise((c, e) => { - dialog.showMessageBox(window ? window.win : void 0, options, (response: number, checkboxChecked: boolean) => c({ button: response, checkboxChecked })); + this.logService.info('showMessageBox opening'); + dialog.showMessageBox(window ? window.win : void 0, options, (response: number, checkboxChecked: boolean) => { + this.logService.info('showMessageBox closed, response: ', response, checkboxChecked); + c({ button: response, checkboxChecked }); + }); }); }); } @@ -1673,9 +1685,14 @@ class Dialogs { return path; } + this.logService.info('showSaveDialog begin: ', options, window ? window.id : 'No Window'); return this.getDialogQueue(window).queue(() => { return new TPromise((c, e) => { - dialog.showSaveDialog(window ? window.win : void 0, options, path => c(normalizePath(path))); + this.logService.info('showSaveDialog opening'); + dialog.showSaveDialog(window ? window.win : void 0, options, path => { + this.logService.info('showSaveDialog closed, response: ', path); + c(normalizePath(path)); + }); }); }); } @@ -1689,9 +1706,14 @@ class Dialogs { return paths; } + this.logService.info('showOpenDialog begin: ', options, window ? window.id : 'No Window'); return this.getDialogQueue(window).queue(() => { return new TPromise((c, e) => { - dialog.showOpenDialog(window ? window.win : void 0, options, paths => c(normalizePaths(paths))); + this.logService.info('showOpenDialog opening'); + dialog.showOpenDialog(window ? window.win : void 0, options, paths => { + this.logService.info('showOpenDialog closed, response: ', paths); + c(normalizePaths(paths)); + }); }); }); } diff --git a/src/vs/platform/windows/electron-browser/windowService.ts b/src/vs/platform/windows/electron-browser/windowService.ts index 8548cf17b9f4035a417abd196b6a4f1552991bef..693a9368628d51823f6aa08b0baafe7c337676f2 100644 --- a/src/vs/platform/windows/electron-browser/windowService.ts +++ b/src/vs/platform/windows/electron-browser/windowService.ts @@ -11,6 +11,7 @@ import { IWindowService, IWindowsService, INativeOpenDialogOptions, IEnterWorksp import { IRecentlyOpened } from 'vs/platform/history/common/history'; import { ICommandAction } from 'vs/platform/actions/common/actions'; import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces'; +import { ILogService } from 'vs/platform/log/common/log'; export class WindowService implements IWindowService { @@ -21,7 +22,8 @@ export class WindowService implements IWindowService { constructor( private windowId: number, private configuration: IWindowConfiguration, - @IWindowsService private windowsService: IWindowsService + @IWindowsService private windowsService: IWindowsService, + @ILogService private logService: ILogService ) { const onThisWindowFocus = mapEvent(filterEvent(windowsService.onWindowFocus, id => id === windowId), _ => true); const onThisWindowBlur = mapEvent(filterEvent(windowsService.onWindowBlur, id => id === windowId), _ => false); @@ -39,24 +41,32 @@ export class WindowService implements IWindowService { pickFileFolderAndOpen(options: INativeOpenDialogOptions): TPromise { options.windowId = this.windowId; + this.logService.info('pickFileFolderAndOpen: begin'); + return this.windowsService.pickFileFolderAndOpen(options); } pickFileAndOpen(options: INativeOpenDialogOptions): TPromise { options.windowId = this.windowId; + this.logService.info('pickFileAndOpen: begin'); + return this.windowsService.pickFileAndOpen(options); } pickFolderAndOpen(options: INativeOpenDialogOptions): TPromise { options.windowId = this.windowId; + this.logService.info('pickFolderAndOpen: begin'); + return this.windowsService.pickFolderAndOpen(options); } pickWorkspaceAndOpen(options: INativeOpenDialogOptions): TPromise { options.windowId = this.windowId; + this.logService.info('pickWorkspaceAndOpen: begin'); + return this.windowsService.pickWorkspaceAndOpen(options); } @@ -121,15 +131,27 @@ export class WindowService implements IWindowService { } showMessageBox(options: Electron.MessageBoxOptions): TPromise { - return this.windowsService.showMessageBox(this.windowId, options); + this.logService.info('showMessageBox begin: ', options); + return this.windowsService.showMessageBox(this.windowId, options).then(result => { + this.logService.info('showMessageBox closed, response: ', result); + return result; + }); } showSaveDialog(options: Electron.SaveDialogOptions): TPromise { - return this.windowsService.showSaveDialog(this.windowId, options); + this.logService.info('showSaveDialog begin: ', options); + return this.windowsService.showSaveDialog(this.windowId, options).then(result => { + this.logService.info('showSaveDialog begin: ', result); + return result; + }); } showOpenDialog(options: Electron.OpenDialogOptions): TPromise { - return this.windowsService.showOpenDialog(this.windowId, options); + this.logService.info('showOpenDialog begin: ', options); + return this.windowsService.showOpenDialog(this.windowId, options).then(result => { + this.logService.info('showOpenDialog closed: ', result); + return result; + }); } updateTouchBar(items: ICommandAction[][]): TPromise {