Skip to content

Commit

Permalink
use WorkbenchToolBar in notebook editor toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Sep 16, 2022
1 parent 76d65d3 commit fa89b71
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { toolbarActiveBackground } from 'vs/platform/theme/common/colorRegistry';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { SELECT_KERNEL_ID } from 'vs/workbench/contrib/notebook/browser/controller/coreActions';
Expand All @@ -28,6 +27,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { IWorkbenchAssignmentService } from 'vs/workbench/services/assignment/common/assignmentService';
import { NotebookOptions } from 'vs/workbench/contrib/notebook/common/notebookOptions';
import { IActionViewItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
import { WorkbenchToolBar } from 'vs/platform/actions/browser/toolbar';

interface IActionModel {
action: IAction;
Expand Down Expand Up @@ -264,7 +264,7 @@ export class NotebookEditorToolbar extends Disposable {
private _notebookTopLeftToolbarContainer!: HTMLElement;
private _notebookTopRightToolbarContainer!: HTMLElement;
private _notebookGlobalActionsMenu!: IMenu;
private _notebookLeftToolbar!: ToolBar;
private _notebookLeftToolbar!: WorkbenchToolBar;
private _primaryActions: IActionModel[];
get primaryActions(): IActionModel[] {
return this._primaryActions;
Expand All @@ -273,7 +273,7 @@ export class NotebookEditorToolbar extends Disposable {
get secondaryActions(): IAction[] {
return this._secondaryActions;
}
private _notebookRightToolbar!: ToolBar;
private _notebookRightToolbar!: WorkbenchToolBar;
private _useGlobalToolbar: boolean = false;
private _strategy!: IActionLayoutStrategy;
private _renderLabel: RenderLabel = RenderLabel.Always;
Expand All @@ -297,7 +297,6 @@ export class NotebookEditorToolbar extends Disposable {
@IContextMenuService readonly contextMenuService: IContextMenuService,
@IMenuService readonly menuService: IMenuService,
@IEditorService private readonly editorService: IEditorService,
@IKeybindingService private readonly keybindingService: IKeybindingService,
@IWorkbenchAssignmentService private readonly experimentService: IWorkbenchAssignmentService
) {
super();
Expand Down Expand Up @@ -369,8 +368,7 @@ export class NotebookEditorToolbar extends Disposable {
}
};

this._notebookLeftToolbar = new ToolBar(this._notebookTopLeftToolbarContainer, this.contextMenuService, {
getKeyBinding: action => this.keybindingService.lookupKeybinding(action.id),
this._notebookLeftToolbar = this.instantiationService.createInstance(WorkbenchToolBar, this._notebookTopLeftToolbarContainer, {
actionViewItemProvider: (action) => {
return this._strategy.actionProvider(action);
},
Expand All @@ -379,8 +377,7 @@ export class NotebookEditorToolbar extends Disposable {
this._register(this._notebookLeftToolbar);
this._notebookLeftToolbar.context = context;

this._notebookRightToolbar = new ToolBar(this._notebookTopRightToolbarContainer, this.contextMenuService, {
getKeyBinding: action => this.keybindingService.lookupKeybinding(action.id),
this._notebookRightToolbar = this.instantiationService.createInstance(WorkbenchToolBar, this._notebookTopRightToolbarContainer, {
actionViewItemProvider: actionProvider,
renderDropdownAsChildElement: true
});
Expand Down Expand Up @@ -425,8 +422,7 @@ export class NotebookEditorToolbar extends Disposable {
const oldElement = this._notebookLeftToolbar.getElement();
oldElement.parentElement?.removeChild(oldElement);
this._notebookLeftToolbar.dispose();
this._notebookLeftToolbar = new ToolBar(this._notebookTopLeftToolbarContainer, this.contextMenuService, {
getKeyBinding: action => this.keybindingService.lookupKeybinding(action.id),
this._notebookLeftToolbar = this.instantiationService.createInstance(WorkbenchToolBar, this._notebookTopLeftToolbarContainer, {
actionViewItemProvider: actionProvider,
renderDropdownAsChildElement: true
});
Expand Down

0 comments on commit fa89b71

Please sign in to comment.