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 15, 2022
1 parent 82fdd9d commit 585a6a3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
- [monaco] removed static methods `init()`, `register()`, `restore(), `updateBodyUiTheme()` from `MonacoThemingService`; use instance methods `initialize()`, `registerParsedTheme()`, `restore()`, `updateBodyUiTheme()` instead. Removed `MonacoThemeRegistry.SINGLETON`, inject `MonacoThemeRegistry` instead. [#11213](https://github.com/eclipse-theia/theia/pull/11213)
- [core] removed handling that maximized tabbars when performing a double-click [#11279](https://github.com/eclipse-theia/theia/pull/11279)
- `handleDblClickEvent` in `tab-bars.ts` is deprecated.
- [core] double-click no longer maximizes a tab by default - controllable through `workbench.tab.maximize` preference [#11279](https://github.com/eclipse-theia/theia/pull/11279)

## v1.26.0 - 5/26/2022

Expand Down
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 @@ -176,7 +176,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 @@ -155,6 +157,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 @@ -485,11 +488,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 @@ -500,6 +502,7 @@ export class TabBarRenderer extends TabBar.Renderer {
}
}
};

}

/**
Expand Down

0 comments on commit 585a6a3

Please sign in to comment.