diff --git a/src/vs/workbench/api/browser/viewsExtensionPoint.ts b/src/vs/workbench/api/browser/viewsExtensionPoint.ts index 16b29f60591..ff322f7237f 100644 --- a/src/vs/workbench/api/browser/viewsExtensionPoint.ts +++ b/src/vs/workbench/api/browser/viewsExtensionPoint.ts @@ -327,7 +327,7 @@ class ViewsExtensionHandler implements IWorkbenchContribution { @IContextMenuService contextMenuService: IContextMenuService, @IExtensionService extensionService: IExtensionService, ) { - super(id, `${id}.state`, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); + super(id, `${id}.state`, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); } } diff --git a/src/vs/workbench/browser/parts/views/viewPaneContainer.ts b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts index 5d2b3bbefa6..bd80bbfd037 100644 --- a/src/vs/workbench/browser/parts/views/viewPaneContainer.ts +++ b/src/vs/workbench/browser/parts/views/viewPaneContainer.ts @@ -234,7 +234,8 @@ export abstract class ViewPane extends Pane implements IView { } export interface IViewPaneContainerOptions extends IPaneViewOptions { - showHeaderInTitleWhenSingleView: boolean; + mergeViewWithContainerWhenSingleView: boolean; + donotShowContainerTitleWhenMergedWithContainer?: boolean; } interface IViewPaneItem { @@ -346,14 +347,16 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer { getTitle(): string { const composite = Registry.as(ViewletExtensions.Viewlets).getViewlet(this.getId()) || Registry.as(PanelExtensions.Panels).getPanel(this.getId()); - let title = composite.name; - if (this.isSingleView()) { + if (this.isViewMergedWithContainer()) { const paneItemTitle = this.paneItems[0].pane.title; - title = paneItemTitle ? `${title}: ${paneItemTitle}` : title; + if (this.options.donotShowContainerTitleWhenMergedWithContainer) { + return this.paneItems[0].pane.title; + } + return paneItemTitle ? `${composite.name}: ${paneItemTitle}` : composite.name; } - return title; + return composite.name; } private showContextMenu(event: StandardMouseEvent): void { @@ -402,7 +405,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer { } getActions(): IAction[] { - if (this.isSingleView()) { + if (this.isViewMergedWithContainer()) { return this.paneItems[0].pane.getActions(); } @@ -410,7 +413,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer { } getSecondaryActions(): IAction[] { - if (this.isSingleView()) { + if (this.isViewMergedWithContainer()) { return this.paneItems[0].pane.getSecondaryActions(); } @@ -418,7 +421,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer { } getActionViewItem(action: IAction): IActionViewItem | undefined { - if (this.isSingleView()) { + if (this.isViewMergedWithContainer()) { return this.paneItems[0].pane.getActionViewItem(action); } @@ -459,14 +462,14 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer { } addPanes(panes: { pane: ViewPane, size: number, index?: number; }[]): void { - const wasSingleView = this.isSingleView(); + const wasMerged = this.isViewMergedWithContainer(); for (const { pane: pane, size, index } of panes) { this.addPane(pane, size, index); } this.updateViewHeaders(); - if (this.isSingleView() !== wasSingleView) { + if (this.isViewMergedWithContainer() !== wasMerged) { this.updateTitleArea(); } } @@ -643,7 +646,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer { private addPane(pane: ViewPane, size: number, index = this.paneItems.length - 1): void { const onDidFocus = pane.onDidFocus(() => this.lastFocusedPane = pane); const onDidChangeTitleArea = pane.onDidChangeTitleArea(() => { - if (this.isSingleView()) { + if (this.isViewMergedWithContainer()) { this.updateTitleArea(); } }); @@ -668,12 +671,12 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer { } removePanes(panes: ViewPane[]): void { - const wasSingleView = this.isSingleView(); + const wasMerged = this.isViewMergedWithContainer(); panes.forEach(pane => this.removePane(pane)); this.updateViewHeaders(); - if (wasSingleView !== this.isSingleView()) { + if (wasMerged !== this.isViewMergedWithContainer()) { this.updateTitleArea(); } } @@ -726,8 +729,8 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer { return assertIsDefined(this.paneview).getPaneSize(pane); } - protected updateViewHeaders(): void { - if (this.isSingleView()) { + private updateViewHeaders(): void { + if (this.isViewMergedWithContainer()) { this.paneItems[0].pane.setExpanded(true); this.paneItems[0].pane.headerVisible = false; } else { @@ -735,8 +738,8 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer { } } - protected isSingleView(): boolean { - if (!(this.options.showHeaderInTitleWhenSingleView && this.paneItems.length === 1)) { + private isViewMergedWithContainer(): boolean { + if (!(this.options.mergeViewWithContainerWhenSingleView && this.paneItems.length === 1)) { return false; } if (!this.areExtensionsReady) { diff --git a/src/vs/workbench/browser/parts/views/viewsViewlet.ts b/src/vs/workbench/browser/parts/views/viewsViewlet.ts index fa22f5d0b97..078939500ef 100644 --- a/src/vs/workbench/browser/parts/views/viewsViewlet.ts +++ b/src/vs/workbench/browser/parts/views/viewsViewlet.ts @@ -46,7 +46,7 @@ export abstract class FilterViewPaneContainer extends ViewPaneContainer { @IWorkspaceContextService contextService: IWorkspaceContextService ) { - super(viewletId, `${viewletId}.state`, { showHeaderInTitleWhenSingleView: false }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); + super(viewletId, `${viewletId}.state`, { mergeViewWithContainerWhenSingleView: false }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); this._register(onDidChangeFilterValue(newFilterValue => { this.filterValue = newFilterValue; this.onFilterChanged(newFilterValue); diff --git a/src/vs/workbench/contrib/debug/browser/debugViewlet.ts b/src/vs/workbench/contrib/debug/browser/debugViewlet.ts index 86fb545750b..562559bbd05 100644 --- a/src/vs/workbench/contrib/debug/browser/debugViewlet.ts +++ b/src/vs/workbench/contrib/debug/browser/debugViewlet.ts @@ -79,7 +79,7 @@ export class DebugViewPaneContainer extends ViewPaneContainer { @IContextKeyService private readonly contextKeyService: IContextKeyService, @INotificationService private readonly notificationService: INotificationService ) { - super(VIEWLET_ID, `${VIEWLET_ID}.state`, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); + super(VIEWLET_ID, `${VIEWLET_ID}.state`, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); this._register(this.debugService.onDidChangeState(state => this.onDebugServiceStateChange(state))); this._register(this.debugService.onDidNewSession(() => this.updateToolBar())); diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts index 32944476223..72c39d72b82 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts @@ -370,7 +370,7 @@ export class ExtensionsViewPaneContainer extends ViewPaneContainer implements IE @IContextMenuService contextMenuService: IContextMenuService, @IExtensionService extensionService: IExtensionService, ) { - super(VIEWLET_ID, `${VIEWLET_ID}.state`, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); + super(VIEWLET_ID, `${VIEWLET_ID}.state`, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); this.searchDelayer = new Delayer(500); this.nonEmptyWorkspaceContextKey = NonEmptyWorkspaceContext.bindTo(contextKeyService); diff --git a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts index 601ed0673d3..083cd8bd13d 100644 --- a/src/vs/workbench/contrib/files/browser/explorerViewlet.ts +++ b/src/vs/workbench/contrib/files/browser/explorerViewlet.ts @@ -183,7 +183,7 @@ export class ExplorerViewPaneContainer extends ViewPaneContainer { @IExtensionService extensionService: IExtensionService ) { - super(VIEWLET_ID, ExplorerViewPaneContainer.EXPLORER_VIEWS_STATE, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); + super(VIEWLET_ID, ExplorerViewPaneContainer.EXPLORER_VIEWS_STATE, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); this.viewletVisibleContextKey = ExplorerViewletVisibleContext.bindTo(contextKeyService); diff --git a/src/vs/workbench/contrib/scm/browser/scmViewlet.ts b/src/vs/workbench/contrib/scm/browser/scmViewlet.ts index 145596f7591..95fbff130af 100644 --- a/src/vs/workbench/contrib/scm/browser/scmViewlet.ts +++ b/src/vs/workbench/contrib/scm/browser/scmViewlet.ts @@ -116,7 +116,7 @@ export class SCMViewPaneContainer extends ViewPaneContainer implements IViewMode @IWorkspaceContextService protected contextService: IWorkspaceContextService, @IContextKeyService contextKeyService: IContextKeyService, ) { - super(VIEWLET_ID, SCMViewPaneContainer.STATE_KEY, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); + super(VIEWLET_ID, SCMViewPaneContainer.STATE_KEY, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); this.menus = instantiationService.createInstance(SCMMenus, undefined); this._register(this.menus.onDidChangeTitle(this.updateTitleArea, this)); diff --git a/src/vs/workbench/contrib/search/browser/searchViewlet.ts b/src/vs/workbench/contrib/search/browser/searchViewlet.ts index a216091af0c..4b153f60e47 100644 --- a/src/vs/workbench/contrib/search/browser/searchViewlet.ts +++ b/src/vs/workbench/contrib/search/browser/searchViewlet.ts @@ -48,7 +48,7 @@ export class SearchViewPaneContainer extends ViewPaneContainer { @IContextMenuService contextMenuService: IContextMenuService, @IExtensionService extensionService: IExtensionService, ) { - super(VIEWLET_ID, `${VIEWLET_ID}.state`, { showHeaderInTitleWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); + super(VIEWLET_ID, `${VIEWLET_ID}.state`, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService); } getTitle(): string {