Skip to content

Commit

Permalink
core: introduce workbench.tab.maximize
Browse files Browse the repository at this point in the history
Signed-off-by: vince-fugnitto <[email protected]>
  • Loading branch information
vince-fugnitto committed Jun 13, 2022
1 parent 7a3f6c6 commit 4cabd6b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
6 changes: 6 additions & 0 deletions packages/core/src/browser/core-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ export const corePreferenceSchema: PreferenceSchema = {
'Controls the feedback area size in pixels of the dragging area in between views/editors. Set it to a larger value if needed.'
)
},
'workbench.tab.maximize': {
type: 'boolean',
default: false,
description: nls.localize('theia/core/tabMaximize', 'Controls whether to maximize tabs on double click.')
}
}
};

Expand All @@ -220,6 +225,7 @@ export interface CoreConfiguration {
'workbench.hover.delay': number;
'workbench.sash.hoverDelay': number;
'workbench.sash.size': number;
'workbench.tab.maximize': boolean;
}

export const CorePreferenceContribution = Symbol('CorePreferenceContribution');
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/browser/frontend-application-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ export const frontendApplicationModule = new ContainerModule((bind, _unbind, _is
const iconThemeService = container.get(IconThemeService);
const selectionService = container.get(SelectionService);
const commandService = container.get<CommandService>(CommandService);
return new TabBarRenderer(contextMenuRenderer, tabBarDecoratorService, iconThemeService, selectionService, commandService);
const corePreferences = container.get<CorePreferences>(CorePreferences);
return new TabBarRenderer(contextMenuRenderer, tabBarDecoratorService, iconThemeService, selectionService, commandService, corePreferences);
});
bind(TheiaDockPanel.Factory).toFactory(({ container }) => options => {
const corePreferences = container.get<CorePreferences>(CorePreferences);
Expand Down
13 changes: 8 additions & 5 deletions packages/core/src/browser/shell/tab-bars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { BreadcrumbsRenderer, BreadcrumbsRendererFactory } from '../breadcrumbs/
import { NavigatableWidget } from '../navigatable-types';
import { IDragEvent } from '@phosphor/dragdrop';
import { PINNED_CLASS } from '../widgets/widget';
import { CorePreferences } from '../core-preferences';

/** The class name added to hidden content nodes, which are required to render vertical side bars. */
const HIDDEN_CONTENT_CLASS = 'theia-TabBar-hidden-content';
Expand Down Expand Up @@ -88,7 +89,8 @@ export class TabBarRenderer extends TabBar.Renderer {
protected readonly decoratorService?: TabBarDecoratorService,
protected readonly iconThemeService?: IconThemeService,
protected readonly selectionService?: SelectionService,
protected readonly commandService?: CommandService
protected readonly commandService?: CommandService,
protected readonly corePreferences?: CorePreferences
) {
super();
if (this.decoratorService) {
Expand Down Expand Up @@ -152,6 +154,7 @@ export class TabBarRenderer extends TabBar.Renderer {
{
key, className, id, title: title.caption, style, dataset,
oncontextmenu: this.handleContextMenuEvent,
ondblclick: this.handleDblClickEvent,
onauxclick: (e: MouseEvent) => {
// If user closes the tab using mouse wheel, nothing should be pasted to an active editor
e.preventDefault();
Expand Down Expand Up @@ -481,11 +484,10 @@ export class TabBarRenderer extends TabBar.Renderer {
}
};

/**
* @deprecated since 1.27.0.
* The framework no longer maximizes tabbars when performing a double-click.
*/
protected handleDblClickEvent = (event: MouseEvent) => {
if (!this.corePreferences?.get('workbench.tab.maximize')) {
return;
}
if (this.tabBar && event.currentTarget instanceof HTMLElement) {
const id = event.currentTarget.id;
// eslint-disable-next-line no-null/no-null
Expand All @@ -496,6 +498,7 @@ export class TabBarRenderer extends TabBar.Renderer {
}
}
};

}

/**
Expand Down

0 comments on commit 4cabd6b

Please sign in to comment.