mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 09:35:41 -05:00
fix issue 7489 and disposable handling (#7491)
This commit is contained in:
@@ -12,7 +12,8 @@ export abstract class DialogBase {
|
||||
|
||||
constructor(dialogTitle: string, dialogName: string, isWide: boolean = false) {
|
||||
this._dialogObject = azdata.window.createModelViewDialog(dialogTitle, dialogName, isWide);
|
||||
this._dialogObject.cancelButton.onClick(() => this.onCancel());
|
||||
this._toDispose.push(this._dialogObject.cancelButton.onClick(() => this.onCancelButtonClicked()));
|
||||
this._toDispose.push(this._dialogObject.okButton.onClick(() => this.onOkButtonClicked()));
|
||||
}
|
||||
|
||||
protected abstract initialize(): void;
|
||||
@@ -22,10 +23,17 @@ export abstract class DialogBase {
|
||||
azdata.window.openDialog(this._dialogObject);
|
||||
}
|
||||
|
||||
protected onCancel(): void {
|
||||
private onCancelButtonClicked(): void {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
private onOkButtonClicked(): void {
|
||||
this.onComplete();
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
protected onComplete(): void { }
|
||||
|
||||
protected dispose(): void {
|
||||
this._toDispose.forEach(disposable => disposable.dispose());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user