mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
export class ToggleDropdownAction extends Action {
|
||||
private static readonly ID = 'dropdownAction.toggle';
|
||||
@@ -14,8 +13,8 @@ export class ToggleDropdownAction extends Action {
|
||||
super(ToggleDropdownAction.ID, label, ToggleDropdownAction.ICON);
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
this._fn();
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import * as tree from 'vs/base/parts/tree/browser/tree';
|
||||
import * as TreeDefaults from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { Promise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
@@ -74,17 +73,17 @@ export class DropdownDataSource implements tree.IDataSource {
|
||||
|
||||
public getChildren(tree: tree.ITree, element: Resource | DropdownModel): Promise<any> {
|
||||
if (element instanceof DropdownModel) {
|
||||
return TPromise.as(this.options);
|
||||
return Promise.resolve(this.options);
|
||||
} else {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
public getParent(tree: tree.ITree, element: Resource | DropdownModel): Promise<any> {
|
||||
if (element instanceof DropdownModel) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
} else {
|
||||
return TPromise.as(new DropdownModel());
|
||||
return Promise.resolve(new DropdownModel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import { SelectBox, ISelectBoxStyles } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { SelectBox, ISelectBoxStyles, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { IMessage, MessageType, defaultOpts } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
@@ -51,7 +51,7 @@ export class ListBox extends SelectBox {
|
||||
private isValid: boolean;
|
||||
|
||||
constructor(
|
||||
options: string[],
|
||||
options: ISelectOptionItem[],
|
||||
contextViewProvider: IContextViewProvider,
|
||||
private _clipboardService: IClipboardService) {
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
export class CloseTabAction extends Action {
|
||||
private static readonly ID = 'closeTab';
|
||||
@@ -18,12 +17,12 @@ export class CloseTabAction extends Action {
|
||||
super(CloseTabAction.ID, CloseTabAction.LABEL, CloseTabAction.ICON);
|
||||
}
|
||||
|
||||
run(): TPromise<boolean> {
|
||||
run(): Promise<boolean> {
|
||||
try {
|
||||
this.closeFn.apply(this.context);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
} catch (e) {
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import 'vs/css!./scrollableSplitview';
|
||||
import { HeightMap, IView as HeightIView, IViewItem as HeightIViewItem } from './heightMap';
|
||||
|
||||
import { IDisposable, combinedDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { mapEvent, Emitter, Event, debounceEvent } from 'vs/base/common/event';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { clamp } from 'vs/base/common/numbers';
|
||||
@@ -186,7 +186,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
|
||||
this.el = document.createElement('div');
|
||||
this.scrollable = new ScrollableElement(this.el, { vertical: options.verticalScrollbarVisibility });
|
||||
debounceEvent(this.scrollable.onScroll, (l, e) => e, types.isNumber(this.options.scrollDebounce) ? this.options.scrollDebounce : 25)(e => {
|
||||
Event.debounce(this.scrollable.onScroll, (l, e) => e, types.isNumber(this.options.scrollDebounce) ? this.options.scrollDebounce : 25)(e => {
|
||||
this.render(e.scrollTop, e.height);
|
||||
this._onScroll.fire(e.scrollTop);
|
||||
});
|
||||
@@ -284,11 +284,11 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
? (e: IBaseSashEvent) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey } as ISashEvent)
|
||||
: (e: IBaseSashEvent) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey } as ISashEvent);
|
||||
|
||||
const onStart = mapEvent(sash.onDidStart, sashEventMapper);
|
||||
const onStart = Event.map(sash.onDidStart, sashEventMapper);
|
||||
const onStartDisposable = onStart(this.onSashStart, this);
|
||||
const onChange = mapEvent(sash.onDidChange, sashEventMapper);
|
||||
const onChange = Event.map(sash.onDidChange, sashEventMapper);
|
||||
const onChangeDisposable = onChange(this.onSashChange, this);
|
||||
const onEnd = mapEvent(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash));
|
||||
const onEnd = Event.map(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash));
|
||||
const onEndDisposable = onEnd(this.onSashEnd, this);
|
||||
const onDidResetDisposable = sash.onDidReset(() => this._onDidSashReset.fire(firstIndex(this.sashItems, item => item.sash === sash)));
|
||||
|
||||
@@ -379,11 +379,11 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
? (e: IBaseSashEvent) => ({ sash, start: e.startY, current: e.currentY, alt: e.altKey } as ISashEvent)
|
||||
: (e: IBaseSashEvent) => ({ sash, start: e.startX, current: e.currentX, alt: e.altKey } as ISashEvent);
|
||||
|
||||
const onStart = mapEvent(sash.onDidStart, sashEventMapper);
|
||||
const onStart = Event.map(sash.onDidStart, sashEventMapper);
|
||||
const onStartDisposable = onStart(this.onSashStart, this);
|
||||
const onChange = mapEvent(sash.onDidChange, sashEventMapper);
|
||||
const onChange = Event.map(sash.onDidChange, sashEventMapper);
|
||||
const onChangeDisposable = onChange(this.onSashChange, this);
|
||||
const onEnd = mapEvent(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash));
|
||||
const onEnd = Event.map(sash.onDidEnd, () => firstIndex(this.sashItems, item => item.sash === sash));
|
||||
const onEndDisposable = onEnd(this.onSashEnd, this);
|
||||
const onDidResetDisposable = sash.onDidReset(() => this._onDidSashReset.fire(firstIndex(this.sashItems, item => item.sash === sash)));
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
import 'vs/css!./media/selectBox';
|
||||
|
||||
import { SelectBox as vsSelectBox, ISelectBoxStyles as vsISelectBoxStyles, ISelectBoxOptions } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { SelectBox as vsSelectBox, ISelectBoxStyles as vsISelectBoxStyles, ISelectBoxOptions, ISelectOptionItem } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { IContextViewProvider, AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
@@ -50,7 +50,7 @@ export class SelectBox extends vsSelectBox {
|
||||
private element: HTMLElement;
|
||||
|
||||
constructor(options: string[], selectedOption: string, contextViewProvider: IContextViewProvider, container?: HTMLElement, selectBoxOptions?: ISelectBoxOptions) {
|
||||
super(options, 0, contextViewProvider, undefined, selectBoxOptions);
|
||||
super(options.map(option => { return { text: option }; }), 0, contextViewProvider, undefined, selectBoxOptions);
|
||||
this._optionsDictionary = new Array();
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
this._optionsDictionary[options[i]] = i;
|
||||
@@ -114,13 +114,19 @@ export class SelectBox extends vsSelectBox {
|
||||
}
|
||||
}
|
||||
|
||||
public setOptions(options: string[], selected?: number, disabled?: number): void {
|
||||
this._optionsDictionary = [];
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
this._optionsDictionary[options[i]] = i;
|
||||
public setOptions(options: string[] | ISelectOptionItem[], selected?: number): void {
|
||||
let stringOptions: string[];
|
||||
if (options.length > 0 && typeof options[0] !== 'string') {
|
||||
stringOptions = (options as ISelectOptionItem[]).map(option => option.text);
|
||||
} else {
|
||||
stringOptions = options as string[];
|
||||
}
|
||||
this._dialogOptions = options;
|
||||
super.setOptions(options, selected, disabled);
|
||||
this._optionsDictionary = [];
|
||||
for (var i = 0; i < stringOptions.length; i++) {
|
||||
this._optionsDictionary[stringOptions[i]] = i;
|
||||
}
|
||||
this._dialogOptions = stringOptions;
|
||||
super.setOptions(stringOptions.map(option => { return { text: option }; }), selected);
|
||||
}
|
||||
|
||||
public get value(): string {
|
||||
|
||||
@@ -6,7 +6,6 @@ import { Observable } from 'rxjs/Observable';
|
||||
import { Observer } from 'rxjs/Observer';
|
||||
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { compare as stringCompare } from 'vs/base/common/strings';
|
||||
|
||||
@@ -153,7 +152,7 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
||||
|
||||
find(exp: string, maxMatches: number = 0): Thenable<IFindPosition> {
|
||||
if (!this._findFn) {
|
||||
return TPromise.wrapError(new Error('no find function provided'));
|
||||
return Promise.reject(new Error('no find function provided'));
|
||||
}
|
||||
this._findArray = new Array<IFindPosition>();
|
||||
this._findIndex = 0;
|
||||
@@ -180,7 +179,7 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
||||
return this._findArray[this._findIndex];
|
||||
});
|
||||
} else {
|
||||
return TPromise.wrapError(new Error('no expression'));
|
||||
return Promise.reject(new Error('no expression'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,9 +197,9 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
||||
} else {
|
||||
++this._findIndex;
|
||||
}
|
||||
return TPromise.as(this._findArray[this._findIndex]);
|
||||
return Promise.resolve(this._findArray[this._findIndex]);
|
||||
} else {
|
||||
return TPromise.wrapError(new Error('no search running'));
|
||||
return Promise.reject(new Error('no search running'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,17 +210,17 @@ export class TableDataView<T extends Slick.SlickData> implements IDisposableData
|
||||
} else {
|
||||
--this._findIndex;
|
||||
}
|
||||
return TPromise.as(this._findArray[this._findIndex]);
|
||||
return Promise.resolve(this._findArray[this._findIndex]);
|
||||
} else {
|
||||
return TPromise.wrapError(new Error('no search running'));
|
||||
return Promise.reject(new Error('no search running'));
|
||||
}
|
||||
}
|
||||
|
||||
get currentFindPosition(): Thenable<IFindPosition> {
|
||||
if (this._findArray && this._findArray.length !== 0) {
|
||||
return TPromise.as(this._findArray[this._findIndex]);
|
||||
return Promise.resolve(this._findArray[this._findIndex]);
|
||||
} else {
|
||||
return TPromise.wrapError(new Error('no search running'));
|
||||
return Promise.reject(new Error('no search running'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
import 'vs/css!vs/base/browser/ui/actionbar/actionbar';
|
||||
|
||||
import { Promise } from 'vs/base/common/winjs.base';
|
||||
import { Builder, $ } from 'sql/base/browser/builder';
|
||||
import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
@@ -363,7 +362,7 @@ export class ActionBar extends ActionRunner implements IActionRunner {
|
||||
//this.emit('cancel');
|
||||
}
|
||||
|
||||
public run(action: IAction, context?: any): Promise {
|
||||
public run(action: IAction, context?: any): Promise<any> {
|
||||
return this._actionRunner.run(action, context);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import { Action, IAction } from 'vs/base/common/actions';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { $, append } from 'vs/base/browser/dom';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
|
||||
@@ -68,7 +67,7 @@ export class ManageLinkedAccountAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(): TPromise<any> {
|
||||
return new TPromise<any>(() => this._accountManagementService.openAccountListDialog());
|
||||
public run(): Promise<any> {
|
||||
return new Promise<any>(() => this._accountManagementService.openAccountListDialog());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
import * as azdata from 'azdata';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
|
||||
import { error } from 'sql/base/common/log';
|
||||
@@ -47,13 +46,13 @@ export class AddAccountAction extends Action {
|
||||
this._addAccountStartEmitter = new Emitter<void>();
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
let self = this;
|
||||
|
||||
// Fire the event that we've started adding accounts
|
||||
this._addAccountStartEmitter.fire();
|
||||
|
||||
return new TPromise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
self._accountManagementService.addAccount(self._providerId)
|
||||
.then(
|
||||
() => {
|
||||
@@ -87,7 +86,7 @@ export class RemoveAccountAction extends Action {
|
||||
super(RemoveAccountAction.ID, RemoveAccountAction.LABEL, 'remove-account-action icon remove');
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
let self = this;
|
||||
|
||||
// Ask for Confirm
|
||||
@@ -100,9 +99,9 @@ export class RemoveAccountAction extends Action {
|
||||
|
||||
return this._dialogService.confirm(confirm).then(result => {
|
||||
if (!result) {
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
} else {
|
||||
return new TPromise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
self._accountManagementService.removeAccount(self._account.key)
|
||||
.then(
|
||||
(result) => { resolve(result); },
|
||||
@@ -135,9 +134,9 @@ export class ApplyFilterAction extends Action {
|
||||
super(id, label, 'apply-filters-action icon filter');
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
// Todo: apply filter to the account
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,9 +153,9 @@ export class RefreshAccountAction extends Action {
|
||||
) {
|
||||
super(RefreshAccountAction.ID, RefreshAccountAction.LABEL, 'refresh-account-action icon refresh');
|
||||
}
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
let self = this;
|
||||
return new TPromise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (self.account) {
|
||||
self._accountManagementService.refreshAccount(self.account)
|
||||
.then(
|
||||
|
||||
@@ -75,7 +75,7 @@ export const accountsContribution: IJSONSchema = {
|
||||
]
|
||||
};
|
||||
|
||||
ExtensionsRegistry.registerExtensionPoint<IAccountContrib | IAccountContrib[]>('account-type', [], accountsContribution).setHandler(extensions => {
|
||||
ExtensionsRegistry.registerExtensionPoint<IAccountContrib | IAccountContrib[]>({ extensionPoint: 'account-type', jsonSchema: accountsContribution }).setHandler(extensions => {
|
||||
|
||||
function handleCommand(account: IAccountContrib, extension: IExtensionPointUser<any>) {
|
||||
let { icon, id } = account;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import 'vs/css!sql/parts/query/editor/media/queryEditor';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -58,9 +57,9 @@ export class CreateLoginEditor extends BaseEditor {
|
||||
public layout(dimension: DOM.Dimension): void {
|
||||
}
|
||||
|
||||
public setInput(input: CreateLoginInput, options: EditorOptions): Thenable<void> {
|
||||
public setInput(input: CreateLoginInput, options: EditorOptions): Promise<void> {
|
||||
if (this.input instanceof CreateLoginInput && this.input.matches(input)) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
if (!input.hasInitialized) {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorInput, EditorModel } from 'vs/workbench/common/editor';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
@@ -43,7 +42,7 @@ export class CreateLoginInput extends EditorInput {
|
||||
return this._connection;
|
||||
}
|
||||
|
||||
public resolve(refresh?: boolean): TPromise<EditorModel> {
|
||||
public resolve(refresh?: boolean): Promise<EditorModel> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import nls = require('vs/nls');
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
@@ -50,7 +49,7 @@ export class ClearRecentConnectionsAction extends Action {
|
||||
this._useConfirmationMessage = value;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
if (this._useConfirmationMessage) {
|
||||
return this.promptConfirmationMessage().then(result => {
|
||||
if (result.confirmed) {
|
||||
@@ -75,9 +74,9 @@ export class ClearRecentConnectionsAction extends Action {
|
||||
}
|
||||
}
|
||||
|
||||
private promptQuickOpenService(): TPromise<boolean> {
|
||||
private promptQuickOpenService(): Promise<boolean> {
|
||||
const self = this;
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
let choices: { key, value }[] = [
|
||||
{ key: nls.localize('connectionAction.yes', 'Yes'), value: true },
|
||||
{ key: nls.localize('connectionAction.no', 'No'), value: false }
|
||||
@@ -90,7 +89,7 @@ export class ClearRecentConnectionsAction extends Action {
|
||||
});
|
||||
}
|
||||
|
||||
private promptConfirmationMessage(): TPromise<IConfirmationResult> {
|
||||
private promptConfirmationMessage(): Promise<IConfirmationResult> {
|
||||
let confirm: IConfirmation = {
|
||||
message: nls.localize('clearRecentConnectionMessage', 'Are you sure you want to delete all the connections from the list?'),
|
||||
primaryButton: nls.localize('connectionDialog.yes', 'Yes'),
|
||||
@@ -98,7 +97,7 @@ export class ClearRecentConnectionsAction extends Action {
|
||||
type: 'question'
|
||||
};
|
||||
|
||||
return new TPromise<IConfirmationResult>((resolve, reject) => {
|
||||
return new Promise<IConfirmationResult>((resolve, reject) => {
|
||||
this._dialogService.confirm(confirm).then((confirmed) => {
|
||||
resolve(confirmed);
|
||||
});
|
||||
@@ -126,8 +125,8 @@ export class ClearSingleRecentConnectionAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
return new TPromise<void>((resolve, reject) => {
|
||||
public run(): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
resolve(this._connectionManagementService.clearRecentConnection(this._connectionProfile));
|
||||
this._onRecentConnectionRemoved.fire();
|
||||
});
|
||||
@@ -155,8 +154,8 @@ export class GetCurrentConnectionStringAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
return new TPromise<void>((resolve, reject) => {
|
||||
public run(): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let activeInput = this._editorService.activeEditor;
|
||||
if (activeInput && (activeInput instanceof QueryInput || activeInput instanceof EditDataInput || activeInput instanceof DashboardInput)
|
||||
&& this._connectionManagementService.isConnected(activeInput.uri)) {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { DefaultController, ICancelableEvent } from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Action, IAction } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
@@ -30,13 +29,13 @@ export class EditDashboardAction extends Action {
|
||||
super(EditDashboardAction.ID, EditDashboardAction.EDITLABEL, EditDashboardAction.ICON);
|
||||
}
|
||||
|
||||
run(): TPromise<boolean> {
|
||||
run(): Promise<boolean> {
|
||||
try {
|
||||
this.editFn.apply(this.context);
|
||||
this.toggleLabel();
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
} catch (e) {
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,12 +63,12 @@ export class RefreshWidgetAction extends Action {
|
||||
super(RefreshWidgetAction.ID, RefreshWidgetAction.LABEL, RefreshWidgetAction.ICON);
|
||||
}
|
||||
|
||||
run(): TPromise<boolean> {
|
||||
run(): Promise<boolean> {
|
||||
try {
|
||||
this.refreshFn.apply(this.context);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
} catch (e) {
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,9 +110,9 @@ export class DeleteWidgetAction extends Action {
|
||||
super(DeleteWidgetAction.ID, DeleteWidgetAction.LABEL, DeleteWidgetAction.ICON);
|
||||
}
|
||||
|
||||
run(): TPromise<boolean> {
|
||||
run(): Promise<boolean> {
|
||||
this.angularEventService.sendAngularEvent(this._uri, AngularEventType.DELETE_WIDGET, { id: this._widgetId });
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,11 +143,11 @@ export class PinUnpinTabAction extends Action {
|
||||
}
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
this._isPinned = !this._isPinned;
|
||||
this.updatePinStatus();
|
||||
this.angularEventService.sendAngularEvent(this._uri, AngularEventType.PINUNPIN_TAB, { tabId: this._tabId, isPinned: this._isPinned });
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,9 +169,9 @@ export class AddFeatureTabAction extends Action {
|
||||
this._disposables.push(toDisposableSubscription(this._angularEventService.onAngularEvent(this._uri, (event) => this.handleDashboardEvent(event))));
|
||||
}
|
||||
|
||||
run(): TPromise<boolean> {
|
||||
run(): Promise<boolean> {
|
||||
this._newDashboardTabService.showDialog(this._dashboardTabs, this._openedTabs, this._uri);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
@@ -219,10 +218,10 @@ export class CollapseWidgetAction extends Action {
|
||||
);
|
||||
}
|
||||
|
||||
run(): TPromise<boolean> {
|
||||
run(): Promise<boolean> {
|
||||
this._toggleState();
|
||||
this._angularEventService.sendAngularEvent(this._uri, AngularEventType.COLLAPSE_WIDGET, this._widgetUuid);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
private _toggleState(): void {
|
||||
|
||||
@@ -76,7 +76,7 @@ const tabContributionSchema: IJSONSchema = {
|
||||
]
|
||||
};
|
||||
|
||||
ExtensionsRegistry.registerExtensionPoint<IDashboardTabContrib | IDashboardTabContrib[]>('dashboard.tabs', [], tabContributionSchema).setHandler(extensions => {
|
||||
ExtensionsRegistry.registerExtensionPoint<IDashboardTabContrib | IDashboardTabContrib[]>({ extensionPoint: 'dashboard.tabs', jsonSchema: tabContributionSchema }).setHandler(extensions => {
|
||||
|
||||
function handleCommand(tab: IDashboardTabContrib, extension: IExtensionPointUser<any>) {
|
||||
let { description, container, provider, title, when, id, alwaysShow, isHomeTab } = tab;
|
||||
|
||||
@@ -55,7 +55,7 @@ const containerContributionSchema: IJSONSchema = {
|
||||
]
|
||||
};
|
||||
|
||||
ExtensionsRegistry.registerExtensionPoint<IDashboardContainerContrib | IDashboardContainerContrib[]>('dashboard.containers', [], containerContributionSchema).setHandler(extensions => {
|
||||
ExtensionsRegistry.registerExtensionPoint<IDashboardContainerContrib | IDashboardContainerContrib[]>({ extensionPoint: 'dashboard.containers', jsonSchema: containerContributionSchema }).setHandler(extensions => {
|
||||
|
||||
function handleCommand(dashboardContainer: IDashboardContainerContrib, extension: IExtensionPointUser<any>) {
|
||||
let { id, container } = dashboardContainer;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -77,9 +76,9 @@ export class DashboardEditor extends BaseEditor {
|
||||
this._dashboardService.layout(dimension);
|
||||
}
|
||||
|
||||
public setInput(input: DashboardInput, options: EditorOptions): TPromise<void> {
|
||||
public setInput(input: DashboardInput, options: EditorOptions): Promise<void> {
|
||||
if (this.input && this.input.matches(input)) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
const parentElement = this.getContainer();
|
||||
@@ -93,10 +92,10 @@ export class DashboardEditor extends BaseEditor {
|
||||
container.style.height = '100%';
|
||||
this._dashboardContainer = DOM.append(parentElement, container);
|
||||
this.input.container = this._dashboardContainer;
|
||||
return TPromise.wrap(input.initializedPromise.then(() => this.bootstrapAngular(input)));
|
||||
return Promise.resolve(input.initializedPromise.then(() => this.bootstrapAngular(input)));
|
||||
} else {
|
||||
this._dashboardContainer = DOM.append(parentElement, this.input.container);
|
||||
return TPromise.wrap<void>(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorInput, EditorModel } from 'vs/workbench/common/editor';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -140,7 +139,7 @@ export class DashboardInput extends EditorInput {
|
||||
return this._connectionService.getConnectionProfile(this._uri);
|
||||
}
|
||||
|
||||
public resolve(refresh?: boolean): TPromise<EditorModel> {
|
||||
public resolve(refresh?: boolean): Promise<EditorModel> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
import { RunQueryOnConnectionMode, IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
@@ -27,8 +26,8 @@ export class RunInsightQueryAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(context: InsightActionContext): TPromise<boolean> {
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
public run(context: InsightActionContext): Promise<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
TaskUtilities.newQuery(
|
||||
context.profile,
|
||||
this._connectionManagementService,
|
||||
|
||||
@@ -29,7 +29,6 @@ import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/
|
||||
import { IntervalTimer, createCancelablePromise } from 'vs/base/common/async';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { isPromiseCanceledError } from 'vs/base/common/errors';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
@@ -93,7 +92,7 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
|
||||
this._updateChild(result);
|
||||
this.setupInterval();
|
||||
} else {
|
||||
this.queryObv = Observable.fromPromise(TPromise.as<SimpleExecuteResult>(result));
|
||||
this.queryObv = Observable.fromPromise(Promise.resolve<SimpleExecuteResult>(result));
|
||||
}
|
||||
},
|
||||
error => {
|
||||
@@ -104,7 +103,7 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
|
||||
if (this._init) {
|
||||
this.showError(error);
|
||||
} else {
|
||||
this.queryObv = Observable.fromPromise(TPromise.as<SimpleExecuteResult>(error));
|
||||
this.queryObv = Observable.fromPromise(Promise.resolve<SimpleExecuteResult>(error));
|
||||
}
|
||||
}
|
||||
).then(() => this._cd.detectChanges());
|
||||
@@ -211,8 +210,8 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
|
||||
return `insights.${this.insightConfig.cacheId}.${this.dashboardService.connectionManagementService.connectionInfo.connectionProfile.getOptionsKey()}`;
|
||||
}
|
||||
|
||||
private _runQuery(): TPromise<SimpleExecuteResult> {
|
||||
return TPromise.wrap(this.dashboardService.queryManagementService.runQueryAndReturn(this.insightConfig.query as string).then(
|
||||
private _runQuery(): Promise<SimpleExecuteResult> {
|
||||
return Promise.resolve(this.dashboardService.queryManagementService.runQueryAndReturn(this.insightConfig.query as string).then(
|
||||
result => {
|
||||
return this._storeResult(result);
|
||||
},
|
||||
|
||||
@@ -17,7 +17,7 @@ const insightRegistry = Registry.as<IInsightRegistry>(InsightExtensions.InsightC
|
||||
|
||||
registerDashboardWidget('insights-widget', '', insightsSchema);
|
||||
|
||||
ExtensionsRegistry.registerExtensionPoint<IInsightTypeContrib | IInsightTypeContrib[]>('dashboard.insights', [], insightsContribution).setHandler(extensions => {
|
||||
ExtensionsRegistry.registerExtensionPoint<IInsightTypeContrib | IInsightTypeContrib[]>({ extensionPoint: 'dashboard.insights', jsonSchema: insightsContribution }).setHandler(extensions => {
|
||||
|
||||
function handleCommand(insight: IInsightTypeContrib, extension: IExtensionPointUser<any>) {
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
|
||||
import { forEach } from 'vs/base/common/collections';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions, ICustomViewDescriptor, ViewsRegistry } from 'vs/workbench/common/views';
|
||||
import { IViewContainersRegistry, ViewContainer, Extensions as ViewContainerExtensions, ViewsRegistry, ITreeViewDescriptor } from 'vs/workbench/common/views';
|
||||
import { IExtensionPoint, ExtensionsRegistry, ExtensionMessageCollector } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -15,7 +15,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { CustomTreeViewPanel } from 'vs/workbench/browser/parts/views/customView';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { viewsContainersExtensionPoint } from 'vs/workbench/api/browser/viewsContainersExtensionPoint';
|
||||
import { viewsContainersExtensionPoint } from 'vs/workbench/api/browser/viewsExtensionPoint';
|
||||
|
||||
import { CustomTreeView } from 'sql/workbench/browser/parts/views/customView';
|
||||
|
||||
@@ -71,7 +71,7 @@ const dataExplorerContribution: IJSONSchema = {
|
||||
};
|
||||
|
||||
|
||||
const dataExplorerExtensionPoint: IExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }> = ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }>('dataExplorer', [viewsContainersExtensionPoint], dataExplorerContribution);
|
||||
const dataExplorerExtensionPoint: IExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }> = ExtensionsRegistry.registerExtensionPoint<{ [loc: string]: IUserFriendlyViewDescriptor[] }>({ extensionPoint: 'dataExplorer', deps: [viewsContainersExtensionPoint], jsonSchema: dataExplorerContribution });
|
||||
|
||||
class DataExplorerContainerExtensionHandler implements IWorkbenchContribution {
|
||||
|
||||
@@ -115,11 +115,10 @@ class DataExplorerContainerExtensionHandler implements IWorkbenchContribution {
|
||||
return null;
|
||||
}
|
||||
|
||||
const viewDescriptor = <ICustomViewDescriptor>{
|
||||
const viewDescriptor = <ITreeViewDescriptor>{
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
ctor: CustomTreeViewPanel,
|
||||
container,
|
||||
when: ContextKeyExpr.deserialize(item.when),
|
||||
canToggleVisibility: true,
|
||||
collapsed: this.showCollapsed(container),
|
||||
@@ -129,7 +128,7 @@ class DataExplorerContainerExtensionHandler implements IWorkbenchContribution {
|
||||
viewIds.push(viewDescriptor.id);
|
||||
return viewDescriptor;
|
||||
}));
|
||||
ViewsRegistry.registerViews(viewDescriptors);
|
||||
ViewsRegistry.registerViews(viewDescriptors, container);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
'use strict';
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
@@ -40,14 +39,13 @@ export class DataExplorerViewletViewsContribution implements IWorkbenchContribut
|
||||
private registerViews(): void {
|
||||
let viewDescriptors = [];
|
||||
viewDescriptors.push(this.createObjectExplorerViewDescriptor());
|
||||
ViewsRegistry.registerViews(viewDescriptors);
|
||||
ViewsRegistry.registerViews(viewDescriptors, VIEW_CONTAINER);
|
||||
}
|
||||
|
||||
private createObjectExplorerViewDescriptor(): IViewDescriptor {
|
||||
return {
|
||||
id: 'dataExplorer.servers',
|
||||
name: localize('dataExplorer.servers', "Servers"),
|
||||
container: VIEW_CONTAINER,
|
||||
ctor: ConnectionViewletPanel,
|
||||
weight: 100,
|
||||
canToggleVisibility: true,
|
||||
@@ -117,7 +115,7 @@ export class DataExplorerViewlet extends ViewContainerViewlet {
|
||||
|
||||
protected onDidAddViews(added: IAddedViewDescriptorRef[]): ViewletPanel[] {
|
||||
const addedViews = super.onDidAddViews(added);
|
||||
TPromise.join(addedViews);
|
||||
Promise.all(addedViews);
|
||||
return addedViews;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorInput, EditorModel, ConfirmResult, EncodingMode } from 'vs/workbench/common/editor';
|
||||
import { IConnectionManagementService, IConnectableInput, INewConnectionParams } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { IQueryModelService } from 'sql/platform/query/common/queryModel';
|
||||
@@ -112,10 +111,10 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
|
||||
public get setup(): boolean { return this._setup; }
|
||||
public get rowLimit(): number { return this._rowLimit; }
|
||||
public get objectType(): string { return this._objectType; }
|
||||
public showResultsEditor(): void { this._showResultsEditor.fire(); }
|
||||
public showResultsEditor(): void { this._showResultsEditor.fire(undefined); }
|
||||
public isDirty(): boolean { return false; }
|
||||
public save(): TPromise<boolean> { return TPromise.as(false); }
|
||||
public confirmSave(): TPromise<ConfirmResult> { return TPromise.wrap(ConfirmResult.DONT_SAVE); }
|
||||
public save(): Promise<boolean> { return Promise.resolve(false); }
|
||||
public confirmSave(): Promise<ConfirmResult> { return Promise.resolve(ConfirmResult.DONT_SAVE); }
|
||||
public getTypeId(): string { return EditDataInput.ID; }
|
||||
public setBootstrappedTrue(): void { this._hasBootstrapped = true; }
|
||||
public getResource(): URI { return this._uri; }
|
||||
@@ -233,7 +232,7 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
|
||||
|
||||
public get onDidModelChangeContent(): Event<void> { return this._sql.onDidModelChangeContent; }
|
||||
public get onDidModelChangeEncoding(): Event<void> { return this._sql.onDidModelChangeEncoding; }
|
||||
public resolve(refresh?: boolean): TPromise<EditorModel> { return this._sql.resolve(); }
|
||||
public resolve(refresh?: boolean): Promise<EditorModel> { return this._sql.resolve(); }
|
||||
public getEncoding(): string { return this._sql.getEncoding(); }
|
||||
public suggestFileName(): string { return this._sql.suggestFileName(); }
|
||||
public getName(): string { return this._sql.getName(); }
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
'use strict';
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
@@ -47,8 +46,8 @@ export class EditDataResultsInput extends EditorInput {
|
||||
return false;
|
||||
}
|
||||
|
||||
resolve(refresh?: boolean): TPromise<any> {
|
||||
return TPromise.as(null);
|
||||
resolve(refresh?: boolean): Promise<any> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
supportsSplitEditor(): boolean {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import 'vs/css!sql/parts/query/editor/media/queryEditor';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as nls from 'vs/nls';
|
||||
@@ -221,7 +220,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
/**
|
||||
* Sets the input data for this editor.
|
||||
*/
|
||||
public setInput(newInput: EditDataInput, options?: EditorOptions): Thenable<void> {
|
||||
public setInput(newInput: EditDataInput, options?: EditorOptions): Promise<void> {
|
||||
let oldInput = <EditDataInput>this.input;
|
||||
if (!newInput.setup) {
|
||||
this._initialized = false;
|
||||
@@ -259,16 +258,16 @@ export class EditDataEditor extends BaseEditor {
|
||||
}
|
||||
|
||||
// PRIVATE METHODS ////////////////////////////////////////////////////////////
|
||||
private _createEditor(editorInput: EditorInput, container: HTMLElement): TPromise<BaseEditor> {
|
||||
private _createEditor(editorInput: EditorInput, container: HTMLElement): Promise<BaseEditor> {
|
||||
const descriptor = this._editorDescriptorService.getEditor(editorInput);
|
||||
if (!descriptor) {
|
||||
return TPromise.wrapError(new Error(strings.format('Can not find a registered editor for the input {0}', editorInput)));
|
||||
return Promise.reject(new Error(strings.format('Can not find a registered editor for the input {0}', editorInput)));
|
||||
}
|
||||
|
||||
let editor = descriptor.instantiate(this._instantiationService);
|
||||
editor.create(container);
|
||||
editor.setVisible(this.isVisible(), editor.group);
|
||||
return TPromise.as(editor);
|
||||
return Promise.resolve(editor);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -518,7 +517,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
/**
|
||||
* Sets input for the results editor after it has been created.
|
||||
*/
|
||||
private _onResultsEditorCreated(resultsEditor: EditDataResultsEditor, resultsInput: EditDataResultsInput, options: EditorOptions): TPromise<void> {
|
||||
private _onResultsEditorCreated(resultsEditor: EditDataResultsEditor, resultsInput: EditDataResultsInput, options: EditorOptions): Promise<void> {
|
||||
this._resultsEditor = resultsEditor;
|
||||
return this._resultsEditor.setInput(resultsInput, options);
|
||||
}
|
||||
@@ -546,22 +545,22 @@ export class EditDataEditor extends BaseEditor {
|
||||
* - Opened for the first time
|
||||
* - Opened with a new EditDataInput
|
||||
*/
|
||||
private _setNewInput(newInput: EditDataInput, options?: EditorOptions): TPromise<any> {
|
||||
private _setNewInput(newInput: EditDataInput, options?: EditorOptions): Promise<any> {
|
||||
|
||||
// Promises that will ensure proper ordering of editor creation logic
|
||||
let createEditors: () => TPromise<any>;
|
||||
let onEditorsCreated: (result) => TPromise<any>;
|
||||
let createEditors: () => Promise<any>;
|
||||
let onEditorsCreated: (result) => Promise<any>;
|
||||
|
||||
// If both editors exist, create joined promises - one for each editor
|
||||
if (this._isResultsEditorVisible()) {
|
||||
createEditors = () => {
|
||||
return TPromise.join([
|
||||
return Promise.all([
|
||||
this._createEditor(<EditDataResultsInput>newInput.results, this._resultsEditorContainer),
|
||||
this._createEditor(<UntitledEditorInput>newInput.sql, this._sqlEditorContainer)
|
||||
]);
|
||||
};
|
||||
onEditorsCreated = (result: IEditor[]) => {
|
||||
return TPromise.join([
|
||||
return Promise.all([
|
||||
this._onResultsEditorCreated(<EditDataResultsEditor>result[0], newInput.results, options),
|
||||
this._onSqlEditorCreated(<TextResourceEditor>result[1], newInput.sql, options)
|
||||
]);
|
||||
@@ -573,16 +572,16 @@ export class EditDataEditor extends BaseEditor {
|
||||
return this._createEditor(<UntitledEditorInput>newInput.sql, this._sqlEditorContainer);
|
||||
};
|
||||
onEditorsCreated = (result: TextResourceEditor) => {
|
||||
return TPromise.join([
|
||||
return Promise.all([
|
||||
this._onSqlEditorCreated(result, newInput.sql, options)
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
||||
// Create a promise to re render the layout after the editor creation logic
|
||||
let doLayout: () => TPromise<any> = () => {
|
||||
let doLayout: () => Promise<any> = () => {
|
||||
this._doLayout();
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
};
|
||||
|
||||
// Run all three steps synchronously
|
||||
@@ -632,7 +631,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
* Handles setting input for this editor. If this new input does not match the old input (e.g. a new file
|
||||
* has been opened with the same editor, or we are opening the editor for the first time).
|
||||
*/
|
||||
private _updateInput(oldInput: EditDataInput, newInput: EditDataInput, options?: EditorOptions): TPromise<void> {
|
||||
private _updateInput(oldInput: EditDataInput, newInput: EditDataInput, options?: EditorOptions): Promise<void> {
|
||||
if (this._sqlEditor) {
|
||||
this._sqlEditor.clearInput();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import * as DOM from 'vs/base/browser/dom';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Builder } from 'sql/base/browser/builder';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { getZoomLevel } from 'vs/base/browser/browser';
|
||||
import { Configuration } from 'vs/editor/browser/config/configuration';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -65,13 +64,13 @@ export class EditDataResultsEditor extends BaseEditor {
|
||||
public layout(dimension: DOM.Dimension): void {
|
||||
}
|
||||
|
||||
public setInput(input: EditDataResultsInput, options: EditorOptions): TPromise<void> {
|
||||
public setInput(input: EditDataResultsInput, options: EditorOptions): Promise<void> {
|
||||
super.setInput(input, options, CancellationToken.None);
|
||||
this._applySettings();
|
||||
if (!input.hasBootstrapped) {
|
||||
this._bootstrapAngular();
|
||||
}
|
||||
return TPromise.wrap<void>(null);
|
||||
return Promise.resolve<void>(null);
|
||||
}
|
||||
|
||||
private _applySettings() {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Action, IActionItem, IActionRunner } from 'vs/base/common/actions';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IQueryModelService } from 'sql/platform/query/common/queryModel';
|
||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||
@@ -37,7 +36,7 @@ export abstract class EditDataAction extends Action {
|
||||
/**
|
||||
* This method is executed when the button is clicked.
|
||||
*/
|
||||
public abstract run(): TPromise<void>;
|
||||
public abstract run(): Promise<void>;
|
||||
|
||||
protected setClass(enabledClass: string): void {
|
||||
this._classes = [];
|
||||
@@ -75,7 +74,7 @@ export class RefreshTableAction extends EditDataAction {
|
||||
this.label = nls.localize('editData.run', 'Run');
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
if (this.isConnected(this.editor)) {
|
||||
let input = this.editor.editDataInput;
|
||||
|
||||
@@ -97,7 +96,7 @@ export class RefreshTableAction extends EditDataAction {
|
||||
});
|
||||
});
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,10 +117,10 @@ export class StopRefreshTableAction extends EditDataAction {
|
||||
this.label = nls.localize('editData.stop', 'Stop');
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
let input = this.editor.editDataInput;
|
||||
this._queryModelService.disposeEdit(input.uri);
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,9 +141,9 @@ export class ChangeMaxRowsAction extends EditDataAction {
|
||||
this.class = ChangeMaxRowsAction.EnabledClass;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,9 +260,9 @@ export class ShowQueryPaneAction extends EditDataAction {
|
||||
}
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
this.editor.toggleQueryPane();
|
||||
this.updateLabel(this.editor.queryPaneEnabled());
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,11 @@
|
||||
import 'vs/css!vs/workbench/parts/extensions/electron-browser/media/extensionEditor';
|
||||
|
||||
|
||||
import { IExtensionManifest } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { append, $, addClass, removeClass, finalHandler, join, toggleClass } from 'vs/base/browser/dom';
|
||||
import { append, $ } from 'vs/base/browser/dom';
|
||||
import { IInsightTypeContrib } from 'sql/parts/dashboard/widgets/insights/interfaces';
|
||||
import { IDashboardTabContrib } from 'sql/parts/dashboard/common/dashboardTab.contribution';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IExtensionManifest } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
class ContributionReader {
|
||||
constructor(private manifest: IExtensionManifest) { }
|
||||
|
||||
@@ -9,7 +9,6 @@ import { IGridInfo } from 'sql/parts/grid/common/interfaces';
|
||||
import { DataService } from 'sql/parts/grid/services/dataService';
|
||||
import { GridActionProvider } from 'sql/parts/grid/views/gridActions';
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IAction, Action } from 'vs/base/common/actions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
@@ -48,9 +47,9 @@ export class DeleteRowAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(gridInfo: IGridInfo): TPromise<boolean> {
|
||||
public run(gridInfo: IGridInfo): Promise<boolean> {
|
||||
this.callback(gridInfo.rowIndex);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +65,8 @@ export class RevertRowAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(gridInfo: IGridInfo): TPromise<boolean> {
|
||||
public run(gridInfo: IGridInfo): Promise<boolean> {
|
||||
this.callback();
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import { IGridInfo, SaveFormat } from 'sql/parts/grid/common/interfaces';
|
||||
import { DataService } from 'sql/parts/grid/services/dataService';
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IAction, Action } from 'vs/base/common/actions';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -88,14 +87,14 @@ export class SaveResultAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(gridInfo: IGridInfo): TPromise<boolean> {
|
||||
public run(gridInfo: IGridInfo): Promise<boolean> {
|
||||
this.dataService.sendSaveRequest({
|
||||
batchIndex: gridInfo.batchIndex,
|
||||
resultSetNumber: gridInfo.resultSetNumber,
|
||||
selection: gridInfo.selection,
|
||||
format: this.format
|
||||
});
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,9 +114,9 @@ export class CopyResultAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(gridInfo: IGridInfo): TPromise<boolean> {
|
||||
public run(gridInfo: IGridInfo): Promise<boolean> {
|
||||
this.dataService.copyResults(gridInfo.selection, gridInfo.batchIndex, gridInfo.resultSetNumber, this.copyHeader);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,9 +132,9 @@ export class SelectAllGridAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(gridInfo: IGridInfo): TPromise<boolean> {
|
||||
public run(gridInfo: IGridInfo): Promise<boolean> {
|
||||
this.selectAllCallback(gridInfo.gridIndex);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,9 +150,9 @@ export class SelectAllMessagesAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
this.selectAllCallback();
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,8 +168,8 @@ export class CopyMessagesAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(selectedRange: Selection): TPromise<boolean> {
|
||||
public run(selectedRange: Selection): Promise<boolean> {
|
||||
this.clipboardService.writeText(selectedRange.toString());
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import { CommonServiceInterface } from 'sql/services/common/commonServiceInterfa
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IDashboardService } from 'sql/platform/dashboard/browser/dashboardService';
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
} from 'sql/workbench/common/actions';
|
||||
import * as tree from 'vs/base/parts/tree/browser/tree';
|
||||
import * as TreeDefaults from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { Promise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
@@ -78,19 +77,19 @@ export class JobHistoryDataSource implements tree.IDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
public getChildren(tree: tree.ITree, element: JobHistoryRow | JobHistoryModel): Promise {
|
||||
public getChildren(tree: tree.ITree, element: JobHistoryRow | JobHistoryModel): Promise<JobHistoryRow[]> {
|
||||
if (element instanceof JobHistoryModel) {
|
||||
return TPromise.as(this._data);
|
||||
return Promise.resolve(this._data);
|
||||
} else {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
public getParent(tree: tree.ITree, element: JobHistoryRow | JobHistoryModel): Promise {
|
||||
public getParent(tree: tree.ITree, element: JobHistoryRow | JobHistoryModel): Promise<JobHistoryModel> {
|
||||
if (element instanceof JobHistoryModel) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
} else {
|
||||
return TPromise.as(new JobHistoryModel());
|
||||
return Promise.resolve(new JobHistoryModel());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as tree from 'vs/base/parts/tree/browser/tree';
|
||||
import * as TreeDefaults from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { Promise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
@@ -71,19 +70,19 @@ export class JobStepsViewDataSource implements tree.IDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
public getChildren(tree: tree.ITree, element: JobStepsViewRow | JobStepsViewModel): Promise {
|
||||
public getChildren(tree: tree.ITree, element: JobStepsViewRow | JobStepsViewModel): Promise<JobStepsViewRow[]> {
|
||||
if (element instanceof JobStepsViewModel) {
|
||||
return TPromise.as(this._data);
|
||||
return Promise.resolve(this._data);
|
||||
} else {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
public getParent(tree: tree.ITree, element: JobStepsViewRow | JobStepsViewModel): Promise {
|
||||
public getParent(tree: tree.ITree, element: JobStepsViewRow | JobStepsViewModel): Promise<JobStepsViewModel> {
|
||||
if (element instanceof JobStepsViewModel) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
} else {
|
||||
return TPromise.as(new JobStepsViewModel());
|
||||
return Promise.resolve(new JobStepsViewModel());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import { CommonServiceInterface } from 'sql/services/common/commonServiceInterfa
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IDashboardService } from 'sql/platform/dashboard/browser/dashboardService';
|
||||
|
||||
@@ -26,7 +26,6 @@ import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IDashboardService } from 'sql/platform/dashboard/browser/dashboardService';
|
||||
|
||||
@@ -25,7 +25,6 @@ import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
||||
import { JobManagementView } from 'sql/parts/jobManagement/views/jobManagementView';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
@@ -81,7 +81,7 @@ export default class ListBoxComponent extends ComponentBase implements IComponen
|
||||
|
||||
public setProperties(properties: { [key: string]: any; }): void {
|
||||
super.setProperties(properties);
|
||||
this._input.setOptions(this.values, this.selectedRow);
|
||||
this._input.setOptions(this.values.map(value => { return { text: value }; }), this.selectedRow);
|
||||
|
||||
this.validate();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import 'vs/css!./modelViewEditor';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
||||
import { EditorInput, EditorModel, ConfirmResult } from 'vs/workbench/common/editor';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
@@ -40,11 +39,11 @@ export class ModelViewInputModel extends EditorModel {
|
||||
this._onDidChangeDirty.fire();
|
||||
}
|
||||
|
||||
save(): TPromise<boolean> {
|
||||
save(): Promise<boolean> {
|
||||
if (this.saveHandler) {
|
||||
return TPromise.wrap(this.saveHandler(this.handle));
|
||||
return Promise.resolve(this.saveHandler(this.handle));
|
||||
}
|
||||
return TPromise.wrap(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
export class ModelViewInput extends EditorInput {
|
||||
@@ -79,7 +78,7 @@ export class ModelViewInput extends EditorInput {
|
||||
return 'ModelViewEditorInput';
|
||||
}
|
||||
|
||||
public resolve(refresh?: boolean): TPromise<IEditorModel> {
|
||||
public resolve(refresh?: boolean): Promise<IEditorModel> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -130,18 +129,18 @@ export class ModelViewInput extends EditorInput {
|
||||
/**
|
||||
* Subclasses should bring up a proper dialog for the user if the editor is dirty and return the result.
|
||||
*/
|
||||
confirmSave(): TPromise<ConfirmResult> {
|
||||
confirmSave(): Promise<ConfirmResult> {
|
||||
// TODO #2530 support save on close / confirm save. This is significantly more work
|
||||
// as we need to either integrate with textFileService (seems like this isn't viable)
|
||||
// or register our own complimentary service that handles the lifecycle operations such
|
||||
// as close all, auto save etc.
|
||||
return TPromise.wrap(ConfirmResult.DONT_SAVE);
|
||||
return Promise.resolve(ConfirmResult.DONT_SAVE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the editor if it is dirty. Subclasses return a promise with a boolean indicating the success of the operation.
|
||||
*/
|
||||
save(): TPromise<boolean> {
|
||||
save(): Promise<boolean> {
|
||||
return this._model.save();
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ export class QueryTextEditor extends BaseTextEditor {
|
||||
return options;
|
||||
}
|
||||
|
||||
setInput(input: UntitledEditorInput, options: EditorOptions): Thenable<void> {
|
||||
setInput(input: UntitledEditorInput, options: EditorOptions): Promise<void> {
|
||||
return super.setInput(input, options, CancellationToken.None)
|
||||
.then(() => this.input.resolve()
|
||||
.then(editorModel => editorModel.load())
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
'use strict';
|
||||
|
||||
import { ITree, IDataSource } from 'vs/base/parts/tree/browser/tree';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IModelViewTreeViewDataProvider, ITreeComponentItem } from 'sql/workbench/common/views';
|
||||
import { TreeItemCollapsibleState } from 'vs/workbench/common/views';
|
||||
|
||||
@@ -41,7 +40,7 @@ export class TreeComponentDataSource implements IDataSource {
|
||||
/**
|
||||
* Returns the element's children as an array in a promise.
|
||||
*/
|
||||
public getChildren(tree: ITree, node: ITreeComponentItem): TPromise<any> {
|
||||
public getChildren(tree: ITree, node: ITreeComponentItem): Promise<any> {
|
||||
if (this._dataProvider) {
|
||||
if (node && node.handle === '0') {
|
||||
return this._dataProvider.getChildren(undefined);
|
||||
@@ -49,11 +48,11 @@ export class TreeComponentDataSource implements IDataSource {
|
||||
return this._dataProvider.getChildren(node);
|
||||
}
|
||||
}
|
||||
return TPromise.as([]);
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
public getParent(tree: ITree, node: any): TPromise<any> {
|
||||
return TPromise.as(null);
|
||||
public getParent(tree: ITree, node: any): Promise<any> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public shouldAutoexpand(tree: ITree, node: ITreeComponentItem): boolean {
|
||||
|
||||
@@ -9,7 +9,6 @@ import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { IModelViewTreeViewDataProvider, ITreeComponentItem } from 'sql/workbench/common/views';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import * as vsTreeView from 'vs/workbench/api/electron-browser/mainThreadTreeViews';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
export class TreeViewDataProvider extends vsTreeView.TreeViewDataProvider implements IModelViewTreeViewDataProvider {
|
||||
constructor(handle: number, treeViewId: string,
|
||||
|
||||
@@ -27,7 +27,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { Emitter, debounceEvent } from 'vs/base/common/event';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { CellTypes } from 'sql/parts/notebook/models/contracts';
|
||||
import { OVERRIDE_EDITOR_THEMING_SETTING } from 'sql/workbench/services/notebook/common/notebookService';
|
||||
import * as notebookUtils from 'sql/parts/notebook/notebookUtils';
|
||||
@@ -107,7 +107,7 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
|
||||
) {
|
||||
super();
|
||||
this._cellToggleMoreActions = this._instantiationService.createInstance(CellToggleMoreActions);
|
||||
this._register(debounceEvent(this._layoutEmitter.event, (l, e) => e, 250, /*leading=*/false)
|
||||
this._register(Event.debounce(this._layoutEmitter.event, (l, e) => e, 250, /*leading=*/false)
|
||||
(() => this.layout()));
|
||||
// Handle disconnect on removal of the cell, if it was the active cell
|
||||
this._register({ dispose: () => this.updateConnectionState(false) });
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import { nb } from 'azdata';
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as types from 'vs/base/common/types';
|
||||
@@ -54,11 +53,11 @@ export abstract class CellActionBase extends Action {
|
||||
return true;
|
||||
}
|
||||
|
||||
public run(context: CellContext): TPromise<boolean> {
|
||||
public run(context: CellContext): Promise<boolean> {
|
||||
if (hasModelAndCell(context, this.notificationService)) {
|
||||
return TPromise.wrap(this.doRun(context).then(() => true));
|
||||
return this.doRun(context).then(() => true);
|
||||
}
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
abstract doRun(context: CellContext): Promise<void>;
|
||||
@@ -80,8 +79,8 @@ export class RunCellAction extends MultiStateAction<CellExecutionState> {
|
||||
this.ensureContextIsUpdated(context);
|
||||
}
|
||||
|
||||
public run(context?: CellContext): TPromise<boolean> {
|
||||
return TPromise.wrap(this.doRun(context).then(() => true));
|
||||
public run(context?: CellContext): Promise<boolean> {
|
||||
return this.doRun(context).then(() => true);
|
||||
}
|
||||
|
||||
public async doRun(context: CellContext): Promise<void> {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import { INotificationService, Severity, INotificationActions } from 'vs/platform/notification/common/notification';
|
||||
@@ -42,8 +41,8 @@ export class AddCellAction extends Action {
|
||||
) {
|
||||
super(id, label, cssClass);
|
||||
}
|
||||
public run(context: NotebookComponent): TPromise<boolean> {
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
public run(context: NotebookComponent): Promise<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
try {
|
||||
context.addCell(this.cellType);
|
||||
resolve(true);
|
||||
@@ -194,9 +193,9 @@ export class TrustedAction extends ToggleableAction {
|
||||
this.toggle(value);
|
||||
}
|
||||
|
||||
public run(context: NotebookComponent): TPromise<boolean> {
|
||||
public run(context: NotebookComponent): Promise<boolean> {
|
||||
let self = this;
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
try {
|
||||
if (self.trusted) {
|
||||
const actions: INotificationActions = { primary: [] };
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
@@ -59,9 +58,9 @@ export class NotebookEditor extends BaseEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public setInput(input: NotebookInput, options: EditorOptions): TPromise<void> {
|
||||
public setInput(input: NotebookInput, options: EditorOptions): Promise<void> {
|
||||
if (this.input && this.input.matches(input)) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
const parentElement = this.getContainer();
|
||||
@@ -75,11 +74,11 @@ export class NotebookEditor extends BaseEditor {
|
||||
container.style.height = '100%';
|
||||
this._notebookContainer = DOM.append(parentElement, container);
|
||||
input.container = this._notebookContainer;
|
||||
return TPromise.wrap<void>(this.bootstrapAngular(input));
|
||||
return Promise.resolve(this.bootstrapAngular(input));
|
||||
} else {
|
||||
this._notebookContainer = DOM.append(parentElement, input.container);
|
||||
input.doChangeLayout();
|
||||
return TPromise.wrap<void>(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
'use strict';
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
||||
import { EditorInput, EditorModel, ConfirmResult } from 'vs/workbench/common/editor';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
@@ -33,7 +32,6 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
|
||||
|
||||
export type ModeViewSaveHandler = (handle: number) => Thenable<boolean>;
|
||||
|
||||
|
||||
export class NotebookEditorModel extends EditorModel {
|
||||
private dirty: boolean;
|
||||
private readonly _onDidChangeDirty: Emitter<void> = this._register(new Emitter<void>());
|
||||
@@ -77,7 +75,7 @@ export class NotebookEditorModel extends EditorModel {
|
||||
this._onDidChangeDirty.fire();
|
||||
}
|
||||
|
||||
public confirmSave(): TPromise<ConfirmResult> {
|
||||
public confirmSave(): Promise<ConfirmResult> {
|
||||
return this.textFileService.confirmSave([this.notebookUri]);
|
||||
}
|
||||
|
||||
@@ -85,10 +83,10 @@ export class NotebookEditorModel extends EditorModel {
|
||||
* UntitledEditor uses TextFileService to save data from UntitledEditorInput
|
||||
* Titled editor uses TextFileEditorModel to save existing notebook
|
||||
*/
|
||||
save(options: ISaveOptions): TPromise<boolean> {
|
||||
save(options: ISaveOptions): Promise<boolean> {
|
||||
if (this.textEditorModel instanceof TextFileEditorModel) {
|
||||
this.textEditorModel.save(options);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
else {
|
||||
return this.textFileService.save(this.notebookUri, options);
|
||||
@@ -163,11 +161,11 @@ export class NotebookInput extends EditorInput {
|
||||
return this._textInput;
|
||||
}
|
||||
|
||||
public confirmSave(): TPromise<ConfirmResult> {
|
||||
public confirmSave(): Promise<ConfirmResult> {
|
||||
return this._model.confirmSave();
|
||||
}
|
||||
|
||||
public revert(): TPromise<boolean> {
|
||||
public revert(): Promise<boolean> {
|
||||
return this._textInput.revert();
|
||||
}
|
||||
|
||||
@@ -216,7 +214,7 @@ export class NotebookInput extends EditorInput {
|
||||
return this._standardKernels;
|
||||
}
|
||||
|
||||
public save(): TPromise<boolean> {
|
||||
public save(): Promise<boolean> {
|
||||
let options: ISaveOptions = { force: false };
|
||||
return this._model.save(options);
|
||||
}
|
||||
@@ -256,9 +254,9 @@ export class NotebookInput extends EditorInput {
|
||||
return this.resource;
|
||||
}
|
||||
|
||||
async resolve(): TPromise<NotebookEditorModel> {
|
||||
async resolve(): Promise<NotebookEditorModel> {
|
||||
if (this._model && this._model.isModelCreated()) {
|
||||
return TPromise.as(this._model);
|
||||
return Promise.resolve(this._model);
|
||||
} else {
|
||||
let textOrUntitledEditorModel: UntitledEditorModel | IEditorModel;
|
||||
if (this.resource.scheme === Schemas.untitled) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import 'vs/css!sql/media/actionBarLabel';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { localize } from 'vs/nls';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -89,4 +89,13 @@ if (process.env.NODE_ENV !== 'development') {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
||||
group: '3_views',
|
||||
command: {
|
||||
id: VIEWLET_ID,
|
||||
title: localize({ key: 'miViewRegisteredServers', comment: ['&& denotes a mnemonic'] }, "&&Servers")
|
||||
},
|
||||
order: 1
|
||||
});
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
@@ -43,7 +42,7 @@ export class RefreshAction extends Action {
|
||||
super(id, label);
|
||||
this._tree = tree;
|
||||
}
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
var treeNode: TreeNode;
|
||||
if (this.element instanceof ConnectionProfile) {
|
||||
let connection: ConnectionProfile = this.element;
|
||||
@@ -60,23 +59,23 @@ export class RefreshAction extends Action {
|
||||
}
|
||||
|
||||
if (treeNode) {
|
||||
this._tree.collapse(this.element).then(() => {
|
||||
this._objectExplorerService.refreshTreeNode(treeNode.getSession(), treeNode).then(() => {
|
||||
return this._tree.collapse(this.element).then(() => {
|
||||
return this._objectExplorerService.refreshTreeNode(treeNode.getSession(), treeNode).then(() => {
|
||||
|
||||
this._tree.refresh(this.element).then(() => {
|
||||
this._tree.expand(this.element);
|
||||
return this._tree.refresh(this.element).then(() => {
|
||||
return this._tree.expand(this.element);
|
||||
}, refreshError => {
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
});
|
||||
}, error => {
|
||||
this.showError(error);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
});
|
||||
}, collapseError => {
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
});
|
||||
}
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
private showError(errorMessage: string) {
|
||||
@@ -101,8 +100,8 @@ export class DisconnectConnectionAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(actionContext: ObjectExplorerActionsContext): TPromise<any> {
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
run(actionContext: ObjectExplorerActionsContext): Promise<any> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
if (!this._connectionProfile) {
|
||||
resolve(true);
|
||||
}
|
||||
@@ -143,7 +142,7 @@ export class AddServerAction extends Action {
|
||||
this.class = 'add-server-action';
|
||||
}
|
||||
|
||||
public run(element: ConnectionProfileGroup): TPromise<boolean> {
|
||||
public run(element: ConnectionProfileGroup): Promise<boolean> {
|
||||
let connection: IConnectionProfile = element === undefined ? undefined : {
|
||||
connectionName: undefined,
|
||||
serverName: undefined,
|
||||
@@ -162,7 +161,7 @@ export class AddServerAction extends Action {
|
||||
id: element.id
|
||||
};
|
||||
this._connectionManagementService.showConnectionDialog(undefined, connection);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,9 +181,9 @@ export class AddServerGroupAction extends Action {
|
||||
this.class = 'add-server-group-action';
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
this._connectionManagementService.showCreateServerGroupDialog();
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,9 +204,9 @@ export class EditServerGroupAction extends Action {
|
||||
this.class = 'edit-server-group-action';
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
this._connectionManagementService.showEditServerGroupDialog(this._group);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,10 +240,10 @@ export class ActiveConnectionsFilterAction extends Action {
|
||||
this.class = ActiveConnectionsFilterAction.enabledClass;
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
if (!this.view) {
|
||||
// return without doing anything
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
if (this.class === ActiveConnectionsFilterAction.enabledClass) {
|
||||
// show active connections in the tree
|
||||
@@ -257,7 +256,7 @@ export class ActiveConnectionsFilterAction extends Action {
|
||||
this.isSet = false;
|
||||
this.label = ActiveConnectionsFilterAction.LABEL;
|
||||
}
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,10 +288,10 @@ export class RecentConnectionsFilterAction extends Action {
|
||||
this._isSet = false;
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
if (!this.view) {
|
||||
// return without doing anything
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
if (this.class === RecentConnectionsFilterAction.enabledClass) {
|
||||
// show recent connections in the tree
|
||||
@@ -303,7 +302,7 @@ export class RecentConnectionsFilterAction extends Action {
|
||||
this.view.refreshTree();
|
||||
this.isSet = false;
|
||||
}
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,13 +330,13 @@ export class NewQueryAction extends Action {
|
||||
this.class = 'extension-action update';
|
||||
}
|
||||
|
||||
public run(actionContext: ObjectExplorerActionsContext): TPromise<boolean> {
|
||||
public run(actionContext: ObjectExplorerActionsContext): Promise<boolean> {
|
||||
if (actionContext instanceof ObjectExplorerActionsContext) {
|
||||
this._connectionProfile = new ConnectionProfile(this._capabilitiesService, actionContext.connectionProfile);
|
||||
}
|
||||
|
||||
TaskUtilities.newQuery(this._connectionProfile, this.connectionManagementService, this.queryEditorService, this._objectExplorerService, this._workbenchEditorService);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,13 +368,13 @@ export class DeleteConnectionAction extends Action {
|
||||
}
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
if (this.element instanceof ConnectionProfile) {
|
||||
this._connectionManagementService.deleteConnection(this.element);
|
||||
} else if (this.element instanceof ConnectionProfileGroup) {
|
||||
this._connectionManagementService.deleteConnectionGroup(this.element);
|
||||
}
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,8 +396,8 @@ export class ClearSearchAction extends Action {
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
public run(): TPromise<boolean> {
|
||||
public run(): Promise<boolean> {
|
||||
this._viewlet.clearSearch();
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,11 @@ import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectio
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { ITree, IDragAndDrop, IDragAndDropData, IDragOverReaction, DRAG_OVER_ACCEPT_BUBBLE_DOWN, DRAG_OVER_REJECT } from 'vs/base/parts/tree/browser/tree';
|
||||
import { ITree, IDragAndDrop, IDragOverReaction, DRAG_OVER_ACCEPT_BUBBLE_DOWN, DRAG_OVER_REJECT } from 'vs/base/parts/tree/browser/tree';
|
||||
import * as Constants from 'sql/platform/connection/common/constants';
|
||||
import { DragMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { TreeUpdateUtils } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtils';
|
||||
import { IDragAndDropData } from 'vs/base/browser/dnd';
|
||||
|
||||
/**
|
||||
* Implements drag and drop for the server tree
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
'use strict';
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { ExecuteCommandAction } from 'vs/platform/actions/common/actions';
|
||||
@@ -38,7 +37,7 @@ export class ObjectExplorerActionsContext implements azdata.ObjectExplorerContex
|
||||
public isConnectionNode: boolean = false;
|
||||
}
|
||||
|
||||
async function getTreeNode(context: ObjectExplorerActionsContext, objectExplorerService: IObjectExplorerService): TPromise<TreeNode> {
|
||||
async function getTreeNode(context: ObjectExplorerActionsContext, objectExplorerService: IObjectExplorerService): Promise<TreeNode> {
|
||||
if (context.isConnectionNode) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
@@ -100,11 +99,11 @@ export class ManageConnectionAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
run(actionContext: ObjectExplorerActionsContext): TPromise<any> {
|
||||
run(actionContext: ObjectExplorerActionsContext): Promise<any> {
|
||||
this._treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
|
||||
this._treeSelectionHandler.onTreeActionStateChange(true);
|
||||
let self = this;
|
||||
let promise = new TPromise<boolean>((resolve, reject) => {
|
||||
let promise = new Promise<boolean>((resolve, reject) => {
|
||||
self.doManage(actionContext).then((success) => {
|
||||
self.done();
|
||||
resolve(success);
|
||||
@@ -116,7 +115,7 @@ export class ManageConnectionAction extends Action {
|
||||
return promise;
|
||||
}
|
||||
|
||||
private async doManage(actionContext: ObjectExplorerActionsContext): TPromise<boolean> {
|
||||
private async doManage(actionContext: ObjectExplorerActionsContext): Promise<boolean> {
|
||||
let treeNode: TreeNode = undefined;
|
||||
let connectionProfile: IConnectionProfile = undefined;
|
||||
if (actionContext instanceof ObjectExplorerActionsContext) {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { ITree, IDataSource } from 'vs/base/parts/tree/browser/tree';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
/**
|
||||
* Implements the DataSource(that returns a parent/children of an element) for the recent connection tree
|
||||
@@ -43,26 +42,26 @@ export class RecentConnectionDataSource implements IDataSource {
|
||||
/**
|
||||
* Returns the element's children as an array in a promise.
|
||||
*/
|
||||
public getChildren(tree: ITree, element: any): TPromise<any> {
|
||||
public getChildren(tree: ITree, element: any): Promise<any> {
|
||||
if (element instanceof ConnectionProfile) {
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
} else if (element instanceof ConnectionProfileGroup) {
|
||||
return TPromise.as((<ConnectionProfileGroup>element).getChildren());
|
||||
return Promise.resolve((<ConnectionProfileGroup>element).getChildren());
|
||||
} else {
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the element's parent in a promise.
|
||||
*/
|
||||
public getParent(tree: ITree, element: any): TPromise<any> {
|
||||
public getParent(tree: ITree, element: any): Promise<any> {
|
||||
if (element instanceof ConnectionProfile) {
|
||||
return TPromise.as((<ConnectionProfile>element).getParent());
|
||||
return Promise.resolve((<ConnectionProfile>element).getParent());
|
||||
} else if (element instanceof ConnectionProfileGroup) {
|
||||
return TPromise.as((<ConnectionProfileGroup>element).getParent());
|
||||
return Promise.resolve((<ConnectionProfileGroup>element).getParent());
|
||||
} else {
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import * as azdata from 'azdata';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { ContributableActionProvider } from 'vs/workbench/browser/actions';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
|
||||
@@ -9,7 +9,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
|
||||
import { ITree, IDataSource } from 'vs/base/parts/tree/browser/tree';
|
||||
import { TreeNode, TreeItemCollapsibleState } from 'sql/parts/objectExplorer/common/treeNode';
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { TreeUpdateUtils } from 'sql/parts/objectExplorer/viewlet/treeUpdateUtils';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
@@ -58,8 +57,8 @@ export class ServerTreeDataSource implements IDataSource {
|
||||
/**
|
||||
* Returns the element's children as an array in a promise.
|
||||
*/
|
||||
public getChildren(tree: ITree, element: any): TPromise<any> {
|
||||
return new TPromise<any>((resolve) => {
|
||||
public getChildren(tree: ITree, element: any): Promise<any> {
|
||||
return new Promise<any>((resolve) => {
|
||||
if (element instanceof ConnectionProfile) {
|
||||
TreeUpdateUtils.getObjectExplorerNode(<ConnectionProfile>element, this._connectionManagementService, this._objectExplorerService).then(nodes => {
|
||||
resolve(nodes);
|
||||
@@ -93,15 +92,15 @@ export class ServerTreeDataSource implements IDataSource {
|
||||
/**
|
||||
* Returns the element's parent in a promise.
|
||||
*/
|
||||
public getParent(tree: ITree, element: any): TPromise<any> {
|
||||
public getParent(tree: ITree, element: any): Promise<any> {
|
||||
if (element instanceof ConnectionProfile) {
|
||||
return TPromise.as(element.getParent());
|
||||
return Promise.resolve(element.getParent());
|
||||
} else if (element instanceof ConnectionProfileGroup) {
|
||||
return TPromise.as(element.getParent());
|
||||
return Promise.resolve(element.getParent());
|
||||
} else if (element instanceof TreeNode) {
|
||||
return TPromise.as(TreeUpdateUtils.getObjectExplorerParent(element, this._connectionManagementService));
|
||||
return Promise.resolve(TreeUpdateUtils.getObjectExplorerParent(element, this._connectionManagementService));
|
||||
} else {
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ export class ServerTreeView {
|
||||
return uri && uri.startsWith(ConnectionUtils.uriPrefixes.default) && !isBackupRestoreUri;
|
||||
}
|
||||
|
||||
private handleAddConnectionProfile(newProfile: IConnectionProfile) {
|
||||
private async handleAddConnectionProfile(newProfile: IConnectionProfile): Promise<void> {
|
||||
if (newProfile) {
|
||||
let groups = this._connectionManagementService.getConnectionGroups();
|
||||
let profile = ConnectionUtils.findProfileInGroup(newProfile, groups);
|
||||
@@ -191,7 +191,7 @@ export class ServerTreeView {
|
||||
if (newProfile && currentSelectedElement && !newProfileIsSelected) {
|
||||
this._tree.clearSelection();
|
||||
}
|
||||
this.refreshTree();
|
||||
await this.refreshTree();
|
||||
if (newProfile && !newProfileIsSelected) {
|
||||
this._tree.reveal(newProfile);
|
||||
this._tree.select(newProfile);
|
||||
@@ -256,10 +256,10 @@ export class ServerTreeView {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public refreshTree(): void {
|
||||
public refreshTree(): Promise<void> {
|
||||
this.messages.hide();
|
||||
this.clearOtherActions();
|
||||
TreeUpdateUtils.registeredServerUpdate(this._tree, this._connectionManagementService);
|
||||
return TreeUpdateUtils.registeredServerUpdate(this._tree, this._connectionManagementService);
|
||||
}
|
||||
|
||||
public refreshElement(element: any): Thenable<void> {
|
||||
|
||||
@@ -10,7 +10,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
|
||||
import { NodeType } from 'sql/parts/objectExplorer/common/nodeType';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { TreeNode } from 'sql/parts/objectExplorer/common/treeNode';
|
||||
import errors = require('vs/base/common/errors');
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
@@ -22,7 +21,7 @@ export class TreeUpdateUtils {
|
||||
/**
|
||||
* Set input for the tree.
|
||||
*/
|
||||
public static structuralTreeUpdate(tree: ITree, viewKey: string, connectionManagementService: IConnectionManagementService, providers?: string[]): Thenable<void> {
|
||||
public static structuralTreeUpdate(tree: ITree, viewKey: string, connectionManagementService: IConnectionManagementService, providers?: string[]): Promise<void> {
|
||||
let selectedElement: any;
|
||||
let targetsToExpand: any[];
|
||||
if (tree) {
|
||||
@@ -59,7 +58,7 @@ export class TreeUpdateUtils {
|
||||
/**
|
||||
* Set input for the registered servers tree.
|
||||
*/
|
||||
public static registeredServerUpdate(tree: ITree, connectionManagementService: IConnectionManagementService, elementToSelect?: any): void {
|
||||
public static registeredServerUpdate(tree: ITree, connectionManagementService: IConnectionManagementService, elementToSelect?: any): Promise<void> {
|
||||
let selectedElement: any = elementToSelect;
|
||||
let targetsToExpand: any[];
|
||||
|
||||
@@ -82,7 +81,7 @@ export class TreeUpdateUtils {
|
||||
let treeInput = TreeUpdateUtils.getTreeInput(connectionManagementService);
|
||||
if (treeInput) {
|
||||
if (treeInput !== tree.getInput()) {
|
||||
tree.setInput(treeInput).then(() => {
|
||||
return tree.setInput(treeInput).then(() => {
|
||||
// Make sure to expand all folders that where expanded in the previous session
|
||||
if (targetsToExpand) {
|
||||
tree.expandAll(targetsToExpand);
|
||||
@@ -94,6 +93,7 @@ export class TreeUpdateUtils {
|
||||
}, errors.onUnexpectedError);
|
||||
}
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public static getTreeInput(connectionManagementService: IConnectionManagementService, providers?: string[]): ConnectionProfileGroup {
|
||||
@@ -117,8 +117,8 @@ export class TreeUpdateUtils {
|
||||
connection: IConnectionProfile,
|
||||
options: IConnectionCompletionOptions,
|
||||
connectionManagementService: IConnectionManagementService,
|
||||
tree: ITree): TPromise<ConnectionProfile> {
|
||||
return new TPromise<ConnectionProfile>((resolve, reject) => {
|
||||
tree: ITree): Promise<ConnectionProfile> {
|
||||
return new Promise<ConnectionProfile>((resolve, reject) => {
|
||||
if (!connectionManagementService.isProfileConnected(connection)) {
|
||||
// don't try to reconnect if currently connecting
|
||||
if (connectionManagementService.isProfileConnecting(connection)) {
|
||||
@@ -176,8 +176,8 @@ export class TreeUpdateUtils {
|
||||
* @param objectExplorerService Object explorer service instance
|
||||
*/
|
||||
public static connectAndCreateOeSession(connection: IConnectionProfile, options: IConnectionCompletionOptions,
|
||||
connectionManagementService: IConnectionManagementService, objectExplorerService: IObjectExplorerService, tree: ITree): TPromise<boolean> {
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
connectionManagementService: IConnectionManagementService, objectExplorerService: IObjectExplorerService, tree: ITree): Promise<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
TreeUpdateUtils.connectIfNotConnected(connection, options, connectionManagementService, tree).then(connectedConnection => {
|
||||
if (connectedConnection) {
|
||||
// append group ID and original display name to build unique OE session ID
|
||||
@@ -205,8 +205,8 @@ export class TreeUpdateUtils {
|
||||
});
|
||||
}
|
||||
|
||||
public static getObjectExplorerNode(connection: ConnectionProfile, connectionManagementService: IConnectionManagementService, objectExplorerService: IObjectExplorerService): TPromise<TreeNode[]> {
|
||||
return new TPromise<TreeNode[]>((resolve, reject) => {
|
||||
public static getObjectExplorerNode(connection: ConnectionProfile, connectionManagementService: IConnectionManagementService, objectExplorerService: IObjectExplorerService): Promise<TreeNode[]> {
|
||||
return new Promise<TreeNode[]>((resolve, reject) => {
|
||||
if (connection.isDisconnecting) {
|
||||
resolve([]);
|
||||
} else {
|
||||
|
||||
@@ -9,7 +9,6 @@ import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiati
|
||||
import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { ProfilerInput } from 'sql/parts/profiler/editor/profilerInput';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
import { IProfilerService } from 'sql/workbench/services/profiler/common/interfaces';
|
||||
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
@@ -60,7 +59,7 @@ CommandsRegistry.registerCommand({
|
||||
|
||||
if (connectionProfile && connectionProfile.providerName === mssqlProviderName) {
|
||||
let profilerInput = instantiationService.createInstance(ProfilerInput, connectionProfile);
|
||||
editorService.openEditor(profilerInput, { pinned: true }, ACTIVE_GROUP).then(() => TPromise.as(true));
|
||||
editorService.openEditor(profilerInput, { pinned: true }, ACTIVE_GROUP).then(() => Promise.resolve(true));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -96,6 +95,6 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
return profilerService.startSession(profilerInput.id, profilerInput.sessionName);
|
||||
}
|
||||
}
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
|
||||
import { IConnectionManagementService, IConnectionCompletionOptions } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IEditorAction } from 'vs/editor/common/editorCommon';
|
||||
@@ -38,17 +37,17 @@ export class ProfilerConnect extends Action {
|
||||
super(id, label, 'connect');
|
||||
}
|
||||
|
||||
public run(input: ProfilerInput): TPromise<boolean> {
|
||||
public run(input: ProfilerInput): Promise<boolean> {
|
||||
this.enabled = false;
|
||||
if (!this._connected) {
|
||||
return TPromise.wrap(this._profilerService.connectSession(input.id).then(() => {
|
||||
return Promise.resolve(this._profilerService.connectSession(input.id).then(() => {
|
||||
this.enabled = true;
|
||||
this.connected = true;
|
||||
input.state.change({ isConnected: true, isRunning: false, isPaused: false, isStopped: true });
|
||||
return true;
|
||||
}));
|
||||
} else {
|
||||
return TPromise.wrap(this._profilerService.disconnectSession(input.id).then(() => {
|
||||
return Promise.resolve(this._profilerService.disconnectSession(input.id).then(() => {
|
||||
this.enabled = true;
|
||||
this.connected = false;
|
||||
input.state.change({ isConnected: false, isRunning: false, isPaused: false, isStopped: false });
|
||||
@@ -79,9 +78,9 @@ export class ProfilerStart extends Action {
|
||||
super(id, label, 'sql start');
|
||||
}
|
||||
|
||||
public run(input: ProfilerInput): TPromise<boolean> {
|
||||
public run(input: ProfilerInput): Promise<boolean> {
|
||||
input.data.clear();
|
||||
return TPromise.wrap(this._profilerService.startSession(input.id, input.sessionName));
|
||||
return Promise.resolve(this._profilerService.startSession(input.id, input.sessionName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,8 +97,8 @@ export class ProfilerCreate extends Action {
|
||||
super(id, label, 'add');
|
||||
}
|
||||
|
||||
public run(input: ProfilerInput): TPromise<boolean> {
|
||||
return TPromise.wrap(this._profilerService.launchCreateSessionDialog(input).then(() => {
|
||||
public run(input: ProfilerInput): Promise<boolean> {
|
||||
return Promise.resolve(this._profilerService.launchCreateSessionDialog(input).then(() => {
|
||||
return true;
|
||||
}));
|
||||
}
|
||||
@@ -123,8 +122,8 @@ export class ProfilerPause extends Action {
|
||||
super(id, label, ProfilerPause.PauseCssClass);
|
||||
}
|
||||
|
||||
public run(input: ProfilerInput): TPromise<boolean> {
|
||||
return TPromise.wrap(this._profilerService.pauseSession(input.id).then(() => {
|
||||
public run(input: ProfilerInput): Promise<boolean> {
|
||||
return Promise.resolve(this._profilerService.pauseSession(input.id).then(() => {
|
||||
this.paused = !this._paused;
|
||||
input.state.change({ isPaused: this.paused, isStopped: false, isRunning: !this.paused });
|
||||
return true;
|
||||
@@ -153,8 +152,8 @@ export class ProfilerStop extends Action {
|
||||
super(id, label, 'sql stop');
|
||||
}
|
||||
|
||||
public run(input: ProfilerInput): TPromise<boolean> {
|
||||
return TPromise.wrap(this._profilerService.stopSession(input.id));
|
||||
public run(input: ProfilerInput): Promise<boolean> {
|
||||
return Promise.resolve(this._profilerService.stopSession(input.id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,9 +165,9 @@ export class ProfilerClear extends Action {
|
||||
super(id, label, 'clear-results');
|
||||
}
|
||||
|
||||
run(input: ProfilerInput): TPromise<void> {
|
||||
run(input: ProfilerInput): Promise<void> {
|
||||
input.data.clear();
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,12 +183,12 @@ export class ProfilerAutoScroll extends Action {
|
||||
super(id, label, ProfilerAutoScroll.CheckedCssClass);
|
||||
}
|
||||
|
||||
run(input: ProfilerInput): TPromise<boolean> {
|
||||
run(input: ProfilerInput): Promise<boolean> {
|
||||
this.checked = !this.checked;
|
||||
this._setLabel(this.checked ? ProfilerAutoScroll.AutoScrollOnText : ProfilerAutoScroll.AutoScrollOffText);
|
||||
this._setClass(this.checked ? ProfilerAutoScroll.CheckedCssClass : '');
|
||||
input.state.change({ autoscroll: this.checked });
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,10 +202,10 @@ export class ProfilerCollapsablePanelAction extends Action {
|
||||
super(id, label, 'minimize-panel-action');
|
||||
}
|
||||
|
||||
public run(input: ProfilerInput): TPromise<boolean> {
|
||||
public run(input: ProfilerInput): Promise<boolean> {
|
||||
this.collapsed = !this._collapsed;
|
||||
input.state.change({ isPanelCollapsed: this._collapsed });
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
set collapsed(val: boolean) {
|
||||
@@ -226,8 +225,8 @@ export class ProfilerEditColumns extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(input: ProfilerInput): TPromise<boolean> {
|
||||
return TPromise.wrap(this._profilerService.launchColumnEditor(input)).then(() => true);
|
||||
public run(input: ProfilerInput): Promise<boolean> {
|
||||
return Promise.resolve(this._profilerService.launchColumnEditor(input)).then(() => true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +280,7 @@ export class NewProfilerAction extends Task {
|
||||
});
|
||||
}
|
||||
|
||||
public runTask(accessor: ServicesAccessor, profile: IConnectionProfile): TPromise<void> {
|
||||
public runTask(accessor: ServicesAccessor, profile: IConnectionProfile): Promise<void> {
|
||||
let profilerInput = accessor.get<IInstantiationService>(IInstantiationService).createInstance(ProfilerInput, profile);
|
||||
return accessor.get<IEditorService>(IEditorService).openEditor(profilerInput, { pinned: true }, ACTIVE_GROUP).then(() => {
|
||||
let options: IConnectionCompletionOptions = {
|
||||
@@ -293,7 +292,7 @@ export class NewProfilerAction extends Task {
|
||||
};
|
||||
accessor.get<IConnectionManagementService>(IConnectionManagementService).connect(this._connectionProfile, profilerInput.id, options);
|
||||
|
||||
return TPromise.as(void 0);
|
||||
return Promise.resolve(void 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -309,9 +308,9 @@ export class ProfilerFilterSession extends Action {
|
||||
super(id, label, 'filterLabel');
|
||||
}
|
||||
|
||||
public run(input: ProfilerInput): TPromise<boolean> {
|
||||
public run(input: ProfilerInput): Promise<boolean> {
|
||||
this._profilerService.launchFilterSessionDialog(input);
|
||||
return TPromise.wrap(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,8 +324,8 @@ export class ProfilerClearSessionFilter extends Action {
|
||||
super(id, label, 'clear-filter');
|
||||
}
|
||||
|
||||
public run(input: ProfilerInput): TPromise<boolean> {
|
||||
public run(input: ProfilerInput): Promise<boolean> {
|
||||
input.clearFilter();
|
||||
return TPromise.wrap(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { IDataSource, ITree, IRenderer } from 'vs/base/parts/tree/browser/tree';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -272,25 +271,25 @@ class TreeDataSource implements IDataSource {
|
||||
}
|
||||
}
|
||||
|
||||
getChildren(tree: ITree, element: any): TPromise<Array<any>> {
|
||||
getChildren(tree: ITree, element: any): Promise<Array<any>> {
|
||||
if (element instanceof EventItem) {
|
||||
return TPromise.as(element.getChildren());
|
||||
return Promise.resolve(element.getChildren());
|
||||
} else if (element instanceof SessionItem) {
|
||||
return TPromise.as(element.getChildren());
|
||||
return Promise.resolve(element.getChildren());
|
||||
} else {
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
getParent(tree: ITree, element: any): TPromise<any> {
|
||||
getParent(tree: ITree, element: any): Promise<any> {
|
||||
if (element instanceof ColumnItem) {
|
||||
return TPromise.as(element.parent);
|
||||
return Promise.resolve(element.parent);
|
||||
} else if (element instanceof EventItem) {
|
||||
return TPromise.as(element.parent);
|
||||
return Promise.resolve(element.parent);
|
||||
} else if (element instanceof ColumnSortedColumnItem) {
|
||||
return TPromise.as(element.parent);
|
||||
return Promise.resolve(element.parent);
|
||||
} else {
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,8 +303,8 @@ export class ProfilerColumnEditorDialog extends Modal {
|
||||
private _selectBox: SelectBox;
|
||||
private _selectedValue: number = 0;
|
||||
private readonly _options = [
|
||||
nls.localize('eventSort', "Sort by event"),
|
||||
nls.localize('nameColumn', "Sort by column")
|
||||
{ text: nls.localize('eventSort', "Sort by event") },
|
||||
{ text: nls.localize('nameColumn', "Sort by column") }
|
||||
];
|
||||
private _tree: Tree;
|
||||
private _input: ProfilerInput;
|
||||
|
||||
@@ -12,7 +12,6 @@ import { IProfilerStateChangedEvent } from 'sql/parts/profiler/editor/profilerSt
|
||||
import { FindWidget, ITableController, IConfigurationChangedEvent, ACTION_IDS } from './profilerFindWidget';
|
||||
import { ProfilerFindNext, ProfilerFindPrevious } from 'sql/parts/profiler/contrib/profilerActions';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
@@ -106,7 +105,7 @@ export class ProfilerTableEditor extends BaseEditor implements IProfilerControll
|
||||
);
|
||||
}
|
||||
|
||||
public setInput(input: ProfilerInput): TPromise<void> {
|
||||
public setInput(input: ProfilerInput): Promise<void> {
|
||||
this._showStatusBarItem = true;
|
||||
this._input = input;
|
||||
|
||||
@@ -153,7 +152,7 @@ export class ProfilerTableEditor extends BaseEditor implements IProfilerControll
|
||||
this._input.onDispose(() => {
|
||||
this._disposeStatusbarItem();
|
||||
});
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public toggleSearch(): void {
|
||||
|
||||
@@ -41,7 +41,6 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IView, SplitView, Sizing } from 'vs/base/browser/ui/splitview/splitview';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWorkbenchThemeService, VS_DARK_THEME, VS_HC_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
@@ -92,7 +91,7 @@ class BasicView implements IView {
|
||||
this.previousSize = this.size;
|
||||
this._minimumSize = this.options.headersize;
|
||||
this._maximumSize = this.options.headersize;
|
||||
this._onDidChange.fire();
|
||||
this._onDidChange.fire(undefined);
|
||||
} else {
|
||||
this._maximumSize = this._defaultMaximumSize;
|
||||
this._minimumSize = this._defaultMinimumSize;
|
||||
@@ -407,7 +406,7 @@ export class ProfilerEditor extends BaseEditor {
|
||||
return this._input as ProfilerInput;
|
||||
}
|
||||
|
||||
public setInput(input: ProfilerInput, options?: EditorOptions): Thenable<void> {
|
||||
public setInput(input: ProfilerInput, options?: EditorOptions): Promise<void> {
|
||||
let savedViewState = this._savedTableViewStates.get(input);
|
||||
|
||||
this._profilerEditorContextKey.set(true);
|
||||
@@ -415,7 +414,7 @@ export class ProfilerEditor extends BaseEditor {
|
||||
if (savedViewState) {
|
||||
this._profilerTableEditor.restoreViewState(savedViewState);
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
return super.setInput(input, options, CancellationToken.None).then(() => {
|
||||
|
||||
@@ -11,7 +11,6 @@ import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorInput, ConfirmResult } from 'vs/workbench/common/editor';
|
||||
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -124,7 +123,7 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
|
||||
return ProfilerInput.ID;
|
||||
}
|
||||
|
||||
public resolve(refresh?: boolean): TPromise<IEditorModel> {
|
||||
public resolve(refresh?: boolean): Promise<IEditorModel> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -284,7 +283,7 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
|
||||
this.data.clearFilter();
|
||||
}
|
||||
|
||||
confirmSave(): TPromise<ConfirmResult> {
|
||||
confirmSave(): Promise<ConfirmResult> {
|
||||
if (this.state.isRunning || this.state.isPaused) {
|
||||
return this._dialogService.show(Severity.Warning,
|
||||
nls.localize('confirmStopProfilerSession', "Would you like to stop the running XEvent session?"),
|
||||
@@ -303,7 +302,7 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return TPromise.wrap(ConfirmResult.DONT_SAVE);
|
||||
return Promise.resolve(ConfirmResult.DONT_SAVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
|
||||
@@ -17,12 +16,9 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { IEditorContributionCtor } from 'vs/editor/browser/editorExtensions';
|
||||
import { FoldingController } from 'vs/editor/contrib/folding/folding';
|
||||
import { StandaloneCodeEditor } from 'vs/editor/standalone/browser/standaloneCodeEditor';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
@@ -83,7 +79,7 @@ export class ProfilerResourceEditor extends BaseTextEditor {
|
||||
return options;
|
||||
}
|
||||
|
||||
setInput(input: UntitledEditorInput, options: EditorOptions): Thenable<void> {
|
||||
setInput(input: UntitledEditorInput, options: EditorOptions): Promise<void> {
|
||||
return super.setInput(input, options, CancellationToken.None)
|
||||
.then(() => this.input.resolve()
|
||||
.then(editorModel => editorModel.load())
|
||||
|
||||
@@ -13,7 +13,6 @@ import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorG
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import errors = require('vs/base/common/errors');
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { getCodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import nls = require('vs/nls');
|
||||
|
||||
@@ -180,7 +179,7 @@ export class ChangeFlavorAction extends Action {
|
||||
super(actionId, actionLabel);
|
||||
}
|
||||
|
||||
public run(): TPromise<any> {
|
||||
public run(): Promise<any> {
|
||||
let activeEditor = this._editorService.activeControl;
|
||||
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
|
||||
if (this._connectionManagementService.isConnected(currentUri)) {
|
||||
@@ -213,12 +212,12 @@ export class ChangeFlavorAction extends Action {
|
||||
});
|
||||
}
|
||||
|
||||
private _showMessage(sev: Severity, message: string): TPromise<any> {
|
||||
private _showMessage(sev: Severity, message: string): Promise<any> {
|
||||
this._notificationService.notify({
|
||||
severity: sev,
|
||||
message: message
|
||||
});
|
||||
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
@@ -148,7 +147,7 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
|
||||
public getDescription(): string { return this._description; }
|
||||
public supportsSplitEditor(): boolean { return false; }
|
||||
public getModeId(): string { return QueryInput.SCHEMA; }
|
||||
public revert(): TPromise<boolean> { return this._sql.revert(); }
|
||||
public revert(): Promise<boolean> { return this._sql.revert(); }
|
||||
|
||||
public matches(otherInput: any): boolean {
|
||||
if (otherInput instanceof QueryInput) {
|
||||
@@ -161,10 +160,10 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
|
||||
// Forwarding resource functions to the inline sql file editor
|
||||
public get onDidModelChangeContent(): Event<void> { return this._sql.onDidModelChangeContent; }
|
||||
public get onDidModelChangeEncoding(): Event<void> { return this._sql.onDidModelChangeEncoding; }
|
||||
public resolve(refresh?: boolean): TPromise<EditorModel> { return this._sql.resolve(); }
|
||||
public save(): TPromise<boolean> { return this._sql.save(); }
|
||||
public resolve(refresh?: boolean): Promise<EditorModel> { return this._sql.resolve(); }
|
||||
public save(): Promise<boolean> { return this._sql.save(); }
|
||||
public isDirty(): boolean { return this._sql.isDirty(); }
|
||||
public confirmSave(): TPromise<ConfirmResult> { return this._sql.confirmSave(); }
|
||||
public confirmSave(): Promise<ConfirmResult> { return this._sql.confirmSave(); }
|
||||
public getResource(): URI { return this._sql.getResource(); }
|
||||
public getEncoding(): string { return this._sql.getEncoding(); }
|
||||
public suggestFileName(): string { return this._sql.suggestFileName(); }
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
'use strict';
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
@@ -95,8 +94,8 @@ export class QueryResultsInput extends EditorInput {
|
||||
return false;
|
||||
}
|
||||
|
||||
resolve(refresh?: boolean): TPromise<any> {
|
||||
return TPromise.as(null);
|
||||
resolve(refresh?: boolean): Promise<any> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
supportsSplitEditor(): boolean {
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -74,14 +73,14 @@ export class SaveResultAction extends Action {
|
||||
super(id, label, icon);
|
||||
}
|
||||
|
||||
public run(context: IGridActionContext): TPromise<boolean> {
|
||||
public run(context: IGridActionContext): Promise<boolean> {
|
||||
if (this.accountForNumberColumn) {
|
||||
context.runner.serializeResults(context.batchId, context.resultId, this.format,
|
||||
mapForNumberColumn(context.selection));
|
||||
} else {
|
||||
context.runner.serializeResults(context.batchId, context.resultId, this.format, context.selection);
|
||||
}
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +100,7 @@ export class CopyResultAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(context: IGridActionContext): TPromise<boolean> {
|
||||
public run(context: IGridActionContext): Promise<boolean> {
|
||||
if (this.accountForNumberColumn) {
|
||||
context.runner.copyResults(
|
||||
mapForNumberColumn(context.selection),
|
||||
@@ -109,7 +108,7 @@ export class CopyResultAction extends Action {
|
||||
} else {
|
||||
context.runner.copyResults(context.selection, context.batchId, context.resultId, this.copyHeader);
|
||||
}
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,9 +120,9 @@ export class SelectAllGridAction extends Action {
|
||||
super(SelectAllGridAction.ID, SelectAllGridAction.LABEL);
|
||||
}
|
||||
|
||||
public run(context: IGridActionContext): TPromise<boolean> {
|
||||
public run(context: IGridActionContext): Promise<boolean> {
|
||||
context.selectionModel.setSelectedRanges([new Slick.Range(0, 0, context.table.getData().getLength() - 1, context.table.columns.length - 1)]);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,9 +137,9 @@ export class CopyMessagesAction extends Action {
|
||||
super(CopyMessagesAction.ID, CopyMessagesAction.LABEL);
|
||||
}
|
||||
|
||||
public run(context: IMessagesActionContext): TPromise<boolean> {
|
||||
public run(context: IMessagesActionContext): Promise<boolean> {
|
||||
this.clipboardService.writeText(context.selection.toString());
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +155,7 @@ export class CopyAllMessagesAction extends Action {
|
||||
super(CopyAllMessagesAction.ID, CopyAllMessagesAction.LABEL);
|
||||
}
|
||||
|
||||
public run(): TPromise<any> {
|
||||
public run(): Promise<any> {
|
||||
let text = '';
|
||||
const navigator = this.tree.getNavigator();
|
||||
// skip first navigator element - the root node
|
||||
@@ -168,7 +167,7 @@ export class CopyAllMessagesAction extends Action {
|
||||
}
|
||||
|
||||
this.clipboardService.writeText(removeAnsiEscapeCodes(text));
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,9 +180,9 @@ export class MaximizeTableAction extends Action {
|
||||
super(MaximizeTableAction.ID, MaximizeTableAction.LABEL, MaximizeTableAction.ICON);
|
||||
}
|
||||
|
||||
public run(context: IGridActionContext): TPromise<boolean> {
|
||||
public run(context: IGridActionContext): Promise<boolean> {
|
||||
context.tableState.maximized = true;
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,9 +195,9 @@ export class RestoreTableAction extends Action {
|
||||
super(RestoreTableAction.ID, RestoreTableAction.LABEL, RestoreTableAction.ICON);
|
||||
}
|
||||
|
||||
public run(context: IGridActionContext): TPromise<boolean> {
|
||||
public run(context: IGridActionContext): Promise<boolean> {
|
||||
context.tableState.maximized = false;
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,13 +210,13 @@ export class ChartDataAction extends Action {
|
||||
super(ChartDataAction.ID, ChartDataAction.LABEL, ChartDataAction.ICON);
|
||||
}
|
||||
|
||||
public run(context: IGridActionContext): TPromise<boolean> {
|
||||
public run(context: IGridActionContext): Promise<boolean> {
|
||||
let activeEditor = this.editorService.activeControl;
|
||||
if (activeEditor instanceof QueryEditor) {
|
||||
activeEditor.resultsEditor.chart({ batchId: context.batchId, resultId: context.resultId });
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
} else {
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,13 +231,13 @@ export class ShowQueryPlanAction extends Action {
|
||||
super(ShowQueryPlanAction.ID, ShowQueryPlanAction.LABEL);
|
||||
}
|
||||
|
||||
public run(xml: string): TPromise<boolean> {
|
||||
public run(xml: string): Promise<boolean> {
|
||||
let activeEditor = this.editorService.activeControl;
|
||||
if (activeEditor instanceof QueryEditor) {
|
||||
activeEditor.resultsEditor.showQueryPlan(xml);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
} else {
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import { resolveCurrentDirectory, getRootPath } from 'sql/platform/node/pathUtil
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { join, normalize } from 'vs/base/common/paths';
|
||||
import { writeFile } from 'vs/base/node/pfs';
|
||||
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
|
||||
@@ -42,11 +41,11 @@ export class CreateInsightAction extends Action {
|
||||
super(CreateInsightAction.ID, CreateInsightAction.LABEL, CreateInsightAction.ICON);
|
||||
}
|
||||
|
||||
public run(context: IChartActionContext): TPromise<boolean> {
|
||||
public run(context: IChartActionContext): Promise<boolean> {
|
||||
let uriString: string = this.getActiveUriString();
|
||||
if (!uriString) {
|
||||
this.showError(localize('createInsightNoEditor', 'Cannot create insight as the active editor is not a SQL Editor'));
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
let uri: URI = URI.parse(uriString);
|
||||
@@ -118,18 +117,18 @@ export class CopyAction extends Action {
|
||||
super(CopyAction.ID, CopyAction.LABEL, CopyAction.ICON);
|
||||
}
|
||||
|
||||
public run(context: IChartActionContext): TPromise<boolean> {
|
||||
public run(context: IChartActionContext): Promise<boolean> {
|
||||
if (context.insight instanceof Graph) {
|
||||
let data = context.insight.getCanvasData();
|
||||
if (!data) {
|
||||
this.showError(localize('chartNotFound', 'Could not find chart to save'));
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
this.clipboardService.writeImageDataUrl(data);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
private showError(errorMsg: string) {
|
||||
@@ -155,7 +154,7 @@ export class SaveImageAction extends Action {
|
||||
super(SaveImageAction.ID, SaveImageAction.LABEL, SaveImageAction.ICON);
|
||||
}
|
||||
|
||||
public run(context: IChartActionContext): TPromise<boolean> {
|
||||
public run(context: IChartActionContext): Promise<boolean> {
|
||||
if (context.insight instanceof Graph) {
|
||||
return this.promptForFilepath().then(filePath => {
|
||||
let data = (<Graph>context.insight).getCanvasData();
|
||||
@@ -181,7 +180,7 @@ export class SaveImageAction extends Action {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
return TPromise.as(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
private decodeBase64Image(data: string): Buffer {
|
||||
@@ -189,7 +188,7 @@ export class SaveImageAction extends Action {
|
||||
return Buffer.from(matches[2], 'base64');
|
||||
}
|
||||
|
||||
private promptForFilepath(): TPromise<string> {
|
||||
private promptForFilepath(): Promise<string> {
|
||||
let filepathPlaceHolder = resolveCurrentDirectory(this.getActiveUriString(), getRootPath(this.workspaceContextService));
|
||||
filepathPlaceHolder = join(filepathPlaceHolder, 'chart.png');
|
||||
return this.windowService.showSaveDialog({
|
||||
|
||||
@@ -38,7 +38,6 @@ import { range } from 'vs/base/common/arrays';
|
||||
import { Orientation, Sizing } from 'vs/base/browser/ui/splitview/splitview';
|
||||
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Separator, ActionBar, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { isInDOM } from 'vs/base/browser/dom';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -467,7 +466,7 @@ class GridTable<T> extends Disposable implements IView {
|
||||
50,
|
||||
index => this.placeholdGenerator(index),
|
||||
0,
|
||||
() => TPromise.as([])
|
||||
() => Promise.resolve([])
|
||||
);
|
||||
this.dataProvider.dataRows = collection;
|
||||
this.table.updateRowCount();
|
||||
@@ -486,7 +485,7 @@ class GridTable<T> extends Disposable implements IView {
|
||||
50,
|
||||
index => this.placeholdGenerator(index),
|
||||
0,
|
||||
() => TPromise.as([])
|
||||
() => Promise.resolve([])
|
||||
);
|
||||
collection.setCollectionChangedCallback((startIndex, count) => {
|
||||
this.renderGridDataRowsRange(startIndex, count);
|
||||
@@ -652,7 +651,7 @@ class GridTable<T> extends Disposable implements IView {
|
||||
this.dataProvider.length = resultSet.rowCount;
|
||||
this.table.updateRowCount();
|
||||
}
|
||||
this._onDidChange.fire();
|
||||
this._onDidChange.fire(undefined);
|
||||
}
|
||||
|
||||
private generateContext(cell?: Slick.Cell): IGridActionContext {
|
||||
|
||||
@@ -14,7 +14,6 @@ import { IResultMessage, ISelectionData } from 'azdata';
|
||||
|
||||
import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
|
||||
import { IDataSource, ITree, IRenderer, ContextMenuEvent } from 'vs/base/parts/tree/browser/tree';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
@@ -281,20 +280,20 @@ class MessageDataSource implements IDataSource {
|
||||
return element instanceof Model;
|
||||
}
|
||||
|
||||
getChildren(tree: ITree, element: any): TPromise {
|
||||
getChildren(tree: ITree, element: any): Promise<(IMessagePanelMessage | IMessagePanelBatchMessage)[]> {
|
||||
if (element instanceof Model) {
|
||||
let messages = element.messages;
|
||||
if (element.totalExecuteMessage) {
|
||||
messages = messages.concat(element.totalExecuteMessage);
|
||||
}
|
||||
return TPromise.as(messages);
|
||||
return Promise.resolve(messages);
|
||||
} else {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
getParent(tree: ITree, element: any): TPromise {
|
||||
return TPromise.as(null);
|
||||
getParent(tree: ITree, element: any): Promise<void> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!sql/parts/query/editor/media/queryEditor';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as types from 'vs/base/common/types';
|
||||
@@ -160,11 +159,11 @@ export class QueryEditor extends BaseEditor {
|
||||
/**
|
||||
* Sets the input data for this editor.
|
||||
*/
|
||||
public setInput(newInput: QueryInput, options?: EditorOptions): Thenable<void> {
|
||||
public setInput(newInput: QueryInput, options?: EditorOptions): Promise<void> {
|
||||
const oldInput = <QueryInput>this.input;
|
||||
|
||||
if (newInput.matches(oldInput)) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
// Make sure all event callbacks will be sent to this QueryEditor in the case that this QueryInput was moved from
|
||||
@@ -538,7 +537,7 @@ export class QueryEditor extends BaseEditor {
|
||||
/**
|
||||
* Handles setting input for this editor.
|
||||
*/
|
||||
private _updateInput(oldInput: QueryInput, newInput: QueryInput, options?: EditorOptions): TPromise<void> {
|
||||
private _updateInput(oldInput: QueryInput, newInput: QueryInput, options?: EditorOptions): Promise<void> {
|
||||
if (this._sqlEditor) {
|
||||
this._sqlEditor.clearInput();
|
||||
}
|
||||
@@ -576,22 +575,22 @@ export class QueryEditor extends BaseEditor {
|
||||
* This will create only the SQL editor if the results editor does not yet exist for the
|
||||
* given QueryInput.
|
||||
*/
|
||||
private _setNewInput(newInput: QueryInput, options?: EditorOptions): TPromise<any> {
|
||||
private _setNewInput(newInput: QueryInput, options?: EditorOptions): Promise<any> {
|
||||
|
||||
// Promises that will ensure proper ordering of editor creation logic
|
||||
let createEditors: () => TPromise<any>;
|
||||
let onEditorsCreated: (result) => TPromise<any>;
|
||||
let createEditors: () => Promise<any>;
|
||||
let onEditorsCreated: (result) => Promise<any>;
|
||||
|
||||
// If both editors exist, create joined promises - one for each editor
|
||||
if (this._isResultsEditorVisible()) {
|
||||
createEditors = () => {
|
||||
return TPromise.join([
|
||||
return Promise.all([
|
||||
this._createEditor(<QueryResultsInput>newInput.results, this._resultsEditorContainer, this.group),
|
||||
this._createEditor(<UntitledEditorInput>newInput.sql, this._sqlEditorContainer, this.group)
|
||||
]);
|
||||
};
|
||||
onEditorsCreated = (result: IEditor[]) => {
|
||||
return TPromise.join([
|
||||
return Promise.all([
|
||||
this._onResultsEditorCreated(<QueryResultsEditor>result[0], newInput.results, options),
|
||||
this._onSqlEditorCreated(<TextResourceEditor>result[1], newInput.sql, options)
|
||||
]);
|
||||
@@ -603,16 +602,16 @@ export class QueryEditor extends BaseEditor {
|
||||
return this._createEditor(<UntitledEditorInput>newInput.sql, this._sqlEditorContainer, this.group);
|
||||
};
|
||||
onEditorsCreated = (result: TextResourceEditor) => {
|
||||
return TPromise.join([
|
||||
return Promise.all([
|
||||
this._onSqlEditorCreated(result, newInput.sql, options)
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
||||
// Create a promise to re render the layout after the editor creation logic
|
||||
let doLayout: () => TPromise<any> = () => {
|
||||
let doLayout: () => Promise<any> = () => {
|
||||
this._doLayout();
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
};
|
||||
|
||||
// Run all three steps synchronously
|
||||
@@ -632,16 +631,16 @@ export class QueryEditor extends BaseEditor {
|
||||
/**
|
||||
* Create a single editor based on the type of the given EditorInput.
|
||||
*/
|
||||
private _createEditor(editorInput: EditorInput, container: HTMLElement, group: IEditorGroup): TPromise<BaseEditor> {
|
||||
private _createEditor(editorInput: EditorInput, container: HTMLElement, group: IEditorGroup): Promise<BaseEditor> {
|
||||
const descriptor = this._editorDescriptorService.getEditor(editorInput);
|
||||
if (!descriptor) {
|
||||
return TPromise.wrapError(new Error(strings.format('Can not find a registered editor for the input {0}', editorInput)));
|
||||
return Promise.reject(new Error(strings.format('Can not find a registered editor for the input {0}', editorInput)));
|
||||
}
|
||||
|
||||
let editor = descriptor.instantiate(this._instantiationService);
|
||||
editor.create(container);
|
||||
editor.setVisible(this.isVisible(), group);
|
||||
return TPromise.as(editor);
|
||||
return Promise.resolve(editor);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -655,7 +654,7 @@ export class QueryEditor extends BaseEditor {
|
||||
/**
|
||||
* Sets input for the results editor after it has been created.
|
||||
*/
|
||||
private _onResultsEditorCreated(resultsEditor: QueryResultsEditor, resultsInput: QueryResultsInput, options: EditorOptions): TPromise<void> {
|
||||
private _onResultsEditorCreated(resultsEditor: QueryResultsEditor, resultsInput: QueryResultsInput, options: EditorOptions): Promise<void> {
|
||||
this._resultsEditor = resultsEditor;
|
||||
return this._resultsEditor.setInput(resultsInput, options);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
@@ -148,10 +147,10 @@ export class QueryResultsEditor extends BaseEditor {
|
||||
this.resultsView.layout(dimension);
|
||||
}
|
||||
|
||||
setInput(input: QueryResultsInput, options: EditorOptions): TPromise<void> {
|
||||
setInput(input: QueryResultsInput, options: EditorOptions): Promise<void> {
|
||||
super.setInput(input, options, CancellationToken.None);
|
||||
this.resultsView.input = input;
|
||||
return TPromise.wrap<void>(null);
|
||||
return Promise.resolve<void>(null);
|
||||
}
|
||||
|
||||
clearInput() {
|
||||
|
||||
@@ -18,7 +18,7 @@ import * as nls from 'vs/nls';
|
||||
import { PanelViewlet } from 'vs/workbench/browser/parts/views/panelViewlet';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { once, anyEvent } from 'vs/base/common/event';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
class ResultsView extends Disposable implements IPanelView {
|
||||
@@ -42,7 +42,7 @@ class ResultsView extends Disposable implements IPanelView {
|
||||
this.panelViewlet.addPanels([
|
||||
{ panel: this.messagePanel, size: this.messagePanel.minimumSize, index: 1 }
|
||||
]);
|
||||
anyEvent(this.gridPanel.onDidChange, this.messagePanel.onDidChange)(e => {
|
||||
Event.any(this.gridPanel.onDidChange, this.messagePanel.onDidChange)(e => {
|
||||
let size = this.gridPanel.maximumBodySize;
|
||||
if (size < 1 && this.gridPanel.isVisible()) {
|
||||
this.gridPanel.setVisible(false);
|
||||
@@ -62,7 +62,7 @@ class ResultsView extends Disposable implements IPanelView {
|
||||
this.panelViewlet.addPanels([{ panel: this.gridPanel, index: 0, size: panelSize }]);
|
||||
}
|
||||
});
|
||||
let resizeList = anyEvent(this.gridPanel.onDidChange, this.messagePanel.onDidChange)(() => {
|
||||
let resizeList = Event.any(this.gridPanel.onDidChange, this.messagePanel.onDidChange)(() => {
|
||||
let panelSize: number;
|
||||
if (this.state && this.state.gridPanelSize) {
|
||||
panelSize = this.state.gridPanelSize;
|
||||
@@ -78,7 +78,7 @@ class ResultsView extends Disposable implements IPanelView {
|
||||
this.panelViewlet.resizePanel(this.gridPanel, panelSize);
|
||||
});
|
||||
// once the user changes the sash we should stop trying to resize the grid
|
||||
once(this.panelViewlet.onDidSashChange)(e => {
|
||||
Event.once(this.panelViewlet.onDidSashChange)(e => {
|
||||
this.needsGridResize = false;
|
||||
resizeList.dispose();
|
||||
});
|
||||
|
||||
@@ -7,7 +7,6 @@ import nls = require('vs/nls');
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
@@ -71,13 +70,13 @@ export class FocusOnCurrentQueryKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
queryEditor.focus();
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,13 +97,13 @@ export class RunQueryKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && (editor instanceof QueryEditor || editor instanceof EditDataEditor)) {
|
||||
let queryEditor: QueryEditor | EditDataEditor = editor;
|
||||
queryEditor.runQuery();
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,13 +123,13 @@ export class RunCurrentQueryKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
queryEditor.runCurrentQuery();
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,13 +146,13 @@ export class RunCurrentQueryWithActualPlanKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
queryEditor.runCurrentQueryWithActualPlan();
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,13 +173,13 @@ export class CancelQueryKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && (editor instanceof QueryEditor || editor instanceof EditDataEditor)) {
|
||||
let queryEditor: QueryEditor | EditDataEditor = editor;
|
||||
queryEditor.cancelQuery();
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,13 +199,13 @@ export class RefreshIntellisenseKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
queryEditor.rebuildIntelliSenseCache();
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,13 +226,13 @@ export class ToggleQueryResultsKeyboardAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
queryEditor.toggleResultsEditorVisibility();
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,12 +252,12 @@ export class RunQueryShortcutAction extends Action {
|
||||
super(RunQueryShortcutAction.ID);
|
||||
}
|
||||
|
||||
public run(index: number): TPromise<void> {
|
||||
let promise: Thenable<void> = TPromise.as(null);
|
||||
public run(index: number): Promise<void> {
|
||||
let promise: Thenable<void> = Promise.resolve(null);
|
||||
runActionOnActiveQueryEditor(this._editorService, (editor) => {
|
||||
promise = this.runQueryShortcut(editor, index);
|
||||
});
|
||||
return new TPromise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
promise.then(success => resolve(null), err => resolve(null));
|
||||
});
|
||||
}
|
||||
@@ -280,7 +279,7 @@ export class RunQueryShortcutAction extends Action {
|
||||
let shortcutText = this.getShortcutText(shortcutIndex);
|
||||
if (!shortcutText.trim()) {
|
||||
// no point going further
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
// if the selection isn't empty then execute the selection
|
||||
@@ -294,7 +293,7 @@ export class RunQueryShortcutAction extends Action {
|
||||
return null;
|
||||
});
|
||||
} else {
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,9 +335,9 @@ export class RunQueryShortcutAction extends Action {
|
||||
return parameterText;
|
||||
});
|
||||
}
|
||||
return TPromise.as(parameterText);
|
||||
return Promise.resolve(parameterText);
|
||||
}
|
||||
return TPromise.as('');
|
||||
return Promise.resolve('');
|
||||
}
|
||||
|
||||
private isProcWithSingleArgument(result: azdata.SimpleExecuteResult): number {
|
||||
@@ -410,7 +409,7 @@ export class ParseSyntaxAction extends Action {
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
let editor = this._editorService.activeControl;
|
||||
if (editor && editor instanceof QueryEditor) {
|
||||
let queryEditor: QueryEditor = editor;
|
||||
@@ -442,7 +441,7 @@ export class ParseSyntaxAction extends Action {
|
||||
|
||||
}
|
||||
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,6 @@ import { Dropdown } from 'sql/base/browser/ui/editableDropdown/dropdown';
|
||||
import { Action, IActionItem, IActionRunner } from 'vs/base/common/actions';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { attachEditableDropdownStyler, attachSelectBoxStyler } from 'sql/platform/theme/common/styler';
|
||||
@@ -52,7 +51,7 @@ export abstract class QueryTaskbarAction extends Action {
|
||||
/**
|
||||
* This method is executed when the button is clicked.
|
||||
*/
|
||||
public abstract run(): TPromise<void>;
|
||||
public abstract run(): Promise<void>;
|
||||
|
||||
protected updateCssClass(enabledClass: string): void {
|
||||
// set the class, useful on change of label or icon
|
||||
@@ -115,7 +114,7 @@ export class RunQueryAction extends QueryTaskbarAction {
|
||||
this.label = nls.localize('runQueryLabel', 'Run');
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
if (!this.editor.isSelectionEmpty()) {
|
||||
if (this.isConnected(this.editor)) {
|
||||
// If we are already connected, run the query
|
||||
@@ -126,10 +125,10 @@ export class RunQueryAction extends QueryTaskbarAction {
|
||||
this.connectEditor(this.editor, RunQueryOnConnectionMode.executeQuery, this.editor.getSelection());
|
||||
}
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public runCurrent(): TPromise<void> {
|
||||
public runCurrent(): Promise<void> {
|
||||
if (!this.editor.isSelectionEmpty()) {
|
||||
if (this.isConnected(this.editor)) {
|
||||
// If we are already connected, run the query
|
||||
@@ -140,7 +139,7 @@ export class RunQueryAction extends QueryTaskbarAction {
|
||||
this.connectEditor(this.editor, RunQueryOnConnectionMode.executeCurrentQuery, this.editor.getSelection(false));
|
||||
}
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public runQuery(editor: QueryEditor, runCurrentStatement: boolean = false) {
|
||||
@@ -186,11 +185,11 @@ export class CancelQueryAction extends QueryTaskbarAction {
|
||||
this.label = nls.localize('cancelQueryLabel', 'Cancel');
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
if (this.isConnected(this.editor)) {
|
||||
this._queryModelService.cancelQuery(this.editor.currentQueryInput.uri);
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +210,7 @@ export class EstimatedQueryPlanAction extends QueryTaskbarAction {
|
||||
this.label = nls.localize('estimatedQueryPlan', 'Explain');
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
if (!this.editor.isSelectionEmpty()) {
|
||||
if (this.isConnected(this.editor)) {
|
||||
// If we are already connected, run the query
|
||||
@@ -222,7 +221,7 @@ export class EstimatedQueryPlanAction extends QueryTaskbarAction {
|
||||
this.connectEditor(this.editor, RunQueryOnConnectionMode.estimatedQueryPlan, this.editor.getSelection());
|
||||
}
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public runQuery(editor: QueryEditor) {
|
||||
@@ -251,7 +250,7 @@ export class ActualQueryPlanAction extends QueryTaskbarAction {
|
||||
this.label = nls.localize('actualQueryPlan', "Actual");
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
if (!this.editor.isSelectionEmpty()) {
|
||||
if (this.isConnected(this.editor)) {
|
||||
// If we are already connected, run the query
|
||||
@@ -262,7 +261,7 @@ export class ActualQueryPlanAction extends QueryTaskbarAction {
|
||||
this.connectEditor(this.editor, RunQueryOnConnectionMode.actualQueryPlan, this.editor.getSelection());
|
||||
}
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public runQuery(editor: QueryEditor) {
|
||||
@@ -298,11 +297,11 @@ export class DisconnectDatabaseAction extends QueryTaskbarAction {
|
||||
this.label = nls.localize('disconnectDatabaseLabel', 'Disconnect');
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
// Call disconnectEditor regardless of the connection state and let the ConnectionManagementService
|
||||
// determine if we need to disconnect, cancel an in-progress conneciton, or do nothing
|
||||
this._connectionManagementService.disconnectEditor(this.editor.currentQueryInput);
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,9 +335,9 @@ export class ConnectDatabaseAction extends QueryTaskbarAction {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
this.connectEditor(this.editor);
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +390,7 @@ export class ToggleConnectDatabaseAction extends QueryTaskbarAction {
|
||||
}
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
public run(): Promise<void> {
|
||||
if (this.connected) {
|
||||
// Call disconnectEditor regardless of the connection state and let the ConnectionManagementService
|
||||
// determine if we need to disconnect, cancel an in-progress connection, or do nothing
|
||||
@@ -399,7 +398,7 @@ export class ToggleConnectDatabaseAction extends QueryTaskbarAction {
|
||||
} else {
|
||||
this.connectEditor(this.editor);
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,8 +419,8 @@ export class ListDatabasesAction extends QueryTaskbarAction {
|
||||
this.class = ListDatabasesAction.EnabledClass;
|
||||
}
|
||||
|
||||
public run(): TPromise<void> {
|
||||
return TPromise.as(null);
|
||||
public run(): Promise<void> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import 'vs/css!sql/parts/query/editor/media/queryEditor';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -72,9 +71,9 @@ export class QueryPlanEditor extends BaseEditor {
|
||||
public layout(dimension: DOM.Dimension): void {
|
||||
}
|
||||
|
||||
public setInput(input: QueryPlanInput, options: EditorOptions): Thenable<void> {
|
||||
public setInput(input: QueryPlanInput, options: EditorOptions): Promise<void> {
|
||||
if (this.input instanceof QueryPlanInput && this.input.matches(input)) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
if (!input.hasInitialized) {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorInput, EditorModel } from 'vs/workbench/common/editor';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
@@ -49,7 +48,7 @@ export class QueryPlanInput extends EditorInput {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public resolve(refresh?: boolean): TPromise<EditorModel> {
|
||||
public resolve(refresh?: boolean): Promise<EditorModel> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import nls = require('vs/nls');
|
||||
import 'vs/css!sql/media/actionBarLabel';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { localize } from 'vs/nls';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -125,4 +125,13 @@ configurationRegistry.registerConfiguration({
|
||||
'type': 'array'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
||||
group: '3_views',
|
||||
command: {
|
||||
id: VIEWLET_ID,
|
||||
title: localize({ key: 'miViewTasks', comment: ['&& denotes a mnemonic'] }, "&&Tasks")
|
||||
},
|
||||
order: 2
|
||||
});
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { ITaskService } from 'sql/platform/taskHistory/common/taskService';
|
||||
import { TaskNode } from 'sql/parts/taskHistory/common/taskNode';
|
||||
@@ -24,7 +23,7 @@ export class CancelAction extends Action {
|
||||
) {
|
||||
super(id, label);
|
||||
}
|
||||
public run(element: TaskNode): TPromise<boolean> {
|
||||
public run(element: TaskNode): Promise<boolean> {
|
||||
if (element instanceof TaskNode) {
|
||||
this._taskService.cancelTask(element.providerName, element.id).then((result) => {
|
||||
if (!result) {
|
||||
@@ -33,10 +32,10 @@ export class CancelAction extends Action {
|
||||
}
|
||||
}, error => {
|
||||
this.showError(error);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
});
|
||||
}
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
private showError(errorMessage: string) {
|
||||
@@ -58,12 +57,12 @@ export class ScriptAction extends Action {
|
||||
super(id, label);
|
||||
}
|
||||
|
||||
public run(element: TaskNode): TPromise<boolean> {
|
||||
public run(element: TaskNode): Promise<boolean> {
|
||||
if (element instanceof TaskNode) {
|
||||
if (element.script && element.script !== '') {
|
||||
this._queryEditorService.newSqlEditor(element.script);
|
||||
}
|
||||
}
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { ContributableActionProvider } from 'vs/workbench/browser/actions';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
import { ITree, IDataSource } from 'vs/base/parts/tree/browser/tree';
|
||||
import { TaskNode } from 'sql/parts/taskHistory/common/taskNode';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
/**
|
||||
* Implements the DataSource(that returns a parent/children of an element) for the task history
|
||||
@@ -39,17 +38,17 @@ export class TaskHistoryDataSource implements IDataSource {
|
||||
/**
|
||||
* Returns the element's children as an array in a promise.
|
||||
*/
|
||||
public getChildren(tree: ITree, element: any): TPromise<any> {
|
||||
public getChildren(tree: ITree, element: any): Promise<any> {
|
||||
if (element instanceof TaskNode) {
|
||||
return TPromise.as((<TaskNode>element).children);
|
||||
return Promise.resolve((<TaskNode>element).children);
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the element's parent in a promise.
|
||||
*/
|
||||
public getParent(tree: ITree, element: any): TPromise<any> {
|
||||
return TPromise.as(null);
|
||||
public getParent(tree: ITree, element: any): Promise<any> {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
'use strict';
|
||||
import 'vs/css!sql/media/icons/common-icons';
|
||||
import 'vs/css!./media/taskHistoryViewlet';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Viewlet } from 'vs/workbench/browser/viewlet';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { toggleClass, Dimension } from 'vs/base/browser/dom';
|
||||
@@ -53,13 +52,13 @@ export class TaskHistoryViewlet extends Viewlet {
|
||||
});
|
||||
}
|
||||
|
||||
public create(parent: HTMLElement): TPromise<void> {
|
||||
public create(parent: HTMLElement): Promise<void> {
|
||||
super.create(parent);
|
||||
this._root = parent;
|
||||
this._taskHistoryView = this._instantiationService.createInstance(TaskHistoryView);
|
||||
this._taskHistoryView.renderBody(parent);
|
||||
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public setVisible(visible: boolean): void {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import 'vs/css!sql/parts/query/editor/media/queryEditor';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
@@ -53,9 +52,9 @@ export class TaskDialogEditor extends BaseEditor {
|
||||
public layout(dimension: Dimension): void {
|
||||
}
|
||||
|
||||
public setInput(input: TaskDialogInput, options: EditorOptions): Thenable<void> {
|
||||
public setInput(input: TaskDialogInput, options: EditorOptions): Promise<void> {
|
||||
if (this.input instanceof TaskDialogInput && this.input.matches(input)) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
if (!input.hasInitialized) {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { EditorInput, EditorModel } from 'vs/workbench/common/editor';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
@@ -43,7 +42,7 @@ export class TaskDialogInput extends EditorInput {
|
||||
return this._connection;
|
||||
}
|
||||
|
||||
public resolve(refresh?: boolean): TPromise<EditorModel> {
|
||||
public resolve(refresh?: boolean): Promise<EditorModel> {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { getIdFromLocalExtensionId } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
|
||||
export const SERVICE_ID = 'capabilitiesService';
|
||||
export const HOST_NAME = 'azdata';
|
||||
@@ -135,9 +134,8 @@ export class CapabilitiesService extends Disposable implements ICapabilitiesServ
|
||||
|
||||
this._register(extentionManagementService.onDidUninstallExtension(({ identifier }) => {
|
||||
const connectionProvider = 'connectionProvider';
|
||||
let extensionid = getIdFromLocalExtensionId(identifier.id);
|
||||
extensionService.getExtensions().then(i => {
|
||||
let extension = i.find(c => c.id === extensionid);
|
||||
let extension = i.find(c => c.identifier.value.toLowerCase() === identifier.id.toLowerCase());
|
||||
if (extension && extension.contributes
|
||||
&& extension.contributes[connectionProvider]
|
||||
&& extension.contributes[connectionProvider].providerId) {
|
||||
|
||||
@@ -651,7 +651,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.AddServerGroup);
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
this._connectionStore.saveProfileGroup(profile).then(groupId => {
|
||||
this._onAddConnectionProfile.fire();
|
||||
this._onAddConnectionProfile.fire(undefined);
|
||||
resolve(groupId);
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
@@ -1220,7 +1220,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
this._connectionStore.editGroup(group).then(groupId => {
|
||||
this.refreshEditorTitles();
|
||||
this._onAddConnectionProfile.fire();
|
||||
this._onAddConnectionProfile.fire(undefined);
|
||||
resolve(null);
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
import * as azdata from 'azdata';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
export const SERVICE_ID = 'dacFxService';
|
||||
@@ -79,13 +78,13 @@ export class DacFxService implements IDacFxService {
|
||||
let providerId: string = this._connectionService.getProviderIdFromUri(uri);
|
||||
|
||||
if (!providerId) {
|
||||
return TPromise.wrapError(new Error(localize('providerIdNotValidError', "Connection is required in order to interact with DacFxService")));
|
||||
return Promise.reject(new Error(localize('providerIdNotValidError', "Connection is required in order to interact with DacFxService")));
|
||||
}
|
||||
let handler = this._providers[providerId];
|
||||
if (handler) {
|
||||
return action(handler);
|
||||
} else {
|
||||
return TPromise.wrapError(new Error(localize('noHandlerRegistered', "No Handler Registered")));
|
||||
return Promise.reject(new Error(localize('noHandlerRegistered', "No Handler Registered")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ const dashboardContrib: IJSONSchema = {
|
||||
}
|
||||
};
|
||||
|
||||
ExtensionsRegistry.registerExtensionPoint<ProviderProperties | ProviderProperties[]>('dashboard', [], dashboardContrib).setHandler(extensions => {
|
||||
ExtensionsRegistry.registerExtensionPoint<ProviderProperties | ProviderProperties[]>({ extensionPoint: 'dashboard', jsonSchema: dashboardContrib }).setHandler(extensions => {
|
||||
|
||||
function handleCommand(contrib: ProviderProperties, extension: IExtensionPointUser<any>) {
|
||||
dashboardRegistry.registerDashboardProvider(contrib.provider, contrib);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as azdata from 'azdata';
|
||||
@@ -47,8 +46,8 @@ export class JobsRefreshAction extends Action {
|
||||
super(JobsRefreshAction.ID, JobsRefreshAction.LABEL, 'refreshIcon');
|
||||
}
|
||||
|
||||
public run(context: IJobActionInfo): TPromise<boolean> {
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
public run(context: IJobActionInfo): Promise<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
if (context) {
|
||||
context.jobHistoryComponent.refreshJobs();
|
||||
resolve(true);
|
||||
@@ -68,8 +67,8 @@ export class NewJobAction extends Action {
|
||||
super(NewJobAction.ID, NewJobAction.LABEL, 'newStepIcon');
|
||||
}
|
||||
|
||||
public run(context: JobsViewComponent): TPromise<boolean> {
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
public run(context: JobsViewComponent): Promise<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
try {
|
||||
context.openCreateJobDialog();
|
||||
resolve(true);
|
||||
@@ -94,12 +93,12 @@ export class RunJobAction extends Action {
|
||||
super(RunJobAction.ID, RunJobAction.LABEL, 'start');
|
||||
}
|
||||
|
||||
public run(context: IJobActionInfo): TPromise<boolean> {
|
||||
public run(context: IJobActionInfo): Promise<boolean> {
|
||||
let jobName = context.targetObject.name;
|
||||
let ownerUri = context.ownerUri;
|
||||
let refreshAction = this.instantationService.createInstance(JobsRefreshAction);
|
||||
this.telemetryService.publicLog(TelemetryKeys.RunAgentJob);
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
this.jobManagementService.jobAction(ownerUri, jobName, JobActions.Run).then(result => {
|
||||
if (result.success) {
|
||||
var startMsg = nls.localize('jobSuccessfullyStarted', ': The job was successfully started.');
|
||||
@@ -129,12 +128,12 @@ export class StopJobAction extends Action {
|
||||
super(StopJobAction.ID, StopJobAction.LABEL, 'stop');
|
||||
}
|
||||
|
||||
public run(context: IJobActionInfo): TPromise<boolean> {
|
||||
public run(context: IJobActionInfo): Promise<boolean> {
|
||||
let jobName = context.targetObject.name;
|
||||
let ownerUri = context.ownerUri;
|
||||
let refreshAction = this.instantationService.createInstance(JobsRefreshAction);
|
||||
this.telemetryService.publicLog(TelemetryKeys.StopAgentJob);
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
this.jobManagementService.jobAction(ownerUri, jobName, JobActions.Stop).then(result => {
|
||||
if (result.success) {
|
||||
refreshAction.run(context);
|
||||
@@ -160,12 +159,12 @@ export class EditJobAction extends Action {
|
||||
super(EditJobAction.ID, EditJobAction.LABEL, 'edit');
|
||||
}
|
||||
|
||||
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||
this._commandService.executeCommand(
|
||||
'agent.openJobDialog',
|
||||
actionInfo.ownerUri,
|
||||
actionInfo.targetObject);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +181,7 @@ export class DeleteJobAction extends Action {
|
||||
super(DeleteJobAction.ID, DeleteJobAction.LABEL);
|
||||
}
|
||||
|
||||
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||
let self = this;
|
||||
let job = actionInfo.targetObject as azdata.AgentJobInfo;
|
||||
self._notificationService.prompt(
|
||||
@@ -208,7 +207,7 @@ export class DeleteJobAction extends Action {
|
||||
run: () => { }
|
||||
}]
|
||||
);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,11 +223,11 @@ export class NewStepAction extends Action {
|
||||
super(NewStepAction.ID, NewStepAction.LABEL, 'newStepIcon');
|
||||
}
|
||||
|
||||
public run(context: JobHistoryComponent): TPromise<boolean> {
|
||||
public run(context: JobHistoryComponent): Promise<boolean> {
|
||||
let ownerUri = context.ownerUri;
|
||||
let server = context.serverName;
|
||||
let jobInfo = context.agentJobInfo;
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
resolve(this._commandService.executeCommand('agent.openNewStepDialog', ownerUri, server, jobInfo, null));
|
||||
});
|
||||
}
|
||||
@@ -248,7 +247,7 @@ export class DeleteStepAction extends Action {
|
||||
super(DeleteStepAction.ID, DeleteStepAction.LABEL);
|
||||
}
|
||||
|
||||
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||
let self = this;
|
||||
let step = actionInfo.targetObject as azdata.AgentJobStepInfo;
|
||||
let refreshAction = this.instantationService.createInstance(JobsRefreshAction);
|
||||
@@ -276,7 +275,7 @@ export class DeleteStepAction extends Action {
|
||||
run: () => { }
|
||||
}]
|
||||
);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,8 +291,8 @@ export class NewAlertAction extends Action {
|
||||
super(NewAlertAction.ID, NewAlertAction.LABEL, 'newStepIcon');
|
||||
}
|
||||
|
||||
public run(context: AlertsViewComponent): TPromise<boolean> {
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
public run(context: AlertsViewComponent): Promise<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
try {
|
||||
context.openCreateAlertDialog();
|
||||
resolve(true);
|
||||
@@ -314,12 +313,12 @@ export class EditAlertAction extends Action {
|
||||
super(EditAlertAction.ID, EditAlertAction.LABEL);
|
||||
}
|
||||
|
||||
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||
this._commandService.executeCommand(
|
||||
'agent.openAlertDialog',
|
||||
actionInfo.ownerUri,
|
||||
actionInfo.targetObject);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +336,7 @@ export class DeleteAlertAction extends Action {
|
||||
super(DeleteAlertAction.ID, DeleteAlertAction.LABEL);
|
||||
}
|
||||
|
||||
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||
let self = this;
|
||||
let alert = actionInfo.targetObject as azdata.AgentAlertInfo;
|
||||
self._notificationService.prompt(
|
||||
@@ -363,7 +362,7 @@ export class DeleteAlertAction extends Action {
|
||||
run: () => { }
|
||||
}]
|
||||
);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,8 +377,8 @@ export class NewOperatorAction extends Action {
|
||||
super(NewOperatorAction.ID, NewOperatorAction.LABEL, 'newStepIcon');
|
||||
}
|
||||
|
||||
public run(context: OperatorsViewComponent): TPromise<boolean> {
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
public run(context: OperatorsViewComponent): Promise<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
try {
|
||||
context.openCreateOperatorDialog();
|
||||
resolve(true);
|
||||
@@ -400,12 +399,12 @@ export class EditOperatorAction extends Action {
|
||||
super(EditOperatorAction.ID, EditOperatorAction.LABEL);
|
||||
}
|
||||
|
||||
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||
this._commandService.executeCommand(
|
||||
'agent.openOperatorDialog',
|
||||
actionInfo.ownerUri,
|
||||
actionInfo.targetObject);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,7 +421,7 @@ export class DeleteOperatorAction extends Action {
|
||||
super(DeleteOperatorAction.ID, DeleteOperatorAction.LABEL);
|
||||
}
|
||||
|
||||
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||
const self = this;
|
||||
let operator = actionInfo.targetObject as azdata.AgentOperatorInfo;
|
||||
self._notificationService.prompt(
|
||||
@@ -448,7 +447,7 @@ export class DeleteOperatorAction extends Action {
|
||||
run: () => { }
|
||||
}]
|
||||
);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -464,8 +463,8 @@ export class NewProxyAction extends Action {
|
||||
super(NewProxyAction.ID, NewProxyAction.LABEL, 'newStepIcon');
|
||||
}
|
||||
|
||||
public run(context: ProxiesViewComponent): TPromise<boolean> {
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
public run(context: ProxiesViewComponent): Promise<boolean> {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
try {
|
||||
context.openCreateProxyDialog();
|
||||
resolve(true);
|
||||
@@ -486,12 +485,12 @@ export class EditProxyAction extends Action {
|
||||
super(EditProxyAction.ID, EditProxyAction.LABEL);
|
||||
}
|
||||
|
||||
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||
this._commandService.executeCommand(
|
||||
'agent.openProxyDialog',
|
||||
actionInfo.ownerUri,
|
||||
actionInfo.targetObject);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,7 +507,7 @@ export class DeleteProxyAction extends Action {
|
||||
super(DeleteProxyAction.ID, DeleteProxyAction.LABEL);
|
||||
}
|
||||
|
||||
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||
public run(actionInfo: IJobActionInfo): Promise<boolean> {
|
||||
let self = this;
|
||||
let proxy = actionInfo.targetObject as azdata.AgentProxyInfo;
|
||||
self._notificationService.prompt(
|
||||
@@ -534,6 +533,6 @@ export class DeleteProxyAction extends Action {
|
||||
run: () => { }
|
||||
}]
|
||||
);
|
||||
return TPromise.as(true);
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import * as azdata from 'azdata';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IJobManagementService } from 'sql/platform/jobManagement/common/interfaces';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
@@ -115,13 +114,13 @@ export class JobManagementService implements IJobManagementService {
|
||||
let providerId: string = this._connectionService.getProviderIdFromUri(uri);
|
||||
|
||||
if (!providerId) {
|
||||
return TPromise.wrapError(new Error(localize('providerIdNotValidError', "Connection is required in order to interact with JobManagementService")));
|
||||
return Promise.reject(new Error(localize('providerIdNotValidError', "Connection is required in order to interact with JobManagementService")));
|
||||
}
|
||||
let handler = this._providers[providerId];
|
||||
if (handler) {
|
||||
return action(handler);
|
||||
} else {
|
||||
return TPromise.wrapError(new Error(localize('noHandlerRegistered', "No Handler Registered")));
|
||||
return Promise.reject(new Error(localize('noHandlerRegistered', "No Handler Registered")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { IConnectionManagementService } from 'sql/platform/connection/common/con
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as azdata from 'azdata';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as TelemetryKeys from 'sql/common/telemetryKeys';
|
||||
import * as TelemetryUtils from 'sql/common/telemetryUtilities';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -179,13 +178,13 @@ export class QueryManagementService implements IQueryManagementService {
|
||||
let providerId: string = this._connectionService.getProviderIdFromUri(uri);
|
||||
|
||||
if (!providerId) {
|
||||
return TPromise.wrapError(new Error('Connection is required in order to interact with queries'));
|
||||
return Promise.reject(new Error('Connection is required in order to interact with queries'));
|
||||
}
|
||||
let handler = this._requestHandlers.get(providerId);
|
||||
if (handler) {
|
||||
return action(handler);
|
||||
} else {
|
||||
return TPromise.wrapError(new Error('No Handler Registered'));
|
||||
return Promise.reject(new Error('No Handler Registered'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import * as statusbar from 'vs/workbench/browser/parts/statusbar/statusbar';
|
||||
import * as platform from 'vs/platform/registry/common/platform';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
@@ -460,7 +459,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
if (queryRunner) {
|
||||
return queryRunner.disposeEdit(ownerUri);
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public updateCell(ownerUri: string, rowId: number, columnId: number, newValue: string): Thenable<azdata.EditUpdateCellResult> {
|
||||
@@ -475,7 +474,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public commitEdit(ownerUri): Thenable<void> {
|
||||
@@ -490,7 +489,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
return Promise.reject(error);
|
||||
});
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public createRow(ownerUri: string): Thenable<azdata.EditCreateRowResult> {
|
||||
@@ -499,7 +498,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
if (queryRunner) {
|
||||
return queryRunner.createRow(ownerUri);
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public deleteRow(ownerUri: string, rowId: number): Thenable<void> {
|
||||
@@ -508,7 +507,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
if (queryRunner) {
|
||||
return queryRunner.deleteRow(ownerUri, rowId);
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public revertCell(ownerUri: string, rowId: number, columnId: number): Thenable<azdata.EditRevertCellResult> {
|
||||
@@ -517,7 +516,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
if (queryRunner) {
|
||||
return queryRunner.revertCell(ownerUri, rowId, columnId);
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public revertRow(ownerUri: string, rowId: number): Thenable<void> {
|
||||
@@ -526,7 +525,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
if (queryRunner) {
|
||||
return queryRunner.revertRow(ownerUri, rowId);
|
||||
}
|
||||
return TPromise.as(null);
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
public getQueryRunner(ownerUri): QueryRunner {
|
||||
|
||||
@@ -24,7 +24,6 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ResultSerializer } from 'sql/platform/node/resultSerializer';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -187,7 +186,7 @@ export default class QueryRunner extends Disposable {
|
||||
private doRunQuery(input: azdata.ISelectionData, runCurrentStatement: boolean, runOptions?: azdata.ExecutionPlanOptions): Thenable<void>;
|
||||
private doRunQuery(input, runCurrentStatement: boolean, runOptions?: azdata.ExecutionPlanOptions): Thenable<void> {
|
||||
if (this.isExecuting) {
|
||||
return TPromise.as(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
this._planXml = new Deferred<string>();
|
||||
this._batchSets = [];
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
@@ -47,5 +46,5 @@ export interface IRestoreService {
|
||||
export const IRestoreDialogController = createDecorator<IRestoreDialogController>('restoreDialogService');
|
||||
export interface IRestoreDialogController {
|
||||
_serviceBrand: any;
|
||||
showDialog(connection: IConnectionProfile): TPromise<void>;
|
||||
showDialog(connection: IConnectionProfile): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as types from 'vs/base/common/types';
|
||||
@@ -290,8 +289,8 @@ export class RestoreDialogController implements IRestoreDialogController {
|
||||
});
|
||||
}
|
||||
|
||||
public showDialog(connection: IConnectionProfile): TPromise<void> {
|
||||
return new TPromise<void>((resolve, reject) => {
|
||||
public showDialog(connection: IConnectionProfile): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let result: void;
|
||||
|
||||
this._ownerUri = this._connectionService.getConnectionUri(connection)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
'use strict';
|
||||
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
|
||||
@@ -18,6 +17,6 @@ export interface IServerGroupDialogCallbacks {
|
||||
export const IServerGroupController = createDecorator<IServerGroupController>('serverGroupController');
|
||||
export interface IServerGroupController {
|
||||
_serviceBrand: any;
|
||||
showCreateGroupDialog(connectionManagementService: IConnectionManagementService, callbacks?: IServerGroupDialogCallbacks): TPromise<void>;
|
||||
showEditGroupDialog(connectionManagementService: IConnectionManagementService, group: ConnectionProfileGroup): TPromise<void>;
|
||||
showCreateGroupDialog(connectionManagementService: IConnectionManagementService, callbacks?: IServerGroupDialogCallbacks): Promise<void>;
|
||||
showEditGroupDialog(connectionManagementService: IConnectionManagementService, group: ConnectionProfileGroup): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { localize } from 'vs/nls';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
|
||||
@@ -125,7 +124,7 @@ export class TaskService implements ITaskService {
|
||||
}
|
||||
|
||||
private cancelAllTasks(): Thenable<void> {
|
||||
return new TPromise<void>((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let promises = this._taskQueue.children.map(task => {
|
||||
if (task.status === TaskStatus.InProgress || task.status === TaskStatus.NotStarted) {
|
||||
return this.cancelTask(task.providerName, task.id);
|
||||
@@ -151,14 +150,14 @@ export class TaskService implements ITaskService {
|
||||
this._onAddNewTask.fire(task);
|
||||
}
|
||||
|
||||
public beforeShutdown(): TPromise<boolean> {
|
||||
public beforeShutdown(): Promise<boolean> {
|
||||
const message = localize('InProgressWarning', '1 or more tasks are in progress. Are you sure you want to quit?');
|
||||
const options = [
|
||||
localize('taskService.yes', "Yes"),
|
||||
localize('taskService.no', "No")
|
||||
];
|
||||
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
let numOfInprogressTasks = this.getNumberOfInProgressTasks();
|
||||
if (numOfInprogressTasks > 0) {
|
||||
this.dialogService.show(Severity.Warning, message, options).then(choice => {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user