diff --git a/src/sql/workbench/parts/query/browser/queryResultsView.ts b/src/sql/workbench/parts/query/browser/queryResultsView.ts index 96b855ada2..39e738bf61 100644 --- a/src/sql/workbench/parts/query/browser/queryResultsView.ts +++ b/src/sql/workbench/parts/query/browser/queryResultsView.ts @@ -182,12 +182,10 @@ export class QueryResultsView extends Disposable { this.messagesTab = this._register(new MessagesTab(instantiationService)); this.chartTab = this._register(new ChartTab(instantiationService)); this._panelView = this._register(new TabbedPanel(container, { showHeaderWhenSingleView: false })); - attachTabbedPanelStyler(this._panelView, themeService); + this._register(attachTabbedPanelStyler(this._panelView, themeService)); this.qpTab = this._register(new QueryPlanTab()); this.topOperationsTab = this._register(new TopOperationsTab(instantiationService)); - attachTabbedPanelStyler(this._panelView, themeService); - this._panelView.pushTab(this.resultsTab); this._panelView.pushTab(this.messagesTab); this._register(this._panelView.onTabChange(e => { @@ -197,9 +195,6 @@ export class QueryResultsView extends Disposable { })); } - public style() { - } - private setQueryRunner(runner: QueryRunner) { this.resultsTab.queryRunner = runner; this.messagesTab.queryRunner = runner; @@ -211,20 +206,22 @@ export class QueryResultsView extends Disposable { this.input.state.visibleTabs = new Set(); this.input.state.activeTab = this.resultsTab.identifier; })); - if (this.input.state.visibleTabs.has(this.chartTab.identifier)) { - if (!this._panelView.contains(this.chartTab)) { - this._panelView.pushTab(this.chartTab); - } + if (this.input.state.visibleTabs.has(this.chartTab.identifier) && !this._panelView.contains(this.chartTab)) { + this._panelView.pushTab(this.chartTab); + } else if (!this.input.state.visibleTabs.has(this.chartTab.identifier) && this._panelView.contains(this.chartTab)) { + this._panelView.removeTab(this.chartTab.identifier); } - if (this.input.state.visibleTabs.has(this.qpTab.identifier)) { - if (!this._panelView.contains(this.qpTab)) { - this._panelView.pushTab(this.qpTab); - } + + if (this.input.state.visibleTabs.has(this.qpTab.identifier) && !this._panelView.contains(this.qpTab)) { + this._panelView.pushTab(this.qpTab); + } else if (!this.input.state.visibleTabs.has(this.qpTab.identifier) && this._panelView.contains(this.qpTab)) { + this._panelView.removeTab(this.qpTab.identifier); } - if (this.input.state.visibleTabs.has(this.topOperationsTab.identifier)) { - if (!this._panelView.contains(this.topOperationsTab)) { - this._panelView.pushTab(this.topOperationsTab); - } + + if (this.input.state.visibleTabs.has(this.topOperationsTab.identifier) && !this._panelView.contains(this.topOperationsTab)) { + this._panelView.pushTab(this.topOperationsTab); + } else if (!this.input.state.visibleTabs.has(this.topOperationsTab.identifier) && this._panelView.contains(this.topOperationsTab)) { + this._panelView.removeTab(this.topOperationsTab.identifier); } // restore query model view tabs