Add ModelViewEditorOpened event (#12597)

* Add ModelViewEditorOpened event

* fix

* Fix compile
This commit is contained in:
Charles Gagnon
2020-09-24 12:53:28 -07:00
committed by GitHub
parent 1ea33d83bf
commit bf9646ba98
14 changed files with 51 additions and 24 deletions

View File

@@ -82,6 +82,7 @@ class ModelViewEditorImpl extends ModelViewPanelImpl implements azdata.workspace
extension: IExtensionDescription,
private _proxy: MainThreadModelViewDialogShape,
private _title: string,
private _name: string,
private _options: azdata.ModelViewEditorOptions
) {
super('modelViewEditor', extHostModelViewDialog, extHostModelView, extension);
@@ -89,7 +90,7 @@ class ModelViewEditorImpl extends ModelViewPanelImpl implements azdata.workspace
}
public openEditor(position?: vscode.ViewColumn): Thenable<void> {
return this._proxy.$openEditor(this.handle, this._modelViewId, this._title, this._options, position);
return this._proxy.$openEditor(this.handle, this._modelViewId, this._title, this._name, this._options, position);
}
public get isDirty(): boolean {
@@ -648,14 +649,16 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
this._proxy.$closeDialog(handle);
}
public createModelViewEditor(title: string, extension: IExtensionDescription, options?: azdata.ModelViewEditorOptions): azdata.workspace.ModelViewEditor {
let editor = new ModelViewEditorImpl(this, this._extHostModelView, extension, this._proxy, title, options);
public createModelViewEditor(title: string, extension: IExtensionDescription, name?: string, options?: azdata.ModelViewEditorOptions): azdata.workspace.ModelViewEditor {
name = name ?? 'ModelViewEditor';
let editor = new ModelViewEditorImpl(this, this._extHostModelView, extension, this._proxy, title, name, options);
editor.handle = this.getHandle(editor);
return editor;
}
public createModelViewDashboard(title: string, options: azdata.ModelViewDashboardOptions | undefined, extension: IExtensionDescription): azdata.window.ModelViewDashboard {
const editor = this.createModelViewEditor(title, extension, { supportsSave: false }) as ModelViewEditorImpl;
public createModelViewDashboard(title: string, name: string | undefined, options: azdata.ModelViewDashboardOptions | undefined, extension: IExtensionDescription): azdata.window.ModelViewDashboard {
name = name ?? 'ModelViewDashboard';
const editor = this.createModelViewEditor(title, extension, name, { supportsSave: false }) as ModelViewEditorImpl;
return new ModelViewDashboardImpl(editor, options);
}

View File

@@ -440,8 +440,8 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
createWizard(title: string, name?: string, width?: azdata.window.DialogWidth): azdata.window.Wizard {
return extHostModelViewDialog.createWizard(title, name, width);
},
createModelViewDashboard(title: string, options?: azdata.ModelViewDashboardOptions): azdata.window.ModelViewDashboard {
return extHostModelViewDialog.createModelViewDashboard(title, options, extension);
createModelViewDashboard(title: string, name?: string, options?: azdata.ModelViewDashboardOptions): azdata.window.ModelViewDashboard {
return extHostModelViewDialog.createModelViewDashboard(title, name, options, extension);
},
MessageLevel: sqlExtHostTypes.MessageLevel
};
@@ -458,8 +458,8 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
const workspace: typeof azdata.workspace = {
onDidOpenDashboard: extHostDashboard.onDidOpenDashboard,
onDidChangeToDashboard: extHostDashboard.onDidChangeToDashboard,
createModelViewEditor(title: string, options?: azdata.ModelViewEditorOptions): azdata.workspace.ModelViewEditor {
return extHostModelViewDialog.createModelViewEditor(title, extension, options);
createModelViewEditor(title: string, options?: azdata.ModelViewEditorOptions, name?: string): azdata.workspace.ModelViewEditor {
return extHostModelViewDialog.createModelViewEditor(title, extension, name, options);
}
};

View File

@@ -804,7 +804,7 @@ export interface ExtHostModelViewDialogShape {
}
export interface MainThreadModelViewDialogShape extends IDisposable {
$openEditor(handle: number, modelViewId: string, title: string, options?: azdata.ModelViewEditorOptions, position?: vscode.ViewColumn): Thenable<void>;
$openEditor(handle: number, modelViewId: string, title: string, name?: string, options?: azdata.ModelViewEditorOptions, position?: vscode.ViewColumn): Thenable<void>;
$openDialog(handle: number, dialogName?: string): Thenable<void>;
$closeDialog(handle: number): Thenable<void>;
$setDialogDetails(handle: number, details: IModelViewDialogDetails): Thenable<void>;