mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 17:22:20 -05:00
Feature/input box component (#1190)
* Adding new view component for input box
This commit is contained in:
@@ -13,10 +13,11 @@ import * as sqlops from 'sqlops';
|
||||
import { IModelViewService } from 'sql/services/modelComponents/modelViewService';
|
||||
import { IItemConfig, ModelComponentTypes, IComponentShape } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { IModelView } from 'sql/services/model/modelViewService';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadModelView)
|
||||
export class MainThreadModelView implements MainThreadModelViewShape {
|
||||
export class MainThreadModelView extends Disposable implements MainThreadModelViewShape {
|
||||
|
||||
private static _handlePool = 0;
|
||||
private readonly _proxy: ExtHostModelViewShape;
|
||||
@@ -28,6 +29,7 @@ export class MainThreadModelView implements MainThreadModelViewShape {
|
||||
context: IExtHostContext,
|
||||
@IModelViewService viewService: IModelViewService
|
||||
) {
|
||||
super();
|
||||
this._proxy = context.getProxy(SqlExtHostContext.ExtHostModelView);
|
||||
viewService.onRegisteredModelView(view => {
|
||||
if (this.knownWidgets.includes(view.id)) {
|
||||
@@ -38,16 +40,14 @@ export class MainThreadModelView implements MainThreadModelViewShape {
|
||||
});
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
$registerProvider(id: string) {
|
||||
this.knownWidgets.push(id);
|
||||
}
|
||||
|
||||
$initializeModel(handle: number, rootComponent: IComponentShape): Thenable<void> {
|
||||
return this.execModelViewAction(handle, (modelView) => modelView.initializeModel(rootComponent));
|
||||
return this.execModelViewAction(handle, (modelView) => {
|
||||
modelView.initializeModel(rootComponent);
|
||||
});
|
||||
}
|
||||
|
||||
$clearContainer(handle: number, componentId: string): Thenable<void> {
|
||||
@@ -63,6 +63,19 @@ export class MainThreadModelView implements MainThreadModelViewShape {
|
||||
return this.execModelViewAction(handle, (modelView) => modelView.setLayout(componentId, layout));
|
||||
}
|
||||
|
||||
private onEvent(handle: number, componentId: string, eventArgs: any) {
|
||||
this._proxy.$handleEvent(handle, componentId, eventArgs);
|
||||
}
|
||||
|
||||
$registerEvent(handle: number, componentId: string): Thenable<void> {
|
||||
let properties: { [key: string]: any; } = { eventName: this.onEvent };
|
||||
return this.execModelViewAction(handle, (modelView) => {
|
||||
this._register(modelView.onEvent (e => {
|
||||
this.onEvent(handle, componentId, e);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
$setProperties(handle: number, componentId: string, properties: { [key: string]: any; }): Thenable<void> {
|
||||
return this.execModelViewAction(handle, (modelView) => modelView.setProperties(componentId, properties));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user