Deprecate the modelviewdialog namespace (#4075)

* Deprecate the modelviewdialog namespace

* use @deprecated tag
This commit is contained in:
Alan Ren
2019-02-19 09:43:37 -08:00
committed by GitHub
parent d4ffe53dbd
commit 1cc6a108a7
44 changed files with 579 additions and 210 deletions

View File

@@ -852,6 +852,9 @@ declare module 'sqlops' {
}
export namespace window {
/**
* @deprecated this namespace has been deprecated and will be removed in a future release, please use the methods under sqlops.window namespace.
*/
export namespace modelviewdialog {
/**
* Create a dialog with the given title
@@ -1180,6 +1183,339 @@ declare module 'sqlops' {
registerOperation(operationInfo: BackgroundOperationInfo): void;
}
}
/**
* creates a web view dialog
* @param title
*/
export function createWebViewDialog(title: string): ModalDialog;
/**
* Create a dialog with the given title
* @param title The title of the dialog, displayed at the top
*/
export function createModelViewDialog(title: string, dialogName?: string): Dialog;
/**
* Create a dialog tab which can be included as part of the content of a dialog
* @param title The title of the page, displayed on the tab to select the page
*/
export function createTab(title: string): DialogTab;
/**
* Create a button which can be included in a dialog
* @param label The label of the button
*/
export function createButton(label: string): Button;
/**
* Opens the given dialog if it is not already open
*/
export function openDialog(dialog: Dialog): void;
/**
* Closes the given dialog if it is open
*/
export function closeDialog(dialog: Dialog): void;
/**
* Create a wizard page with the given title, for inclusion in a wizard
* @param title The title of the page
*/
export function createWizardPage(title: string): WizardPage;
/**
* Create a wizard with the given title and pages
* @param title The title of the wizard
*/
export function createWizard(title: string): Wizard;
/**
* Used to control whether a message in a dialog/wizard is displayed as an error,
* warning, or informational message. Default is error.
*/
export enum MessageLevel {
Error = 0,
Warning = 1,
Information = 2
}
/**
* A message shown in a dialog. If the level is not set it defaults to error.
*/
export type DialogMessage = {
readonly text: string,
readonly description?: string,
readonly level?: MessageLevel
};
export interface ModelViewPanel {
/**
* Register model view content for the dialog.
* Doesn't do anything if model view is already registered
*/
registerContent(handler: (view: ModelView) => Thenable<void>): void;
/**
* Returns the model view content if registered. Returns undefined if model review is not registered
*/
readonly modelView: ModelView;
/**
* Whether the panel's content is valid
*/
readonly valid: boolean;
/**
* Fired whenever the panel's valid property changes
*/
readonly onValidityChanged: vscode.Event<boolean>;
}
// Model view dialog classes
export interface Dialog extends ModelViewPanel {
/**
* The title of the dialog
*/
title: string;
/**
* The content of the dialog. If multiple tabs are given they will be displayed with tabs
* If a string is given, it should be the ID of the dialog's model view content
*/
content: string | DialogTab[];
/**
* The ok button
*/
okButton: Button;
/**
* The cancel button
*/
cancelButton: Button;
/**
* Any additional buttons that should be displayed
*/
customButtons: Button[];
/**
* Set the informational message shown in the dialog. Hidden when the message is
* undefined or the text is empty or undefined. The default level is error.
*/
message: DialogMessage;
/**
* Set the dialog name when opening
* the dialog for telemetry
*/
dialogName?: string;
/**
* Register a callback that will be called when the user tries to click done. Only
* one callback can be registered at once, so each registration call will clear
* the previous registration.
* @param validator The callback that gets executed when the user tries to click
* done. Return true to allow the dialog to close or false to block it from closing
*/
registerCloseValidator(validator: () => boolean | Thenable<boolean>): void;
/**
* Register an operation to run in the background when the dialog is done
* @param operationInfo Operation Information
*/
registerOperation(operationInfo: BackgroundOperationInfo): void;
}
export interface DialogTab extends ModelViewPanel {
/**
* The title of the tab
*/
title: string;
/**
* A string giving the ID of the tab's model view content
*/
content: string;
}
export interface Button {
/**
* The label displayed on the button
*/
label: string;
/**
* Whether the button is enabled
*/
enabled: boolean;
/**
* Whether the button is hidden
*/
hidden: boolean;
/**
* Raised when the button is clicked
*/
readonly onClick: vscode.Event<void>;
}
export interface WizardPageChangeInfo {
/**
* The page number that the wizard changed from
*/
lastPage: number;
/**
* The new page number or undefined if the user is closing the wizard
*/
newPage: number;
}
export interface WizardPage extends ModelViewPanel {
/**
* The title of the page
*/
title: string;
/**
* A string giving the ID of the page's model view content
*/
content: string;
/**
* Any additional buttons that should be displayed while the page is open
*/
customButtons: Button[];
/**
* Whether the page is enabled. If the page is not enabled, the user will not be
* able to advance to it. Defaults to true.
*/
enabled: boolean;
/**
* An optional description for the page. If provided it will be displayed underneath the page title.
*/
description: string;
}
export interface Wizard {
/**
* The title of the wizard
*/
title: string;
/**
* The wizard's pages. Pages can be added/removed while the dialog is open by using
* the addPage and removePage methods
*/
pages: WizardPage[];
/**
* The index in the pages array of the active page, or undefined if the wizard is
* not currently visible
*/
readonly currentPage: number;
/**
* The done button
*/
doneButton: Button;
/**
* The cancel button
*/
cancelButton: Button;
/**
* The generate script button
*/
generateScriptButton: Button;
/**
* The next button
*/
nextButton: Button;
/**
* The back button
*/
backButton: Button;
/**
* Any additional buttons that should be displayed for all pages of the dialog. If
* buttons are needed for specific pages they can be added using the customButtons
* property on each page.
*/
customButtons: Button[];
/**
* When set to false page titles and descriptions will not be displayed at the top
* of each wizard page. The default is true.
*/
displayPageTitles: boolean;
/**
* Event fired when the wizard's page changes, containing information about the
* previous page and the new page
*/
onPageChanged: vscode.Event<WizardPageChangeInfo>;
/**
* Add a page to the wizard at the given index
* @param page The page to add
* @param index The index in the pages array to add the page at, or undefined to
* add it at the end
*/
addPage(page: WizardPage, index?: number): Thenable<void>;
/**
* Remove the page at the given index from the wizard
* @param index The index in the pages array to remove
*/
removePage(index: number): Thenable<void>;
/**
* Go to the page at the given index in the pages array.
* @param index The index of the page to go to
*/
setCurrentPage(index: number): Thenable<void>;
/**
* Open the wizard. Does nothing if the wizard is already open.
*/
open(): Thenable<void>;
/**
* Close the wizard. Does nothing if the wizard is not open.
*/
close(): Thenable<void>;
/**
* Register a callback that will be called when the user tries to navigate by
* changing pages or clicking done. Only one callback can be registered at once, so
* each registration call will clear the previous registration.
* @param validator The callback that gets executed when the user tries to
* navigate. Return true to allow the navigation to proceed, or false to
* cancel it.
*/
registerNavigationValidator(validator: (pageChangeInfo: WizardPageChangeInfo) => boolean | Thenable<boolean>): void;
/**
* Set the informational message shown in the wizard. Hidden when the message is
* undefined or the text is empty or undefined. The default level is error.
*/
message: DialogMessage;
/**
* Register an operation to run in the background when the wizard is done
* @param operationInfo Operation Information
*/
registerOperation(operationInfo: BackgroundOperationInfo): void;
}
}
/**
@@ -1211,7 +1547,7 @@ declare module 'sqlops' {
*/
export function createModelViewEditor(title: string, options?: ModelViewEditorOptions): ModelViewEditor;
export interface ModelViewEditor extends window.modelviewdialog.ModelViewPanel {
export interface ModelViewEditor extends window.ModelViewPanel {
/**
* `true` if there are unpersisted changes.
* This is editable to support extensions updating the dirty status.