Skip to content

Commit

Permalink
Issue reporter and process explorer windows should close when the par…
Browse files Browse the repository at this point in the history
…ent window closes, fixes #50716
  • Loading branch information
Rachel Macfarlane committed May 29, 2018
1 parent aad96ca commit 89faccc
Showing 1 changed file with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions src/vs/platform/issue/electron-main/issueService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,35 @@ export class IssueService implements IIssueService {

this._issueParentWindow = BrowserWindow.getFocusedWindow();
const position = this.getWindowPosition(this._issueParentWindow, 700, 800);
this._issueWindow = new BrowserWindow({
width: position.width,
height: position.height,
minWidth: 300,
minHeight: 200,
x: position.x,
y: position.y,
title: localize('issueReporter', "Issue Reporter"),
backgroundColor: data.styles.backgroundColor || DEFAULT_BACKGROUND_COLOR
});
if (!this._issueWindow) {
this._issueWindow = new BrowserWindow({
width: position.width,
height: position.height,
minWidth: 300,
minHeight: 200,
x: position.x,
y: position.y,
title: localize('issueReporter', "Issue Reporter"),
backgroundColor: data.styles.backgroundColor || DEFAULT_BACKGROUND_COLOR
});

this._issueWindow.setMenuBarVisibility(false); // workaround for now, until a menu is implemented
this._issueWindow.setMenuBarVisibility(false); // workaround for now, until a menu is implemented

// Modified when testing UI
const features: IssueReporterFeatures = {};
// Modified when testing UI
const features: IssueReporterFeatures = {};

this.logService.trace('issueService#openReporter: opening issue reporter');
this._issueWindow.loadURL(this.getIssueReporterPath(data, features));
this.logService.trace('issueService#openReporter: opening issue reporter');
this._issueWindow.loadURL(this.getIssueReporterPath(data, features));

this._issueWindow.on('close', () => this._issueWindow = null);

this._issueParentWindow.on('closed', () => {
this._issueWindow.close();
this._issueWindow = null;
});
}

this._issueWindow.focus();

return TPromise.as(null);
}
Expand All @@ -83,7 +94,8 @@ export class IssueService implements IIssueService {

// Create as singleton
if (!this._processExplorerWindow) {
const position = this.getWindowPosition(BrowserWindow.getFocusedWindow(), 800, 300);
const parentWindow = BrowserWindow.getFocusedWindow();
const position = this.getWindowPosition(parentWindow, 800, 300);
this._processExplorerWindow = new BrowserWindow({
skipTaskbar: true,
resizable: true,
Expand Down Expand Up @@ -119,6 +131,11 @@ export class IssueService implements IIssueService {
this._processExplorerWindow.loadURL(`${require.toUrl('vs/code/electron-browser/processExplorer/processExplorer.html')}?config=${encodeURIComponent(JSON.stringify(config))}`);

this._processExplorerWindow.on('close', () => this._processExplorerWindow = void 0);

parentWindow.on('close', () => {
this._processExplorerWindow.close();
this._processExplorerWindow = null;
});
}

// Focus
Expand Down

0 comments on commit 89faccc

Please sign in to comment.