mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 17:23:19 -05:00
Deprecate the modelviewdialog namespace (#4075)
* Deprecate the modelviewdialog namespace * use @deprecated tag
This commit is contained in:
@@ -80,7 +80,7 @@ export class Dialog extends ModelViewPane {
|
||||
}
|
||||
}
|
||||
|
||||
export class DialogButton implements sqlops.window.modelviewdialog.Button {
|
||||
export class DialogButton implements sqlops.window.Button {
|
||||
private _label: string;
|
||||
private _enabled: boolean;
|
||||
private _hidden: boolean;
|
||||
@@ -169,13 +169,13 @@ export class Wizard {
|
||||
public cancelButton: DialogButton;
|
||||
public customButtons: DialogButton[];
|
||||
private _currentPage: number;
|
||||
private _pageChangedEmitter = new Emitter<sqlops.window.modelviewdialog.WizardPageChangeInfo>();
|
||||
private _pageChangedEmitter = new Emitter<sqlops.window.WizardPageChangeInfo>();
|
||||
public readonly onPageChanged = this._pageChangedEmitter.event;
|
||||
private _pageAddedEmitter = new Emitter<WizardPage>();
|
||||
public readonly onPageAdded = this._pageAddedEmitter.event;
|
||||
private _pageRemovedEmitter = new Emitter<WizardPage>();
|
||||
public readonly onPageRemoved = this._pageRemovedEmitter.event;
|
||||
private _navigationValidator: (pageChangeInfo: sqlops.window.modelviewdialog.WizardPageChangeInfo) => boolean | Thenable<boolean>;
|
||||
private _navigationValidator: (pageChangeInfo: sqlops.window.WizardPageChangeInfo) => boolean | Thenable<boolean>;
|
||||
private _onMessageChange = new Emitter<DialogMessage>();
|
||||
public readonly onMessageChange = this._onMessageChange.event;
|
||||
private _message: DialogMessage;
|
||||
@@ -233,7 +233,7 @@ export class Wizard {
|
||||
this._pageRemovedEmitter.fire(removedPage);
|
||||
}
|
||||
|
||||
public registerNavigationValidator(validator: (pageChangeInfo: sqlops.window.modelviewdialog.WizardPageChangeInfo) => boolean | Thenable<boolean>): void {
|
||||
public registerNavigationValidator(validator: (pageChangeInfo: sqlops.window.WizardPageChangeInfo) => boolean | Thenable<boolean>): void {
|
||||
this._navigationValidator = validator;
|
||||
}
|
||||
|
||||
|
||||
2
src/sql/sqlops.d.ts
vendored
2
src/sql/sqlops.d.ts
vendored
@@ -2342,7 +2342,7 @@ declare module 'sqlops' {
|
||||
|
||||
export namespace window {
|
||||
/**
|
||||
* creates a dialog
|
||||
* @deprecated this method has been deprecated and will be removed in a future release, please use sqlops.window.createWebViewDialog instead.
|
||||
* @param title
|
||||
*/
|
||||
export function createDialog(
|
||||
|
||||
338
src/sql/sqlops.proposed.d.ts
vendored
338
src/sql/sqlops.proposed.d.ts
vendored
@@ -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.
|
||||
|
||||
@@ -25,7 +25,7 @@ const GENERATE_SCRIPT_LABEL = nls.localize('generateScriptLabel', 'Generate scri
|
||||
const NEXT_LABEL = nls.localize('dialogNextLabel', 'Next');
|
||||
const PREVIOUS_LABEL = nls.localize('dialogPreviousLabel', 'Previous');
|
||||
|
||||
class ModelViewPanelImpl implements sqlops.window.modelviewdialog.ModelViewPanel {
|
||||
class ModelViewPanelImpl implements sqlops.window.ModelViewPanel {
|
||||
private _modelView: sqlops.ModelView;
|
||||
private _handle: number;
|
||||
protected _modelViewId: string;
|
||||
@@ -118,13 +118,13 @@ class ModelViewEditorImpl extends ModelViewPanelImpl implements sqlops.workspace
|
||||
}
|
||||
}
|
||||
|
||||
class DialogImpl extends ModelViewPanelImpl implements sqlops.window.modelviewdialog.Dialog {
|
||||
class DialogImpl extends ModelViewPanelImpl implements sqlops.window.Dialog {
|
||||
public title: string;
|
||||
public content: string | sqlops.window.modelviewdialog.DialogTab[];
|
||||
public okButton: sqlops.window.modelviewdialog.Button;
|
||||
public cancelButton: sqlops.window.modelviewdialog.Button;
|
||||
public customButtons: sqlops.window.modelviewdialog.Button[];
|
||||
private _message: sqlops.window.modelviewdialog.DialogMessage;
|
||||
public content: string | sqlops.window.DialogTab[];
|
||||
public okButton: sqlops.window.Button;
|
||||
public cancelButton: sqlops.window.Button;
|
||||
public customButtons: sqlops.window.Button[];
|
||||
private _message: sqlops.window.DialogMessage;
|
||||
private _closeValidator: () => boolean | Thenable<boolean>;
|
||||
private _operationHandler: BackgroundOperationHandler;
|
||||
private _dialogName: string;
|
||||
@@ -151,11 +151,11 @@ class DialogImpl extends ModelViewPanelImpl implements sqlops.window.modelviewdi
|
||||
this.content = value;
|
||||
}
|
||||
|
||||
public get message(): sqlops.window.modelviewdialog.DialogMessage {
|
||||
public get message(): sqlops.window.DialogMessage {
|
||||
return this._message;
|
||||
}
|
||||
|
||||
public set message(value: sqlops.window.modelviewdialog.DialogMessage) {
|
||||
public set message(value: sqlops.window.DialogMessage) {
|
||||
this._message = value;
|
||||
this._extHostModelViewDialog.updateDialogContent(this);
|
||||
}
|
||||
@@ -181,7 +181,7 @@ class DialogImpl extends ModelViewPanelImpl implements sqlops.window.modelviewdi
|
||||
}
|
||||
}
|
||||
|
||||
class TabImpl extends ModelViewPanelImpl implements sqlops.window.modelviewdialog.DialogTab {
|
||||
class TabImpl extends ModelViewPanelImpl implements sqlops.window.DialogTab {
|
||||
constructor(
|
||||
extHostModelViewDialog: ExtHostModelViewDialog,
|
||||
extHostModelView: ExtHostModelViewShape,
|
||||
@@ -199,7 +199,7 @@ class TabImpl extends ModelViewPanelImpl implements sqlops.window.modelviewdialo
|
||||
}
|
||||
}
|
||||
|
||||
class ButtonImpl implements sqlops.window.modelviewdialog.Button {
|
||||
class ButtonImpl implements sqlops.window.Button {
|
||||
private _label: string;
|
||||
private _enabled: boolean;
|
||||
private _hidden: boolean;
|
||||
@@ -273,8 +273,8 @@ class BackgroundOperationHandler {
|
||||
}
|
||||
}
|
||||
|
||||
class WizardPageImpl extends ModelViewPanelImpl implements sqlops.window.modelviewdialog.WizardPage {
|
||||
public customButtons: sqlops.window.modelviewdialog.Button[];
|
||||
class WizardPageImpl extends ModelViewPanelImpl implements sqlops.window.WizardPage {
|
||||
public customButtons: sqlops.window.Button[];
|
||||
private _enabled: boolean = true;
|
||||
private _description: string;
|
||||
|
||||
@@ -319,23 +319,23 @@ export enum WizardPageInfoEventType {
|
||||
|
||||
export interface WizardPageEventInfo {
|
||||
eventType: WizardPageInfoEventType;
|
||||
pageChangeInfo: sqlops.window.modelviewdialog.WizardPageChangeInfo;
|
||||
pages?: sqlops.window.modelviewdialog.WizardPage[];
|
||||
pageChangeInfo: sqlops.window.WizardPageChangeInfo;
|
||||
pages?: sqlops.window.WizardPage[];
|
||||
}
|
||||
|
||||
class WizardImpl implements sqlops.window.modelviewdialog.Wizard {
|
||||
class WizardImpl implements sqlops.window.Wizard {
|
||||
private _currentPage: number = undefined;
|
||||
public pages: sqlops.window.modelviewdialog.WizardPage[] = [];
|
||||
public doneButton: sqlops.window.modelviewdialog.Button;
|
||||
public cancelButton: sqlops.window.modelviewdialog.Button;
|
||||
public generateScriptButton: sqlops.window.modelviewdialog.Button;
|
||||
public nextButton: sqlops.window.modelviewdialog.Button;
|
||||
public backButton: sqlops.window.modelviewdialog.Button;
|
||||
public customButtons: sqlops.window.modelviewdialog.Button[];
|
||||
private _pageChangedEmitter = new Emitter<sqlops.window.modelviewdialog.WizardPageChangeInfo>();
|
||||
public pages: sqlops.window.WizardPage[] = [];
|
||||
public doneButton: sqlops.window.Button;
|
||||
public cancelButton: sqlops.window.Button;
|
||||
public generateScriptButton: sqlops.window.Button;
|
||||
public nextButton: sqlops.window.Button;
|
||||
public backButton: sqlops.window.Button;
|
||||
public customButtons: sqlops.window.Button[];
|
||||
private _pageChangedEmitter = new Emitter<sqlops.window.WizardPageChangeInfo>();
|
||||
public readonly onPageChanged = this._pageChangedEmitter.event;
|
||||
private _navigationValidator: (info: sqlops.window.modelviewdialog.WizardPageChangeInfo) => boolean | Thenable<boolean>;
|
||||
private _message: sqlops.window.modelviewdialog.DialogMessage;
|
||||
private _navigationValidator: (info: sqlops.window.WizardPageChangeInfo) => boolean | Thenable<boolean>;
|
||||
private _message: sqlops.window.DialogMessage;
|
||||
private _displayPageTitles: boolean = true;
|
||||
private _operationHandler: BackgroundOperationHandler;
|
||||
|
||||
@@ -362,11 +362,11 @@ class WizardImpl implements sqlops.window.modelviewdialog.Wizard {
|
||||
return this._currentPage;
|
||||
}
|
||||
|
||||
public get message(): sqlops.window.modelviewdialog.DialogMessage {
|
||||
public get message(): sqlops.window.DialogMessage {
|
||||
return this._message;
|
||||
}
|
||||
|
||||
public set message(value: sqlops.window.modelviewdialog.DialogMessage) {
|
||||
public set message(value: sqlops.window.DialogMessage) {
|
||||
this._message = value;
|
||||
this._extHostModelViewDialog.updateWizard(this);
|
||||
}
|
||||
@@ -380,7 +380,7 @@ class WizardImpl implements sqlops.window.modelviewdialog.Wizard {
|
||||
this._extHostModelViewDialog.updateWizard(this);
|
||||
}
|
||||
|
||||
public addPage(page: sqlops.window.modelviewdialog.WizardPage, index?: number): Thenable<void> {
|
||||
public addPage(page: sqlops.window.WizardPage, index?: number): Thenable<void> {
|
||||
return this._extHostModelViewDialog.updateWizardPage(page).then(() => {
|
||||
this._extHostModelViewDialog.addPage(this, page, index);
|
||||
});
|
||||
@@ -402,11 +402,11 @@ class WizardImpl implements sqlops.window.modelviewdialog.Wizard {
|
||||
return this._extHostModelViewDialog.closeWizard(this);
|
||||
}
|
||||
|
||||
public registerNavigationValidator(validator: (pageChangeInfo: sqlops.window.modelviewdialog.WizardPageChangeInfo) => boolean | Thenable<boolean>): void {
|
||||
public registerNavigationValidator(validator: (pageChangeInfo: sqlops.window.WizardPageChangeInfo) => boolean | Thenable<boolean>): void {
|
||||
this._navigationValidator = validator;
|
||||
}
|
||||
|
||||
public validateNavigation(info: sqlops.window.modelviewdialog.WizardPageChangeInfo): Thenable<boolean> {
|
||||
public validateNavigation(info: sqlops.window.WizardPageChangeInfo): Thenable<boolean> {
|
||||
if (this._navigationValidator) {
|
||||
return Promise.resolve(this._navigationValidator(info));
|
||||
} else {
|
||||
@@ -449,8 +449,8 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
return handle;
|
||||
}
|
||||
|
||||
private getHandle(item: sqlops.window.modelviewdialog.Button | sqlops.window.modelviewdialog.Dialog | sqlops.window.modelviewdialog.DialogTab
|
||||
| sqlops.window.modelviewdialog.ModelViewPanel | sqlops.window.modelviewdialog.Wizard | sqlops.window.modelviewdialog.WizardPage | sqlops.workspace.ModelViewEditor) {
|
||||
private getHandle(item: sqlops.window.Button | sqlops.window.Dialog | sqlops.window.DialogTab
|
||||
| sqlops.window.ModelViewPanel | sqlops.window.Wizard | sqlops.window.WizardPage | sqlops.workspace.ModelViewEditor) {
|
||||
let handle = this._objectHandles.get(item);
|
||||
if (handle === undefined) {
|
||||
handle = ExtHostModelViewDialog.getNewHandle();
|
||||
@@ -471,7 +471,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
}
|
||||
}
|
||||
|
||||
public $onWizardPageChanged(handle: number, info: sqlops.window.modelviewdialog.WizardPageChangeInfo): void {
|
||||
public $onWizardPageChanged(handle: number, info: sqlops.window.WizardPageChangeInfo): void {
|
||||
let callback = this._pageInfoChangedCallbacks.get(handle);
|
||||
if (callback) {
|
||||
callback({
|
||||
@@ -484,7 +484,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
public $updateWizardPageInfo(handle: number, pageHandles: number[], currentPageIndex: number): void {
|
||||
let callback = this._pageInfoChangedCallbacks.get(handle);
|
||||
if (callback) {
|
||||
let pages = pageHandles.map(pageHandle => this._objectsByHandle.get(handle) as sqlops.window.modelviewdialog.WizardPage);
|
||||
let pages = pageHandles.map(pageHandle => this._objectsByHandle.get(handle) as sqlops.window.WizardPage);
|
||||
callback({
|
||||
eventType: WizardPageInfoEventType.PageAddedOrRemoved,
|
||||
pageChangeInfo: {
|
||||
@@ -496,7 +496,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
}
|
||||
}
|
||||
|
||||
public $validateNavigation(handle: number, info: sqlops.window.modelviewdialog.WizardPageChangeInfo): Thenable<boolean> {
|
||||
public $validateNavigation(handle: number, info: sqlops.window.WizardPageChangeInfo): Thenable<boolean> {
|
||||
let wizard = this._objectsByHandle.get(handle) as WizardImpl;
|
||||
return wizard.validateNavigation(info);
|
||||
}
|
||||
@@ -511,14 +511,14 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
return editor.handleSave();
|
||||
}
|
||||
|
||||
public openDialog(dialog: sqlops.window.modelviewdialog.Dialog): void {
|
||||
public openDialog(dialog: sqlops.window.Dialog): void {
|
||||
let handle = this.getHandle(dialog);
|
||||
this.updateDialogContent(dialog);
|
||||
dialog.dialogName ? this._proxy.$openDialog(handle, dialog.dialogName) :
|
||||
this._proxy.$openDialog(handle);
|
||||
}
|
||||
|
||||
public closeDialog(dialog: sqlops.window.modelviewdialog.Dialog): void {
|
||||
public closeDialog(dialog: sqlops.window.Dialog): void {
|
||||
let handle = this.getHandle(dialog);
|
||||
this._proxy.$closeDialog(handle);
|
||||
}
|
||||
@@ -529,7 +529,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
return editor;
|
||||
}
|
||||
|
||||
public updateDialogContent(dialog: sqlops.window.modelviewdialog.Dialog): void {
|
||||
public updateDialogContent(dialog: sqlops.window.Dialog): void {
|
||||
let handle = this.getHandle(dialog);
|
||||
let tabs = dialog.content;
|
||||
if (tabs && typeof tabs !== 'string') {
|
||||
@@ -550,7 +550,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
});
|
||||
}
|
||||
|
||||
public updateTabContent(tab: sqlops.window.modelviewdialog.DialogTab): void {
|
||||
public updateTabContent(tab: sqlops.window.DialogTab): void {
|
||||
let handle = this.getHandle(tab);
|
||||
this._proxy.$setTabDetails(handle, {
|
||||
title: tab.title,
|
||||
@@ -558,7 +558,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
});
|
||||
}
|
||||
|
||||
public updateButton(button: sqlops.window.modelviewdialog.Button): void {
|
||||
public updateButton(button: sqlops.window.Button): void {
|
||||
let handle = this.getHandle(button);
|
||||
this._proxy.$setButtonDetails(handle, {
|
||||
label: button.label,
|
||||
@@ -567,12 +567,12 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
});
|
||||
}
|
||||
|
||||
public registerOnClickCallback(button: sqlops.window.modelviewdialog.Button, callback: () => void) {
|
||||
public registerOnClickCallback(button: sqlops.window.Button, callback: () => void) {
|
||||
let handle = this.getHandle(button);
|
||||
this._onClickCallbacks.set(handle, callback);
|
||||
}
|
||||
|
||||
public createDialog(title: string, dialogName?: string, extensionLocation?: URI): sqlops.window.modelviewdialog.Dialog {
|
||||
public createDialog(title: string, dialogName?: string, extensionLocation?: URI): sqlops.window.Dialog {
|
||||
let dialog = new DialogImpl(this, this._extHostModelView, this._extHostTaskManagement, extensionLocation);
|
||||
if (dialogName) {
|
||||
dialog.dialogName = dialogName;
|
||||
@@ -582,14 +582,14 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public createTab(title: string, extensionLocation?: URI): sqlops.window.modelviewdialog.DialogTab {
|
||||
public createTab(title: string, extensionLocation?: URI): sqlops.window.DialogTab {
|
||||
let tab = new TabImpl(this, this._extHostModelView, extensionLocation);
|
||||
tab.title = title;
|
||||
tab.handle = this.getHandle(tab);
|
||||
return tab;
|
||||
}
|
||||
|
||||
public createButton(label: string): sqlops.window.modelviewdialog.Button {
|
||||
public createButton(label: string): sqlops.window.Button {
|
||||
let button = new ButtonImpl(this);
|
||||
this.getHandle(button);
|
||||
this.registerOnClickCallback(button, button.getOnClickCallback());
|
||||
@@ -597,7 +597,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
return button;
|
||||
}
|
||||
|
||||
public getValidityChangedEvent(panel: sqlops.window.modelviewdialog.ModelViewPanel) {
|
||||
public getValidityChangedEvent(panel: sqlops.window.ModelViewPanel) {
|
||||
let handle = this.getHandle(panel);
|
||||
let emitter = this._validityEmitters.get(handle);
|
||||
if (!emitter) {
|
||||
@@ -607,24 +607,24 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
return emitter.event;
|
||||
}
|
||||
|
||||
public registerWizardPageInfoChangedCallback(wizard: sqlops.window.modelviewdialog.Wizard, callback: (info: WizardPageEventInfo) => void): void {
|
||||
public registerWizardPageInfoChangedCallback(wizard: sqlops.window.Wizard, callback: (info: WizardPageEventInfo) => void): void {
|
||||
let handle = this.getHandle(wizard);
|
||||
this._pageInfoChangedCallbacks.set(handle, callback);
|
||||
}
|
||||
|
||||
public createWizardPage(title: string, extensionLocation?: URI): sqlops.window.modelviewdialog.WizardPage {
|
||||
public createWizardPage(title: string, extensionLocation?: URI): sqlops.window.WizardPage {
|
||||
let page = new WizardPageImpl(title, this, this._extHostModelView, extensionLocation);
|
||||
page.handle = this.getHandle(page);
|
||||
return page;
|
||||
}
|
||||
|
||||
public createWizard(title: string): sqlops.window.modelviewdialog.Wizard {
|
||||
public createWizard(title: string): sqlops.window.Wizard {
|
||||
let wizard = new WizardImpl(title, this, this._extHostTaskManagement);
|
||||
this.getHandle(wizard);
|
||||
return wizard;
|
||||
}
|
||||
|
||||
public updateWizardPage(page: sqlops.window.modelviewdialog.WizardPage): Thenable<void> {
|
||||
public updateWizardPage(page: sqlops.window.WizardPage): Thenable<void> {
|
||||
let handle = this.getHandle(page);
|
||||
if (page.customButtons) {
|
||||
page.customButtons.forEach(button => this.updateButton(button));
|
||||
@@ -638,7 +638,7 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
});
|
||||
}
|
||||
|
||||
public updateWizard(wizard: sqlops.window.modelviewdialog.Wizard): Thenable<void> {
|
||||
public updateWizard(wizard: sqlops.window.Wizard): Thenable<void> {
|
||||
let handle = this.getHandle(wizard);
|
||||
wizard.pages.forEach(page => this.updateWizardPage(page));
|
||||
this.updateButton(wizard.backButton);
|
||||
@@ -664,25 +664,25 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
|
||||
});
|
||||
}
|
||||
|
||||
public addPage(wizard: sqlops.window.modelviewdialog.Wizard, page: sqlops.window.modelviewdialog.WizardPage, pageIndex?: number): Thenable<void> {
|
||||
public addPage(wizard: sqlops.window.Wizard, page: sqlops.window.WizardPage, pageIndex?: number): Thenable<void> {
|
||||
return this._proxy.$addWizardPage(this.getHandle(wizard), this.getHandle(page), pageIndex);
|
||||
}
|
||||
|
||||
public removePage(wizard: sqlops.window.modelviewdialog.Wizard, pageIndex: number): Thenable<void> {
|
||||
public removePage(wizard: sqlops.window.Wizard, pageIndex: number): Thenable<void> {
|
||||
return this._proxy.$removeWizardPage(this.getHandle(wizard), pageIndex);
|
||||
}
|
||||
|
||||
public setWizardPage(wizard: sqlops.window.modelviewdialog.Wizard, pageIndex: number): Thenable<void> {
|
||||
public setWizardPage(wizard: sqlops.window.Wizard, pageIndex: number): Thenable<void> {
|
||||
return this._proxy.$setWizardPage(this.getHandle(wizard), pageIndex);
|
||||
}
|
||||
|
||||
public openWizard(wizard: sqlops.window.modelviewdialog.Wizard): Thenable<void> {
|
||||
public openWizard(wizard: sqlops.window.Wizard): Thenable<void> {
|
||||
let handle = this.getHandle(wizard);
|
||||
this.updateWizard(wizard);
|
||||
return this._proxy.$openWizard(handle);
|
||||
}
|
||||
|
||||
public closeWizard(wizard: sqlops.window.modelviewdialog.Wizard): Thenable<void> {
|
||||
public closeWizard(wizard: sqlops.window.Wizard): Thenable<void> {
|
||||
let handle = this.getHandle(wizard);
|
||||
return this._proxy.$closeWizard(handle);
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ export class MainThreadModelViewDialog implements MainThreadModelViewDialogShape
|
||||
this._proxy.$updateWizardPageInfo(handle, wizard.pages.map(page => this._wizardPageHandles.get(page)), wizard.currentPage);
|
||||
}
|
||||
|
||||
private validateNavigation(handle: number, info: sqlops.window.modelviewdialog.WizardPageChangeInfo): Thenable<boolean> {
|
||||
private validateNavigation(handle: number, info: sqlops.window.WizardPageChangeInfo): Thenable<boolean> {
|
||||
return this._proxy.$validateNavigation(handle, info);
|
||||
}
|
||||
|
||||
|
||||
@@ -372,24 +372,31 @@ export function createApiFactory(
|
||||
|
||||
const modelViewDialog: typeof sqlops.window.modelviewdialog = {
|
||||
createDialog(title: string, dialogName?: string): sqlops.window.modelviewdialog.Dialog {
|
||||
console.warn('the method sqlops.window.modelviewdialog.createDialog has been deprecated, replace it with sqlops.window.createModelViewDialog');
|
||||
return extHostModelViewDialog.createDialog(title, dialogName, extension.extensionLocation);
|
||||
},
|
||||
createTab(title: string): sqlops.window.modelviewdialog.DialogTab {
|
||||
console.warn('the method sqlops.window.modelviewdialog.createTab has been deprecated, replace it with sqlops.window.createTab');
|
||||
return extHostModelViewDialog.createTab(title, extension.extensionLocation);
|
||||
},
|
||||
createButton(label: string): sqlops.window.modelviewdialog.Button {
|
||||
console.warn('the method sqlops.window.modelviewdialog.createButton has been deprecated, replace it with sqlops.window.createButton');
|
||||
return extHostModelViewDialog.createButton(label);
|
||||
},
|
||||
openDialog(dialog: sqlops.window.modelviewdialog.Dialog) {
|
||||
console.warn('the method sqlops.window.modelviewdialog.openDialog has been deprecated, replace it with sqlops.window.openDialog');
|
||||
return extHostModelViewDialog.openDialog(dialog);
|
||||
},
|
||||
closeDialog(dialog: sqlops.window.modelviewdialog.Dialog) {
|
||||
console.warn('the method sqlops.window.modelviewdialog.closeDialog has been deprecated, replace it with sqlops.window.closeDialog');
|
||||
return extHostModelViewDialog.closeDialog(dialog);
|
||||
},
|
||||
createWizardPage(title: string): sqlops.window.modelviewdialog.WizardPage {
|
||||
console.warn('the method sqlops.window.modelviewdialog.createWizardPage has been deprecated, replace it with sqlops.window.createWizardPage');
|
||||
return extHostModelViewDialog.createWizardPage(title);
|
||||
},
|
||||
createWizard(title: string): sqlops.window.modelviewdialog.Wizard {
|
||||
console.warn('the method sqlops.window.modelviewdialog.createWizard has been deprecated, replace it with sqlops.window.createWizard');
|
||||
return extHostModelViewDialog.createWizard(title);
|
||||
},
|
||||
MessageLevel: sqlExtHostTypes.MessageLevel
|
||||
@@ -397,10 +404,36 @@ export function createApiFactory(
|
||||
|
||||
const window: typeof sqlops.window = {
|
||||
createDialog(name: string) {
|
||||
console.warn('the method sqlops.window.createDialog has been deprecated, replace it with sqlops.window.createWebViewDialog');
|
||||
return extHostModalDialogs.createDialog(name);
|
||||
},
|
||||
|
||||
modelviewdialog: modelViewDialog
|
||||
modelviewdialog: modelViewDialog,
|
||||
createWebViewDialog(name: string) {
|
||||
return extHostModalDialogs.createDialog(name);
|
||||
},
|
||||
createModelViewDialog(title: string, dialogName?: string): sqlops.window.Dialog {
|
||||
return extHostModelViewDialog.createDialog(title, dialogName, extension.extensionLocation);
|
||||
},
|
||||
createTab(title: string): sqlops.window.DialogTab {
|
||||
return extHostModelViewDialog.createTab(title, extension.extensionLocation);
|
||||
},
|
||||
createButton(label: string): sqlops.window.Button {
|
||||
return extHostModelViewDialog.createButton(label);
|
||||
},
|
||||
openDialog(dialog: sqlops.window.Dialog) {
|
||||
return extHostModelViewDialog.openDialog(dialog);
|
||||
},
|
||||
closeDialog(dialog: sqlops.window.Dialog) {
|
||||
return extHostModelViewDialog.closeDialog(dialog);
|
||||
},
|
||||
createWizardPage(title: string): sqlops.window.WizardPage {
|
||||
return extHostModelViewDialog.createWizardPage(title);
|
||||
},
|
||||
createWizard(title: string): sqlops.window.Wizard {
|
||||
console.warn('deprecated method');
|
||||
return extHostModelViewDialog.createWizard(title);
|
||||
},
|
||||
MessageLevel: sqlExtHostTypes.MessageLevel
|
||||
};
|
||||
|
||||
const tasks: typeof sqlops.tasks = {
|
||||
|
||||
@@ -734,9 +734,9 @@ export interface MainThreadObjectExplorerShape extends IDisposable {
|
||||
export interface ExtHostModelViewDialogShape {
|
||||
$onButtonClick(handle: number): void;
|
||||
$onPanelValidityChanged(handle: number, valid: boolean): void;
|
||||
$onWizardPageChanged(handle: number, info: sqlops.window.modelviewdialog.WizardPageChangeInfo): void;
|
||||
$onWizardPageChanged(handle: number, info: sqlops.window.WizardPageChangeInfo): void;
|
||||
$updateWizardPageInfo(handle: number, pageHandles: number[], currentPageIndex: number): void;
|
||||
$validateNavigation(handle: number, info: sqlops.window.modelviewdialog.WizardPageChangeInfo): Thenable<boolean>;
|
||||
$validateNavigation(handle: number, info: sqlops.window.WizardPageChangeInfo): Thenable<boolean>;
|
||||
$validateDialogClose(handle: number): Thenable<boolean>;
|
||||
$handleSave(handle: number): Thenable<boolean>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user