src/vs/workbench/browser/parts/editor/titleControl.ts/TitleControl/getEditorActions
class TitleControl:	private getEditorActions(): IToolbarActions {
		const primary: IAction[] = [];
		const secondary: IAction[] = [];

		// Dispose previous listeners
		this.editorToolBarMenuDisposables.clear();

		// Update contexts
		this.contextKeyService.bufferChangeEvents(() => {
			const activeEditor = this.group.activeEditor;

			this.resourceContext.set(withUndefinedAsNull(EditorResourceAccessor.getOriginalUri(activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY })));

			this.editorPinnedContext.set(activeEditor ? this.group.isPinned(activeEditor) : false);
			this.editorIsFirstContext.set(activeEditor ? this.group.isFirst(activeEditor) : false);
			this.editorIsLastContext.set(activeEditor ? this.group.isLast(activeEditor) : false);
			this.editorStickyContext.set(activeEditor ? this.group.isSticky(activeEditor) : false);

			this.editorCanSplitInGroupContext.set(activeEditor ? activeEditor.hasCapability(EditorInputCapabilities.CanSplitInGroup) : false);
			this.sideBySideEditorContext.set(activeEditor?.typeId === SideBySideEditorInput.ID);

			this.groupLockedContext.set(this.group.isLocked);
		});

		// Editor actions require the editor control to be there, so we retrieve it via service
		const activeEditorPane = this.group.activeEditorPane;
		if (activeEditorPane instanceof EditorPane) {
			const scopedContextKeyService = this.getEditorPaneAwareContextKeyService();
			const titleBarMenu = this.menuService.createMenu(MenuId.EditorTitle, scopedContextKeyService, { emitEventsForSubmenuChanges: true, eventDebounceDelay: 0 });
			this.editorToolBarMenuDisposables.add(titleBarMenu);
			this.editorToolBarMenuDisposables.add(titleBarMenu.onDidChange(() => {
				this.updateEditorActionsToolbar(); // Update editor toolbar whenever contributed actions change
			}));

			const shouldInlineGroup = (action: SubmenuAction, group: string) => group === 'navigation' && action.actions.length <= 1;

			createAndFillInActionBarActions(
				titleBarMenu,
				{ arg: this.resourceContext.get(), shouldForwardArgs: true },
				{ primary, secondary },
				'navigation',
				shouldInlineGroup
			);
		}

		return { primary, secondary };
	}