Skip to content

Commit

Permalink
use WorkbenchToolBar in codeCellRunToolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Sep 16, 2022
1 parent 517448a commit 76d65d3
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { Action, IAction } from 'vs/base/common/actions';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { MarshalledId } from 'vs/base/common/marshallingIds';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { localize } from 'vs/nls';
import { DropdownWithPrimaryActionViewItem } from 'vs/platform/actions/browser/dropdownWithPrimaryActionViewItem';
import { createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { WorkbenchToolBar } from 'vs/platform/actions/browser/toolbar';
import { IMenu, IMenuService, MenuItemAction } from 'vs/platform/actions/common/actions';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { InputFocusedContext } from 'vs/platform/contextkey/common/contextkeys';
Expand All @@ -24,7 +24,7 @@ import { registerStickyScroll } from 'vs/workbench/contrib/notebook/browser/view
import { NOTEBOOK_CELL_EXECUTION_STATE, NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CELL_TYPE, NOTEBOOK_EDITOR_FOCUSED } from 'vs/workbench/contrib/notebook/common/notebookContextKeys';

export class RunToolbar extends CellPart {
private toolbar!: ToolBar;
private toolbar!: WorkbenchToolBar;

constructor(
readonly notebookEditor: INotebookEditorDelegate,
Expand All @@ -40,6 +40,7 @@ export class RunToolbar extends CellPart {

const menu = this._register(menuService.createMenu(this.notebookEditor.creationOptions.menuIds.cellExecutePrimary!, contextKeyService));
const secondaryMenu = this._register(menuService.createMenu(this.notebookEditor.creationOptions.menuIds.cellExecuteToolbar, contextKeyService));
// TODO@roblourens what does secondaryMenu actually do? where/when is it rendered?
this.createRunCellToolbar(runButtonContainer, cellContainer, contextKeyService);
const updateActions = () => {
const actions = this.getCellToolbarActions(menu);
Expand Down Expand Up @@ -79,7 +80,7 @@ export class RunToolbar extends CellPart {

const keybindingProvider = (action: IAction) => this.keybindingService.lookupKeybinding(action.id, executionContextKeyService);
const executionContextKeyService = this._register(getCodeCellExecutionContextKeyService(contextKeyService));
this.toolbar = this._register(new ToolBar(container, this.contextMenuService, {
this.toolbar = this._register(this.instantiationService.createInstance(WorkbenchToolBar, container, {
getKeyBinding: keybindingProvider,
actionViewItemProvider: _action => {
actionViewItemDisposables.clear();
Expand Down

0 comments on commit 76d65d3

Please sign in to comment.