Files
azuredatastudio/src/sql/workbench/api/node/mainThreadDashboardWebview.ts
Karl Burtram dafb780987 Merge VS Code 1.21 source code (#1067)
* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
2018-04-04 15:27:51 -07:00

54 lines
2.0 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { MainThreadDashboardWebviewShape, SqlMainContext, ExtHostDashboardWebviewsShape, SqlExtHostContext } from 'sql/workbench/api/node/sqlExtHost.protocol';
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
import { IDashboardWebviewService, IDashboardWebview } from 'sql/services/dashboardWebview/common/dashboardWebviewService';
@extHostNamedCustomer(SqlMainContext.MainThreadDashboardWebview)
export class MainThreadDashboardWebview implements MainThreadDashboardWebviewShape {
private static _handlePool = 0;
private readonly _proxy: ExtHostDashboardWebviewsShape;
private readonly _dialogs = new Map<number, IDashboardWebview>();
private knownWidgets = new Array<string>();
constructor(
context: IExtHostContext,
@IDashboardWebviewService webviewService: IDashboardWebviewService
) {
this._proxy = context.getProxy(SqlExtHostContext.ExtHostDashboardWebviews);
webviewService.onRegisteredWebview(e => {
if (this.knownWidgets.includes(e.id)) {
let handle = MainThreadDashboardWebview._handlePool++;
this._dialogs.set(handle, e);
this._proxy.$registerWidget(handle, e.id, e.connection, e.serverInfo);
e.onMessage(e => {
this._proxy.$onMessage(handle, e);
});
}
});
}
public dispose(): void {
throw new Error("Method not implemented.");
}
$sendMessage(handle: number, message: string) {
this._dialogs.get(handle).sendMessage(message);
}
$setHtml(handle: number, value: string) {
this._dialogs.get(handle).setHtml(value);
}
$registerProvider(widgetId: string) {
this.knownWidgets.push(widgetId);
}
}