contextMenuService.ts 1.4 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5 6 7
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
'use strict';

import {ContextMenuHandler} from './contextMenuHandler';
B
Benjamin Pasero 已提交
8
import {IContextViewService, IContextMenuService, IContextMenuDelegate} from './contextView';
E
Erich Gamma 已提交
9 10 11 12 13 14 15 16
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IMessageService} from 'vs/platform/message/common/message';

export class ContextMenuService implements IContextMenuService {
	public serviceId = IContextMenuService;

	private contextMenuHandler: ContextMenuHandler;

B
Benjamin Pasero 已提交
17
	constructor(container: HTMLElement, telemetryService: ITelemetryService, messageService: IMessageService, contextViewService: IContextViewService) {
E
Erich Gamma 已提交
18 19 20
		this.contextMenuHandler = new ContextMenuHandler(container, contextViewService, telemetryService, messageService);
	}

B
Benjamin Pasero 已提交
21
	public dispose(): void {
E
Erich Gamma 已提交
22 23 24 25 26 27 28 29 30
		this.contextMenuHandler.dispose();
	}

	public setContainer(container: HTMLElement): void {
		this.contextMenuHandler.setContainer(container);
	}

	// ContextMenu

B
Benjamin Pasero 已提交
31
	public showContextMenu(delegate: IContextMenuDelegate): void {
E
Erich Gamma 已提交
32 33 34
		this.contextMenuHandler.showContextMenu(delegate);
	}
}