Add onClosed event to ModelView dialogs (#17531)

* Add onClosed event to ModelView dialogs

* Use defined type

* Fix compile

* fix tests

* fix tests2

* Remove unused
This commit is contained in:
Charles Gagnon
2021-10-28 20:53:20 -07:00
committed by GitHub
parent 62b6e781ce
commit 82805638ad
12 changed files with 82 additions and 15 deletions

View File

@@ -133,6 +133,9 @@ class DialogImpl extends ModelViewPanelImpl implements azdata.window.Dialog {
private _renderFooter: boolean;
private _dialogProperties: IDialogProperties;
private _onClosed = new Emitter<azdata.window.CloseReason>();
public onClosed = this._onClosed.event;
constructor(extHostModelViewDialog: ExtHostModelViewDialog,
extHostModelView: ExtHostModelViewShape,
extHostTaskManagement: ExtHostBackgroundTaskManagementShape,
@@ -239,6 +242,10 @@ class DialogImpl extends ModelViewPanelImpl implements azdata.window.Dialog {
return Promise.resolve(true);
}
}
public handleOnClosed(reason: azdata.window.CloseReason): void {
this._onClosed.fire(reason);
}
}
class TabImpl extends ModelViewPanelImpl implements azdata.window.DialogTab {
@@ -697,6 +704,11 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
return editor.handleSave();
}
public $onClosed(handle: number, reason: azdata.window.CloseReason): void {
let dialog = this._objectsByHandle.get(handle) as DialogImpl;
dialog.handleOnClosed(reason);
}
public openDialog(dialog: azdata.window.Dialog): void {
let handle = this.getHandle(dialog);
this.updateDialogContent(dialog);