contextMenuService.ts 1.5 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
/*---------------------------------------------------------------------------------------------
 *  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';
import {IContextViewService, IContextMenuService, IContextViewDelegate, IContextMenuDelegate} from './contextView';
import {ContextView} from 'vs/base/browser/ui/contextview/contextview';
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;

	constructor(container: HTMLElement, telemetryService:ITelemetryService, messageService:IMessageService, contextViewService: IContextViewService) {
		this.contextMenuHandler = new ContextMenuHandler(container, contextViewService, telemetryService, messageService);
	}

	public dispose():void {
		this.contextMenuHandler.dispose();
	}

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

	// ContextMenu

	public showContextMenu(delegate: IContextMenuDelegate):void {
		this.contextMenuHandler.showContextMenu(delegate);
	}
}