mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 03:28:33 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user