mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-08 17:24:01 -05:00
dialog assisted notebooks (#6564)
This commit is contained in:
33
extensions/resource-deployment/src/ui/dialogBase.ts
Normal file
33
extensions/resource-deployment/src/ui/dialogBase.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* 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 * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export abstract class DialogBase {
|
||||
protected _toDispose: vscode.Disposable[] = [];
|
||||
protected _dialogObject: azdata.window.Dialog;
|
||||
|
||||
constructor(protected extensionContext: vscode.ExtensionContext, dialogTitle: string, dialogName: string, isWide: boolean = false) {
|
||||
this._dialogObject = azdata.window.createModelViewDialog(dialogTitle, dialogName, isWide);
|
||||
this._dialogObject.cancelButton.onClick(() => this.onCancel());
|
||||
}
|
||||
|
||||
protected abstract initializeDialog(): void;
|
||||
|
||||
public open(): void {
|
||||
this.initializeDialog();
|
||||
azdata.window.openDialog(this._dialogObject);
|
||||
}
|
||||
|
||||
protected onCancel(): void {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
protected dispose(): void {
|
||||
this._toDispose.forEach(disposable => disposable.dispose());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user