Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -43,11 +43,11 @@ export class DropdownList extends Dropdown {
if (_action) {
let button = new Button(_contentContainer);
button.label = _action.label;
this.toDispose.push(DOM.addDisposableListener(button.getElement(), DOM.EventType.CLICK, () => {
this.toDispose.push(DOM.addDisposableListener(button.element, DOM.EventType.CLICK, () => {
this._action.run();
this.hide();
}));
this.toDispose.push(DOM.addDisposableListener(button.getElement(), DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
this.toDispose.push(DOM.addDisposableListener(button.element, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
let event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.Enter)) {
e.stopPropagation();

View File

@@ -13,6 +13,7 @@ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { IContextViewProvider, AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { RenderOptions, renderFormattedText, renderText } from 'vs/base/browser/htmlContentRenderer';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
const $ = dom.$;
@@ -50,8 +51,13 @@ export class ListBox extends SelectBox {
private contextViewProvider: IContextViewProvider;
private isValid: boolean;
constructor(options: string[], selectedOption: string, contextViewProvider: IContextViewProvider, private _clipboardService: IClipboardService) {
super(options, 0);
constructor(
options: string[],
selectedOption: string,
contextViewProvider: IContextViewProvider,
private _clipboardService: IClipboardService) {
super(options, 0, contextViewProvider);
this.contextViewProvider = contextViewProvider;
this.isValid = true;
this.selectElement.multiple = true;

View File

@@ -44,7 +44,7 @@ export function appendRowLink(container: Builder, label: string, labelClass: str
});
});
return new Builder(rowButton.getElement());
return new Builder(rowButton.element);
}
export function appendInputSelectBox(container: Builder, selectBox: SelectBox): SelectBox {

View File

@@ -48,7 +48,7 @@ export function createOptionElement(option: sqlops.ServiceOption, rowContainer:
optionWidget.value = optionValue;
inputElement = this.findElement(rowContainer, 'input');
} else if (option.valueType === ServiceOptionType.category || option.valueType === ServiceOptionType.boolean) {
optionWidget = new SelectBox(possibleInputs, optionValue.toString());
optionWidget = new SelectBox(possibleInputs, optionValue.toString(), contextViewService);
DialogHelper.appendInputSelectBox(rowContainer, optionWidget);
inputElement = this.findElement(rowContainer, 'select-box');
} else if (option.valueType === ServiceOptionType.string || option.valueType === ServiceOptionType.password) {

View File

@@ -18,7 +18,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { localize } from 'vs/nls';
import WebView from 'vs/workbench/parts/html/browser/webview';
import { Webview } from 'vs/workbench/parts/html/browser/webview';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
@@ -29,7 +29,7 @@ export class WebViewDialog extends Modal {
private _okButton: Button;
private _okLabel: string;
private _closeLabel: string;
private _webview: WebView;
private _webview: Webview;
private _html: string;
private _headerTitle: string;
@@ -89,14 +89,17 @@ export class WebViewDialog extends Modal {
protected renderBody(container: HTMLElement) {
new Builder(container).div({ 'class': 'webview-dialog' }, (bodyBuilder) => {
this._body = bodyBuilder.getHTMLElement();
this._webview = new WebView(this._body, this._webViewPartService.getContainer(Parts.EDITOR_PART),
this._webview = new Webview(
this._body,
this._webViewPartService.getContainer(Parts.EDITOR_PART),
this._themeService,
this._environmentService,
this._contextViewService,
undefined,
undefined,
{
allowScripts: true,
enableWrappedPostMessage: true,
hideFind: true
enableWrappedPostMessage: true
}
);
@@ -130,7 +133,7 @@ export class WebViewDialog extends Modal {
}
private updateDialogBody(): void {
this._webview.contents = [this.html];
this._webview.contents = this.html;
}
/* espace key */

View File

@@ -16,8 +16,8 @@ import nls = require('vs/nls');
const $ = dom.$;
export interface ISelectBoxStyles extends vsISelectBoxStyles {
disabledSelectBackground?: Color,
disabledSelectForeground?: Color,
disabledSelectBackground?: Color;
disabledSelectForeground?: Color;
inputValidationInfoBorder?: Color;
inputValidationInfoBackground?: Color;
inputValidationWarningBorder?: Color;
@@ -46,8 +46,8 @@ export class SelectBox extends vsSelectBox {
private inputValidationErrorBackground: Color;
private element: HTMLElement;
constructor(options: string[], selectedOption: string, container?: HTMLElement, contextViewProvider?: IContextViewProvider) {
super(options, 0);
constructor(options: string[], selectedOption: string, contextViewProvider: IContextViewProvider, container?: HTMLElement) {
super(options, 0, contextViewProvider);
this._optionsDictionary = new Array();
for (var i = 0; i < options.length; i++) {
this._optionsDictionary[options[i]] = i;
@@ -115,7 +115,8 @@ export class SelectBox extends vsSelectBox {
}
public enable(): void {
this.selectElement.disabled = false;
//@SQLTODO
//this.selectElement.disabled = false;
this.selectBackground = this.enabledSelectBackground;
this.selectForeground = this.enabledSelectForeground;
this.selectBorder = this.enabledSelectBorder;
@@ -123,7 +124,8 @@ export class SelectBox extends vsSelectBox {
}
public disable(): void {
this.selectElement.disabled = true;
//@SQLTODO
//this.selectElement.disabled = true;
this.selectBackground = this.disabledSelectBackground;
this.selectForeground = this.disabledSelectForeground;
this.selectBorder = this.disabledSelectBorder;

View File

@@ -7,8 +7,8 @@ import * as path from 'path';
import * as os from 'os';
import URI from 'vs/base/common/uri';
import { UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { Schemas } from 'vs/base/common/network';
export const FILE_SCHEMA: string = 'file';
@@ -19,7 +19,7 @@ export function resolveCurrentDirectory(uri: string, rootPath: string): string {
// use current directory of the sql file if sql file is saved
if (sqlUri.scheme === FILE_SCHEMA) {
currentDirectory = path.dirname(sqlUri.fsPath);
} else if (sqlUri.scheme === UNTITLED_SCHEMA) {
} else if (sqlUri.scheme === Schemas.untitled) {
// if sql file is unsaved/untitled but a workspace is open use workspace root
let root = rootPath;
if (root) {

View File

@@ -10,11 +10,13 @@ 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 { IMessageService, IConfirmation, Severity } from 'vs/platform/message/common/message';
import { error } from 'sql/base/common/log';
import { IAccountManagementService } from 'sql/services/accountManagement/interfaces';
import { IErrorMessageService } from 'sql/parts/connection/common/connectionManagement';
import { IConfirmationService, IConfirmation } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
/**
* Actions to add a new account
@@ -79,7 +81,8 @@ export class RemoveAccountAction extends Action {
constructor(
private _account: sqlops.Account,
@IMessageService private _messageService: IMessageService,
@IConfirmationService private _confirmationService: IConfirmationService,
@INotificationService private _notificationService: INotificationService,
@IErrorMessageService private _errorMessageService: IErrorMessageService,
@IAccountManagementService private _accountManagementService: IAccountManagementService
) {
@@ -97,23 +100,26 @@ export class RemoveAccountAction extends Action {
type: 'question'
};
let confirmPromise: boolean = this._messageService.confirm(confirm);
if (!confirmPromise) {
return TPromise.as(false);
} else {
return new TPromise((resolve, reject) => {
self._accountManagementService.removeAccount(self._account.key)
.then(
(result) => { resolve(result); },
(err) => {
// Must handle here as this is an independent action
self._errorMessageService.showDialog(Severity.Error,
localize('removeAccountFailed', 'Failed to remove account'), err);
resolve(false);
}
);
});
}
return this._confirmationService.confirm(confirm).then(result => {
if (!result) {
return TPromise.as(false);
} else {
return new TPromise((resolve, reject) => {
self._accountManagementService.removeAccount(self._account.key)
.then(
(result) => { resolve(result); },
(err) => {
// Must handle here as this is an independent action
self._notificationService.notify({
severity: Severity.Error,
message: localize('removeAccountFailed', 'Failed to remove account')
});
resolve(false);
}
);
});
}
});
}
}

View File

@@ -8,7 +8,7 @@
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { localize } from 'vs/nls';
import { join } from 'path';

View File

@@ -7,10 +7,11 @@ 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 { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { INotificationService, INotificationActions } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
/**
* Workbench action to clear the recent connnections list
@@ -24,7 +25,7 @@ export class ClearRecentConnectionsAction extends Action {
id: string,
label: string,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IQuickOpenService private _quickOpenService: IQuickOpenService
) {
super(id, label);
@@ -36,7 +37,13 @@ export class ClearRecentConnectionsAction extends Action {
return self.promptToClearRecentConnectionsList().then(result => {
if (result) {
self._connectionManagementService.clearRecentConnectionsList();
self._messageService.show(Severity.Info, nls.localize('ClearedRecentConnections', 'Recent connections list cleared'));
const actions: INotificationActions = { primary: [ ] };
self._notificationService.notify({
severity: Severity.Info,
message: nls.localize('ClearedRecentConnections', 'Recent connections list cleared'),
actions
});
}
});
}

View File

@@ -203,7 +203,9 @@ export class ConnectionDialogService implements IConnectionDialogService {
}
private handleShowUiComponent(input: OnShowUIResponse) {
this._currentProviderType = input.selectedProviderType;
if (input.selectedProviderType) {
this._currentProviderType = input.selectedProviderType;
}
this._model.providerName = this.getCurrentProviderName();
this._model = new ConnectionProfile(this._capabilitiesService, this._model);

View File

@@ -30,12 +30,13 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { localize } from 'vs/nls';
import { ITree } from 'vs/base/parts/tree/browser/tree';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService, IConfirmation } from 'vs/platform/message/common/message';
import { IConfirmationService, IChoiceService, IConfirmation, IConfirmationResult, Choice } from 'vs/platform/dialogs/common/dialogs';
import * as styler from 'vs/platform/theme/common/styler';
import { TPromise } from 'vs/base/common/winjs.base';
import * as DOM from 'vs/base/browser/dom';
import { DialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogs';
export interface OnShowUIResponse {
selectedProviderType: string;
@@ -89,7 +90,8 @@ export class ConnectionDialogWidget extends Modal {
@ITelemetryService telemetryService: ITelemetryService,
@IContextKeyService contextKeyService: IContextKeyService,
@IContextMenuService private _contextMenuService: IContextMenuService,
@IMessageService private _messageService: IMessageService
@IConfirmationService private _confirmationService: IConfirmationService,
@IContextViewService private _contextViewService: IContextViewService
) {
super(localize('connection', 'Connection'), TelemetryKeys.Connection, _partService, telemetryService, contextKeyService, { hasSpinner: true, hasErrors: true });
}
@@ -99,7 +101,7 @@ export class ConnectionDialogWidget extends Modal {
container.appendChild(connectionContainer.getHTMLElement());
this._bodyBuilder = new Builder(connectionContainer.getHTMLElement());
this._providerTypeSelectBox = new SelectBox(this.providerTypeOptions, this.selectedProviderType);
this._providerTypeSelectBox = new SelectBox(this.providerTypeOptions, this.selectedProviderType, this._contextViewService);
// Recent connection tab
let recentConnectionTab = $('.connection-recent-tab');
@@ -264,35 +266,15 @@ export class ConnectionDialogWidget extends Modal {
type: 'question'
};
// @SQLTODO
return new TPromise<boolean>((resolve, reject) => {
let confirmed: boolean = this._messageService.confirm(confirm);
if (confirmed) {
this._connectionManagementService.clearRecentConnectionsList();
this.open(false);
}
resolve(confirmed);
this._confirmationService.confirm(confirm).then((confirmed) => {
if (confirmed) {
this._connectionManagementService.clearRecentConnectionsList();
this.open(false);
}
resolve(confirmed);
});
});
//this._messageService.confirm(confirm).then(confirmation => {
// if (!confirmation.confirmed) {
// return TPromise.as(false);
// } else {
// this._connectionManagementService.clearRecentConnectionsList();
// this.open(false);
// return TPromise.as(true);
// }
// });
// return this._messageService.confirm(confirm).then(confirmation => {
// if (!confirmation.confirmed) {
// return TPromise.as(false);
// } else {
// this._connectionManagementService.clearRecentConnectionsList();
// this.open(false);
// return TPromise.as(true);
// }
// });
}
private createRecentConnectionList(): void {

View File

@@ -97,14 +97,14 @@ export class ConnectionWidget {
} else {
authTypeOption.defaultValue = this.getAuthTypeDisplayName(Constants.sqlLogin);
}
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue);
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue, this._contextViewService);
}
this._providerName = providerName;
}
public createConnectionWidget(container: HTMLElement): void {
this._serverGroupOptions = [this.DefaultServerGroup];
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name);
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name, this._contextViewService);
this._previousGroupOption = this._serverGroupSelectBox.value;
this._builder = $().div({ class: 'connection-table' }, (modelTableContent) => {
modelTableContent.element('table', { class: 'connection-table-content' }, (tableContainer) => {

View File

@@ -16,7 +16,6 @@ import { IConnectionManagementService } from 'sql/parts/connection/common/connec
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
import { IAction } from 'vs/base/common/actions';
import Event, { Emitter } from 'vs/base/common/event';
import { IMessageService } from 'vs/platform/message/common/message';
import mouse = require('vs/base/browser/mouseEvent');
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
@@ -27,7 +26,6 @@ export class RecentConnectionActionsProvider extends ContributableActionProvider
constructor(
@IInstantiationService private _instantiationService: IInstantiationService,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IMessageService private _messageService: IMessageService,
) {
super();
}

View File

@@ -5,10 +5,8 @@
import * as types from 'vs/base/common/types';
import { generateUuid } from 'vs/base/common/uuid';
import { Registry } from 'vs/platform/registry/common/platform';
import { Severity } from 'vs/platform/message/common/message';
import { error } from 'sql/base/common/log';
import * as nls from 'vs/nls';
import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { Extensions, IInsightRegistry } from 'sql/platform/dashboard/common/insightRegistry';
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';

View File

@@ -27,7 +27,6 @@ import { AngularDisposable } from 'sql/base/common/lifecycle';
import { Registry } from 'vs/platform/registry/common/platform';
import * as types from 'vs/base/common/types';
import { Severity } from 'vs/platform/message/common/message';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import * as nls from 'vs/nls';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
@@ -39,6 +38,7 @@ import * as objects from 'vs/base/common/objects';
import Event, { Emitter } from 'vs/base/common/event';
import { Action } from 'vs/base/common/actions';
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import Severity from 'vs/base/common/severity';
const dashboardRegistry = Registry.as<IDashboardRegistry>(DashboardExtensions.DashboardContributions);
@@ -97,7 +97,10 @@ export abstract class DashboardPage extends AngularDisposable {
protected init() {
this.dashboardService.dashboardContextKey.set(this.context);
if (!this.dashboardService.connectionManagementService.connectionInfo) {
this.dashboardService.messageService.show(Severity.Warning, nls.localize('missingConnectionInfo', 'No connection information could be found for this dashboard'));
this.dashboardService.notificationService.notify({
severity: Severity.Error,
message: nls.localize('missingConnectionInfo', 'No connection information could be found for this dashboard')
});
} else {
let tempWidgets = this.dashboardService.getSettings<Array<WidgetConfig>>([this.context, 'widgets'].join('.'));
this._widgetConfigLocation = 'default';

View File

@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { localize } from 'vs/nls';
import * as types from 'vs/base/common/types';

View File

@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { localize } from 'vs/nls';
import { join } from 'path';

View File

@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IExtensionPointUser } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';

View File

@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IExtensionPointUser } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';
import { join } from 'path';

View File

@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IExtensionPointUser } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';

View File

@@ -7,7 +7,7 @@ import 'vs/css!./webviewContent';
import { Component, forwardRef, Input, OnInit, Inject, ChangeDetectorRef, ElementRef } from '@angular/core';
import Event, { Emitter } from 'vs/base/common/event';
import Webview from 'vs/workbench/parts/html/browser/webview';
import { Webview } from 'vs/workbench/parts/html/browser/webview';
import { Parts } from 'vs/workbench/services/part/common/partService';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { addDisposableListener, EventType } from 'vs/base/browser/dom';
@@ -80,7 +80,7 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
public setHtml(html: string): void {
this._html = html;
if (this._webview) {
this._webview.contents = [html];
this._webview.contents = html;
this._webview.layout();
}
}
@@ -102,21 +102,24 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
this._webview = new Webview(this._el.nativeElement,
this._dashboardService.partService.getContainer(Parts.EDITOR_PART),
this._dashboardService.themeService,
this._dashboardService.environmentService,
this._dashboardService.contextViewService,
undefined,
undefined,
{
allowScripts: true,
enableWrappedPostMessage: true,
hideFind: true
enableWrappedPostMessage: true
}
);
this._onMessageDisposable = this._webview.onMessage(e => {
this._onMessage.fire(e);
});
this._webview.style(this._dashboardService.themeService.getTheme());
if (this._html) {
this._webview.contents = [this._html];
this._webview.contents = this._html;
}
this._webview.layout();
}

View File

@@ -36,7 +36,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IDisposable } from 'vs/base/common/lifecycle';
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { ConfigurationEditingService, IConfigurationValue } from 'vs/workbench/services/configuration/node/configurationEditingService';
import { IMessageService } from 'vs/platform/message/common/message';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IStorageService } from 'vs/platform/storage/common/storage';
import Event, { Emitter } from 'vs/base/common/event';
@@ -46,6 +45,8 @@ import { IPartService } from 'vs/workbench/services/part/common/partService';
import { deepClone } from 'vs/base/common/objects';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
const DASHBOARD_SETTINGS = 'dashboard';
@@ -131,7 +132,7 @@ export class DashboardServiceInterface extends AngularDisposable {
private _configService = this._bootstrapService.configurationService;
private _insightsDialogService = this._bootstrapService.insightsDialogService;
private _contextViewService = this._bootstrapService.contextViewService;
private _messageService = this._bootstrapService.messageService;
private _notificationService = this._bootstrapService.notificationService;
private _workspaceContextService = this._bootstrapService.workspaceContextService;
private _storageService = this._bootstrapService.storageService;
private _capabilitiesService = this._bootstrapService.capabilitiesService;
@@ -140,6 +141,7 @@ export class DashboardServiceInterface extends AngularDisposable {
private _dashboardWebviewService = this._bootstrapService.dashboardWebviewService;
private _partService = this._bootstrapService.partService;
private _angularEventingService = this._bootstrapService.angularEventingService;
private _environmentService = this._bootstrapService.environmentService;
/* Special Services */
private _metadataService: SingleConnectionMetadataService;
@@ -177,8 +179,8 @@ export class DashboardServiceInterface extends AngularDisposable {
super();
}
public get messageService(): IMessageService {
return this._messageService;
public get notificationService(): INotificationService {
return this._notificationService;
}
public get configurationEditingService(): ConfigurationEditingService {
@@ -229,6 +231,10 @@ export class DashboardServiceInterface extends AngularDisposable {
return this._queryManagementService;
}
public get environmentService(): IEnvironmentService {
return this._environmentService;
}
public get contextViewService(): IContextViewService {
return this._contextViewService;
}
@@ -329,11 +335,17 @@ export class DashboardServiceInterface extends AngularDisposable {
this._router.navigate(['database-dashboard']);
}
} else {
this.messageService.show(Severity.Error, nls.localize('dashboard.changeDatabaseFailure', "Failed to change database"));
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('dashboard.changeDatabaseFailure', "Failed to change database")
});
}
},
() => {
this.messageService.show(Severity.Error, nls.localize('dashboard.changeDatabaseFailure', "Failed to change database"));
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('dashboard.changeDatabaseFailure', "Failed to change database")
});
}
);
break;

View File

@@ -9,7 +9,7 @@ import { Extensions as InsightExtensions, IInsightRegistry } from 'sql/platform/
import { IInsightsConfig } from './interfaces';
import { insightsContribution, insightsSchema } from 'sql/parts/dashboard/widgets/insights/insightsWidgetSchemas';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
const insightRegistry = Registry.as<IInsightRegistry>(InsightExtensions.InsightContribution);

View File

@@ -127,8 +127,10 @@ export class TasksWidget extends DashboardWidget implements IDashboardWidget, On
let label = $('div').safeInnerHtml(types.isString(action.title) ? action.title : action.title.value);
let tile = $('div.task-tile').style('height', this._size + 'px').style('width', this._size + 'px');
let innerTile = $('div');
if (action.iconClass) {
let icon = $('span.icon').addClass(action.iconClass);
// @SQLTODO - iconPath shouldn't be used as a CSS class
if (action.iconPath && action.iconPath.dark) {
let icon = $('span.icon').addClass(action.iconPath.dark);
innerTile.append(icon);
}
innerTile.append(label);

View File

@@ -5,7 +5,7 @@
import { Component, Inject, forwardRef, ChangeDetectorRef, OnInit, ViewChild, ElementRef } from '@angular/core';
import Webview from 'vs/workbench/parts/html/browser/webview';
import { Webview } from 'vs/workbench/parts/html/browser/webview';
import { Parts } from 'vs/workbench/services/part/common/partService';
import Event, { Emitter } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
@@ -58,7 +58,7 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
public setHtml(html: string): void {
this._html = html;
if (this._webview) {
this._webview.contents = [html];
this._webview.contents = html;
this._webview.layout();
}
}
@@ -96,15 +96,17 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
if (this._onMessageDisposable) {
this._onMessageDisposable.dispose();
}
this._webview = new Webview(this._el.nativeElement,
this._webview = new Webview(
this._el.nativeElement,
this._dashboardService.partService.getContainer(Parts.EDITOR_PART),
this._dashboardService.themeService,
this._dashboardService.environmentService,
this._dashboardService.contextViewService,
undefined,
undefined,
{
allowScripts: true,
enableWrappedPostMessage: true,
hideFind: true
enableWrappedPostMessage: true
}
);
this._onMessageDisposable = this._webview.onMessage(e => {
@@ -112,7 +114,7 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
});
this._webview.style(this._dashboardService.themeService.getTheme());
if (this._html) {
this._webview.contents = [this._html];
this._webview.contents = this._html;
}
this._webview.layout();
}

View File

@@ -209,7 +209,7 @@ export class BackupComponent {
this.recoveryBox = new InputBox(this.recoveryModelElement.nativeElement, this._bootstrapService.contextViewService, { placeholder: this.recoveryModel });
// Set backup type
this.backupTypeSelectBox = new SelectBox([], '');
this.backupTypeSelectBox = new SelectBox([], '', this._bootstrapService.contextViewService);
this.backupTypeSelectBox.render(this.backupTypeElement.nativeElement);
// Set copy-only check box
@@ -264,13 +264,13 @@ export class BackupComponent {
this.removePathButton.title = localize('removeFile', 'Remove files');
// Set compression
this.compressionSelectBox = new SelectBox(this.compressionOptions, this.compressionOptions[0]);
this.compressionSelectBox = new SelectBox(this.compressionOptions, this.compressionOptions[0], this._bootstrapService.contextViewService);
this.compressionSelectBox.render(this.compressionElement.nativeElement);
// Set encryption
this.algorithmSelectBox = new SelectBox(this.encryptionAlgorithms, this.encryptionAlgorithms[0]);
this.algorithmSelectBox = new SelectBox(this.encryptionAlgorithms, this.encryptionAlgorithms[0], this._bootstrapService.contextViewService);
this.algorithmSelectBox.render(this.encryptionAlgorithmElement.nativeElement);
this.encryptorSelectBox = new SelectBox([], '');
this.encryptorSelectBox = new SelectBox([], '', this._bootstrapService.contextViewService);
this.encryptorSelectBox.render(this.encryptorElement.nativeElement);
// Set media

View File

@@ -519,7 +519,7 @@ export class RestoreDialog extends Modal {
});
inputContainer.div({ class: 'dialog-input' }, (inputCellContainer) => {
selectBox = new SelectBox(options, selectedOption, inputCellContainer.getHTMLElement(), this._contextViewService);
selectBox = new SelectBox(options, selectedOption, this._contextViewService, inputCellContainer.getHTMLElement());
selectBox.render(inputCellContainer.getHTMLElement());
});
});

View File

@@ -6,13 +6,14 @@
import { TPromise } from 'vs/base/common/winjs.base';
import { EditorInput, EditorModel } from 'vs/workbench/common/editor';
import { IConnectionManagementService, IConnectableInput, INewConnectionParams } from 'sql/parts/connection/common/connectionManagement';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import Event, { Emitter } from 'vs/base/common/event';
import { EditSessionReadyParams } from 'sqlops';
import URI from 'vs/base/common/uri';
import nls = require('vs/nls');
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
/**
* Input for the EditDataEditor. This input is simply a wrapper around a QueryResultsInput for the QueryResultsEditor
@@ -35,7 +36,7 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
constructor(private _uri: URI, private _schemaName, private _tableName,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IQueryModelService private _queryModelService: IQueryModelService,
@IMessageService private _messageService: IMessageService
@INotificationService private notificationService: INotificationService
) {
super();
this._visible = false;
@@ -116,7 +117,11 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
} else {
this._refreshButtonEnabled = false;
this._stopButtonEnabled = false;
this._messageService.show(Severity.Error, result.message);
this.notificationService.notify({
severity: Severity.Error,
message: result.message
});
}
this._editorInitializing.fire(false);
this._updateTaskbar.fire(this);
@@ -128,7 +133,11 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
public onConnectReject(error?: string): void {
if (error) {
this._messageService.show(Severity.Error, nls.localize('connectionFailure', 'Edit Data Session Failed To Connect'));
this.notificationService.notify({
severity: Severity.Error,
message: nls.localize('connectionFailure', 'Edit Data Session Failed To Connect')
});
}
}

View File

@@ -11,9 +11,11 @@ import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { EventEmitter } from 'sql/base/common/eventEmitter';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { EditDataEditor } from 'sql/parts/editData/editor/editDataEditor';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import nls = require('vs/nls');
import * as dom from 'vs/base/browser/dom';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { INotificationService, INotificationActions } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
const $ = dom.$;
/**
@@ -65,7 +67,7 @@ export class RefreshTableAction extends EditDataAction {
constructor(editor: EditDataEditor,
@IQueryModelService private _queryModelService: IQueryModelService,
@IConnectionManagementService _connectionManagementService: IConnectionManagementService,
@IMessageService private _messageService: IMessageService
@INotificationService private _notificationService: INotificationService,
) {
super(editor, RefreshTableAction.ID, RefreshTableAction.EnabledClass, _connectionManagementService);
this.label = nls.localize('editData.refresh', 'Refresh');
@@ -77,7 +79,10 @@ export class RefreshTableAction extends EditDataAction {
this._queryModelService.disposeEdit(input.uri).then((result) => {
this._queryModelService.initializeEdit(input.uri, input.schemaName, input.tableName, input.objectType, input.rowLimit);
}, error => {
this._messageService.show(Severity.Error, nls.localize('disposeEditFailure', 'Dispose Edit Failed With Error: ') + error);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('disposeEditFailure', 'Dispose Edit Failed With Error: ') + error
});
});
}
return TPromise.as(null);
@@ -147,12 +152,14 @@ export class ChangeMaxRowsActionItem extends EventEmitter implements IActionItem
private _options: string[];
private _currentOptionsIndex: number;
constructor(private _editor: EditDataEditor) {
constructor(
private _editor: EditDataEditor,
@IContextViewService contextViewService: IContextViewService) {
super();
this._options = ['200', '1000', '10000'];
this._currentOptionsIndex = 0;
this.toDispose = [];
this.selectBox = new SelectBox([], -1);
this.selectBox = new SelectBox([], -1, contextViewService);
this._registerListeners();
this._refreshOptions();
this.defaultRowCount = Number(this._options[this._currentOptionsIndex]);

View File

@@ -96,7 +96,7 @@ export class FileBrowserDialog extends Modal {
let pathBuilder = DialogHelper.appendRow(tableContainer, pathLabel, 'file-input-label', 'file-input-box');
this._filePathInputBox = new InputBox(pathBuilder.getHTMLElement(), this._contextViewService);
this._fileFilterSelectBox = new SelectBox(['*'], '*');
this._fileFilterSelectBox = new SelectBox(['*'], '*', this._contextViewService);
let filterLabel = localize('fileFilter', 'Files of type');
let filterBuilder = DialogHelper.appendRow(tableContainer, filterLabel, 'file-input-label', 'file-input-box');
DialogHelper.appendInputSelectBox(filterBuilder, this._fileFilterSelectBox);

View File

@@ -109,7 +109,7 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
this._initActionBar();
// Init chart type dropdown
this.chartTypesSelectBox = new SelectBox(insightRegistry.getAllIds(), this.getDefaultChartType());
this.chartTypesSelectBox = new SelectBox(insightRegistry.getAllIds(), this.getDefaultChartType(), this._bootstrapService.contextViewService);
this.chartTypesSelectBox.render(this.chartTypesElement.nativeElement);
this.chartTypesSelectBox.onDidSelect(selected => this.onChartChanged());
this._disposables.push(attachSelectBoxStyler(this.chartTypesSelectBox, this._bootstrapService.themeService));
@@ -129,7 +129,7 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
});
// Init legend dropdown
this.legendSelectBox = new SelectBox(this.legendOptions, this._chartConfig.legendPosition);
this.legendSelectBox = new SelectBox(this.legendOptions, this._chartConfig.legendPosition, this._bootstrapService.contextViewService);
this.legendSelectBox.render(this.legendElement.nativeElement);
this.legendSelectBox.onDidSelect(selected => this.onLegendChanged());
this._disposables.push(attachSelectBoxStyler(this.legendSelectBox, this._bootstrapService.themeService));
@@ -209,35 +209,37 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
}
public saveChart(): void {
let filePath = this.promptForFilepath();
let data = this._chartComponent.getCanvasData();
if (!data) {
this.showError(this.chartNotFoundError);
return;
}
if (filePath) {
let buffer = this.decodeBase64Image(data);
pfs.writeFile(filePath, buffer).then(undefined, (err) => {
if (err) {
this.showError(err.message);
} else {
let fileUri = URI.from({ scheme: PathUtilities.FILE_SCHEMA, path: filePath });
this._bootstrapService.windowsService.openExternal(fileUri.toString());
this._bootstrapService.messageService.show(Severity.Info, nls.localize('chartSaved', 'Saved Chart to path: {0}', filePath));
}
});
}
this.promptForFilepath().then(filePath => {
let data = this._chartComponent.getCanvasData();
if (!data) {
this.showError(this.chartNotFoundError);
return;
}
if (filePath) {
let buffer = this.decodeBase64Image(data);
pfs.writeFile(filePath, buffer).then(undefined, (err) => {
if (err) {
this.showError(err.message);
} else {
let fileUri = URI.from({ scheme: PathUtilities.FILE_SCHEMA, path: filePath });
this._bootstrapService.windowsService.openExternal(fileUri.toString());
this._bootstrapService.notificationService.notify({
severity: Severity.Error,
message: nls.localize('chartSaved', 'Saved Chart to path: {0}', filePath)
});
}
});
}
});
}
private promptForFilepath(): string {
private promptForFilepath(): Thenable<string> {
let filepathPlaceHolder = PathUtilities.resolveCurrentDirectory(this.getActiveUriString(), PathUtilities.getRootPath(this._bootstrapService.workspaceContextService));
filepathPlaceHolder = paths.join(filepathPlaceHolder, 'chart.png');
let filePath: string = this._bootstrapService.windowService.showSaveDialog({
return this._bootstrapService.windowService.showSaveDialog({
title: nls.localize('chartViewer.saveAsFileTitle', 'Choose Results File'),
defaultPath: paths.normalize(filepathPlaceHolder, true)
});
return filePath;
}
private decodeBase64Image(data: string): Buffer {
@@ -282,7 +284,10 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
}
private showError(errorMsg: string) {
this._bootstrapService.messageService.show(Severity.Error, errorMsg);
this._bootstrapService.notificationService.notify({
severity: Severity.Error,
message: errorMsg
});
}
private getGridItemConfig(): NgGridItemConfig {

View File

@@ -6,8 +6,8 @@
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions';
import * as nls from 'vs/nls';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
export interface IChartViewActionContext {
copyChart(): void;
@@ -23,7 +23,7 @@ export class ChartViewActionBase extends Action {
id: string,
label: string,
enabledClass: string,
protected messageService: IMessageService
protected notificationService: INotificationService
) {
super(id, label);
this.enabled = true;
@@ -51,7 +51,10 @@ export class ChartViewActionBase extends Action {
protected doRun(context: IChartViewActionContext, runAction: Function): TPromise<boolean> {
if (!context) {
// TODO implement support for finding chart view in active window
this.messageService.show(Severity.Error, nls.localize('chartContextRequired', 'Chart View context is required to run this action'));
this.notificationService.notify({
severity: Severity.Error,
message: nls.localize('chartContextRequired', 'Chart View context is required to run this action')
});
return TPromise.as(false);
}
return new TPromise<boolean>((resolve, reject) => {
@@ -66,9 +69,9 @@ export class CreateInsightAction extends ChartViewActionBase {
public static ID = 'chartview.createInsight';
public static LABEL = nls.localize('createInsightLabel', "Create Insight");
constructor(@IMessageService messageService: IMessageService
constructor(@INotificationService notificationService: INotificationService
) {
super(CreateInsightAction.ID, CreateInsightAction.LABEL, 'createInsight', messageService);
super(CreateInsightAction.ID, CreateInsightAction.LABEL, 'createInsight', notificationService);
}
public run(context: IChartViewActionContext): TPromise<boolean> {
@@ -80,9 +83,9 @@ export class CopyAction extends ChartViewActionBase {
public static ID = 'chartview.copy';
public static LABEL = nls.localize('copyChartLabel', "Copy as image");
constructor(@IMessageService messageService: IMessageService
constructor(@INotificationService notificationService: INotificationService
) {
super(CopyAction.ID, CopyAction.LABEL, 'copyImage', messageService);
super(CopyAction.ID, CopyAction.LABEL, 'copyImage', notificationService);
}
public run(context: IChartViewActionContext): TPromise<boolean> {
@@ -94,9 +97,9 @@ export class SaveImageAction extends ChartViewActionBase {
public static ID = 'chartview.saveImage';
public static LABEL = nls.localize('saveImageLabel', "Save as image");
constructor(@IMessageService messageService: IMessageService
constructor(@INotificationService notificationService: INotificationService
) {
super(SaveImageAction.ID, SaveImageAction.LABEL, 'saveAsImage', messageService);
super(SaveImageAction.ID, SaveImageAction.LABEL, 'saveAsImage', notificationService);
}
public run(context: IChartViewActionContext): TPromise<boolean> {

View File

@@ -17,9 +17,9 @@ import Severity from 'vs/base/common/severity';
import * as types from 'vs/base/common/types';
import * as pfs from 'vs/base/node/pfs';
import * as nls from 'vs/nls';
import { IMessageService } from 'vs/platform/message/common/message';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { INotificationService } from 'vs/platform/notification/common/notification';
export class InsightsDialogController {
private _queryRunner: QueryRunner;
@@ -30,7 +30,7 @@ export class InsightsDialogController {
constructor(
private _model: IInsightsDialogModel,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IErrorMessageService private _errorMessageService: IErrorMessageService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@@ -41,7 +41,10 @@ export class InsightsDialogController {
// execute string
if (typeof input === 'object') {
if (connectionProfile === undefined) {
this._messageService.show(Severity.Error, nls.localize("insightsInputError", "No Connection Profile was passed to insights flyout"));
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize("insightsInputError", "No Connection Profile was passed to insights flyout")
});
return Promise.resolve();
}
if (types.isStringArray(input.query)) {
@@ -88,14 +91,20 @@ export class InsightsDialogController {
}).then(() => resolve());
},
error => {
this._messageService.show(Severity.Error, nls.localize("insightsFileError", "There was an error reading the query file: ") + error);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize("insightsFileError", "There was an error reading the query file: ") + error
});
resolve();
}
);
});
} else {
error('Error reading details Query: ', input);
this._messageService.show(Severity.Error, nls.localize("insightsConfigError", "There was an error parsing the insight config; could not find query array/string or queryfile"));
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize("insightsConfigError", "There was an error parsing the insight config; could not find query array/string or queryfile")
});
return Promise.resolve();
}
}

View File

@@ -12,7 +12,6 @@ import { attachListStyler } from 'vs/platform/theme/common/styler';
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { PanelComponent } from 'sql/base/browser/ui/panel/panel.component';
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
import { IJobManagementService } from '../common/interfaces';
@@ -23,6 +22,8 @@ import { JobHistoryController, JobHistoryDataSource,
import { JobStepsViewComponent } from 'sql/parts/jobManagement/views/jobStepsView.component';
import { JobStepsViewRow } from './jobStepsViewTree';
import { localize } from 'vs/nls';
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
export const DASHBOARD_SELECTOR: string = 'jobhistory-component';
@@ -50,7 +51,7 @@ export class JobHistoryComponent extends Disposable implements OnInit {
private _stepRows: JobStepsViewRow[] = [];
private _showSteps: boolean = false;
private _runStatus: string = undefined;
private _messageService: IMessageService;
private _notificationService: INotificationService;
constructor(
@Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService,
@@ -61,7 +62,7 @@ export class JobHistoryComponent extends Disposable implements OnInit {
) {
super();
this._jobManagementService = bootstrapService.jobManagementService;
this._messageService = bootstrapService.messageService;
this._notificationService = bootstrapService.notificationService;
}
ngOnInit() {
@@ -157,17 +158,26 @@ export class JobHistoryComponent extends Disposable implements OnInit {
switch (action) {
case ('run'):
var startMsg = localize('jobSuccessfullyStarted', 'The job was successfully started.');
this._messageService.show(Severity.Info, startMsg);
self._notificationService.notify({
severity: Severity.Info,
message: startMsg
});
break;
case ('stop'):
var stopMsg = localize('jobSuccessfullyStopped', 'The job was successfully stopped.');
this._messageService.show(Severity.Info, stopMsg);
self._notificationService.notify({
severity: Severity.Info,
message: stopMsg
});
break;
default:
break;
}
} else {
this._messageService.show(Severity.Error, result.errorMessage);
self._notificationService.notify({
severity: Severity.Error,
message: result.errorMessage
});
}
});
}

View File

@@ -235,7 +235,11 @@ export class NewProfilerAction extends Task {
private _connectionProfile: ConnectionProfile;
constructor() {
super({ id: NewProfilerAction.ID, title: NewProfilerAction.LABEL, iconClass: NewProfilerAction.ICON });
super({
id: NewProfilerAction.ID,
title: NewProfilerAction.LABEL,
iconPath: { dark: NewProfilerAction.ICON, light: NewProfilerAction.ICON }
});
}
public runTask(accessor: ServicesAccessor, profile: IConnectionProfile): TPromise<void> {

View File

@@ -25,6 +25,7 @@ import { attachListStyler } from 'vs/platform/theme/common/styler';
import Event, { Emitter } from 'vs/base/common/event';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
class EventItem {
@@ -314,7 +315,8 @@ export class ProfilerColumnEditorDialog extends Modal {
@IPartService _partService: IPartService,
@IThemeService private _themeService: IThemeService,
@ITelemetryService telemetryService: ITelemetryService,
@IContextKeyService contextKeyService: IContextKeyService
@IContextKeyService contextKeyService: IContextKeyService,
@IContextViewService private _contextViewService: IContextViewService
) {
super(nls.localize('profilerColumnDialog.profiler', 'Profiler'), TelemetryKeys.Profiler, _partService, telemetryService, contextKeyService);
}
@@ -329,7 +331,7 @@ export class ProfilerColumnEditorDialog extends Modal {
protected renderBody(container: HTMLElement): void {
let builder = new Builder(container);
builder.div({}, b => {
this._selectBox = new SelectBox(this._options, 0);
this._selectBox = new SelectBox(this._options, 0, this._contextViewService);
this._selectBox.render(b.getHTMLElement());
this._register(this._selectBox.onDidSelect(e => {
this._selectedValue = e.index;

View File

@@ -28,11 +28,11 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati
import { ProfilerResourceEditor } from './profilerResourceEditor';
import { SplitView, View, Orientation, IViewOptions } from 'sql/base/browser/ui/splitview/splitview';
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IModel } from 'vs/editor/common/editorCommon';
import { ITextModel } from 'vs/editor/common/model';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
import URI from 'vs/base/common/uri';
import { UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { Schemas } from 'vs/base/common/network';
import * as nls from 'vs/nls';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IDisposable } from 'vs/base/common/lifecycle';
@@ -97,7 +97,7 @@ export interface IDetailData {
export class ProfilerEditor extends BaseEditor {
public static ID: string = 'workbench.editor.profiler';
private _editor: ProfilerResourceEditor;
private _editorModel: IModel;
private _editorModel: ITextModel;
private _editorInput: UntitledEditorInput;
private _splitView: SplitView;
private _container: HTMLElement;
@@ -189,7 +189,7 @@ export class ProfilerEditor extends BaseEditor {
this._autoscrollAction = this._instantiationService.createInstance(Actions.ProfilerAutoScroll, Actions.ProfilerAutoScroll.ID, Actions.ProfilerAutoScroll.LABEL);
this._sessionTemplates = this._profilerService.getSessionTemplates();
this._sessionTemplateSelector = new SelectBox(this._sessionTemplates.map(i => i.name), 'Standard');
this._sessionTemplateSelector = new SelectBox(this._sessionTemplates.map(i => i.name), 'Standard', this._contextViewService);
this._register(this._sessionTemplateSelector.onDidSelect(e => {
if (this.input) {
this.input.sessionTemplate = this._sessionTemplates.find(i => i.name === e.selected);
@@ -304,7 +304,7 @@ export class ProfilerEditor extends BaseEditor {
editorContainer.className = 'profiler-editor';
this._editor.create(new Builder(editorContainer));
this._editor.setVisible(true);
this._editorInput = this._instantiationService.createInstance(UntitledEditorInput, URI.from({ scheme: UNTITLED_SCHEMA }), false, 'sql', '', '');
this._editorInput = this._instantiationService.createInstance(UntitledEditorInput, URI.from({ scheme: Schemas.untitled }), false, 'sql', '', '');
this._editor.setInput(this._editorInput, undefined);
this._editorInput.resolve().then(model => this._editorModel = model.textEditorModel);
return editorContainer;

View File

@@ -11,7 +11,6 @@ import { IEditorCloseEvent } from 'vs/workbench/common/editor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IQuickOpenService, IPickOpenEntry } from 'vs/platform/quickOpen/common/quickOpen';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Action } from 'vs/base/common/actions';
import errors = require('vs/base/common/errors');
@@ -23,6 +22,8 @@ import { IConnectionManagementService } from 'sql/parts/connection/common/connec
import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
import { DidChangeLanguageFlavorParams } from 'sqlops';
import Severity from 'vs/base/common/severity';
import { INotificationService } from 'vs/platform/notification/common/notification';
export interface ISqlProviderEntry extends IPickOpenEntry {
providerId: string;
@@ -173,7 +174,7 @@ export class ChangeFlavorAction extends Action {
actionLabel: string,
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
@IQuickOpenService private _quickOpenService: IQuickOpenService,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
) {
super(actionId, actionLabel);
@@ -213,7 +214,11 @@ export class ChangeFlavorAction extends Action {
}
private _showMessage(sev: Severity, message: string): TPromise<any> {
this._messageService.show(sev, message);
this._notificationService.notify({
severity: sev,
message: message
});
return TPromise.as(undefined);
}
}

View File

@@ -136,7 +136,7 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
public resolve(refresh?: boolean): TPromise<EditorModel> { return this._sql.resolve(); }
public save(): TPromise<boolean> { return this._sql.save(); }
public isDirty(): boolean { return this._sql.isDirty(); }
public confirmSave(): ConfirmResult { return this._sql.confirmSave(); }
public confirmSave(): TPromise<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(); }

View File

@@ -13,7 +13,6 @@ import { ISaveRequest, SaveFormat } from 'sql/parts/grid/common/interfaces';
import * as PathUtilities from 'sql/common/pathUtilities';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IOutputService, IOutputChannel, IOutputChannelRegistry, Extensions as OutputExtensions } from 'vs/workbench/parts/output/common/output';
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -21,13 +20,16 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
import { Registry } from 'vs/platform/registry/common/platform';
import URI from 'vs/base/common/uri';
import { IUntitledEditorService, UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { Schemas } from 'vs/base/common/network';
import * as paths from 'vs/base/common/paths';
import * as nls from 'vs/nls';
import * as pretty from 'pretty-data';
import { ISlickRange } from 'angular2-slickgrid';
import * as path from 'path';
import Severity from 'vs/base/common/severity';
import { INotificationService } from 'vs/platform/notification/common/notification';
let prevSavePath: string;
@@ -43,7 +45,6 @@ export class ResultSerializer {
constructor(
@IInstantiationService private _instantiationService: IInstantiationService,
@IMessageService private _messageService: IMessageService,
@IOutputService private _outputService: IOutputService,
@IQueryManagementService private _queryManagementService: IQueryManagementService,
@IWorkspaceConfigurationService private _workspaceConfigurationService: IWorkspaceConfigurationService,
@@ -51,7 +52,8 @@ export class ResultSerializer {
@IWorkspaceContextService private _contextService: IWorkspaceContextService,
@IWindowsService private _windowsService: IWindowsService,
@IWindowService private _windowService: IWindowService,
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService,
@INotificationService private _notificationService: INotificationService
) { }
/**
@@ -62,11 +64,12 @@ export class ResultSerializer {
this._uri = uri;
// prompt for filepath
let filePath = self.promptForFilepath(saveRequest);
if (filePath) {
return self.sendRequestToService(filePath, saveRequest.batchIndex, saveRequest.resultSetNumber, saveRequest.format, saveRequest.selection ? saveRequest.selection[0] : undefined);
}
return Promise.resolve(undefined);
return self.promptForFilepath(saveRequest).then(filePath => {
if (filePath) {
return self.sendRequestToService(filePath, saveRequest.batchIndex, saveRequest.resultSetNumber, saveRequest.format, saveRequest.selection ? saveRequest.selection[0] : undefined);
}
return Promise.resolve(undefined);
});
}
/**
@@ -103,7 +106,7 @@ export class ResultSerializer {
private getUntitledFileUri(columnName: string): URI {
let fileName = columnName;
let uri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: fileName });
let uri: URI = URI.from({ scheme: Schemas.untitled, path: fileName });
// If the current filename is taken, try another up to a max number
if (this._untitledEditorService.exists(uri)) {
@@ -111,7 +114,7 @@ export class ResultSerializer {
while (i < ResultSerializer.MAX_FILENAMES
&& this._untitledEditorService.exists(uri)) {
fileName = [columnName, i.toString()].join('-');
uri = URI.from({ scheme: UNTITLED_SCHEMA, path: fileName });
uri = URI.from({ scheme: Schemas.untitled, path: fileName });
i++;
}
if (this._untitledEditorService.exists(uri)) {
@@ -140,16 +143,16 @@ export class ResultSerializer {
this.outputChannel.append(message);
}
private promptForFilepath(saveRequest: ISaveRequest): string {
private promptForFilepath(saveRequest: ISaveRequest): Thenable<string> {
let filepathPlaceHolder = (prevSavePath) ? prevSavePath : PathUtilities.resolveCurrentDirectory(this._uri, this.rootPath);
filepathPlaceHolder = path.join(filepathPlaceHolder, this.getResultsDefaultFilename(saveRequest));
let filePath: string = this._windowService.showSaveDialog({
return this._windowService.showSaveDialog({
title: nls.localize('resultsSerializer.saveAsFileTitle', 'Choose Results File'),
defaultPath: paths.normalize(filepathPlaceHolder, true)
}).then(filePath => {
prevSavePath = filePath;
return Promise.resolve(filePath);
});
prevSavePath = filePath;
return filePath;
}
private getResultsDefaultFilename(saveRequest: ISaveRequest): string {
@@ -249,10 +252,16 @@ export class ResultSerializer {
// send message to the sqlserverclient for converting results to the requested format and saving to filepath
return this._queryManagementService.saveResults(saveResultsParams).then(result => {
if (result.messages) {
this._messageService.show(Severity.Error, LocalizedConstants.msgSaveFailed + result.messages);
this._notificationService.notify({
severity: Severity.Error,
message: LocalizedConstants.msgSaveFailed + result.messages
});
this.logToOutputChannel(LocalizedConstants.msgSaveFailed + result.messages);
} else {
this._messageService.show(Severity.Info, LocalizedConstants.msgSaveSucceeded + this._filePath);
this._notificationService.notify({
severity: Severity.Info,
message: LocalizedConstants.msgSaveSucceeded + this._filePath
});
this.logToOutputChannel(LocalizedConstants.msgSaveSucceeded + filePath);
this.openSavedFile(this._filePath, format);
}
@@ -260,7 +269,10 @@ export class ResultSerializer {
// Telemetry.sendTelemetryEvent('SavedResults', { 'type': format });
}, error => {
this._messageService.show(Severity.Error, LocalizedConstants.msgSaveFailed + error);
this._notificationService.notify({
severity: Severity.Error,
message: LocalizedConstants.msgSaveFailed + error
});
this.logToOutputChannel(LocalizedConstants.msgSaveFailed + error);
});
}
@@ -280,7 +292,10 @@ export class ResultSerializer {
this._editorService.openEditor({ resource: uri }).then((result) => {
}, (error: any) => {
this._messageService.show(Severity.Error, error);
this._notificationService.notify({
severity: Severity.Error,
message: error
});
});
}
}
@@ -296,7 +311,10 @@ export class ResultSerializer {
(success) => {
},
(error: any) => {
this._messageService.show(Severity.Error, error);
this._notificationService.notify({
severity: Severity.Error,
message: error
});
}
);
}

View File

@@ -11,7 +11,6 @@ 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 { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ISelectionData } from 'sqlops';
@@ -24,6 +23,8 @@ import {
} from 'sql/parts/connection/common/connectionManagement';
import { QueryEditor } from 'sql/parts/query/editor/queryEditor';
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
/**
* Action class that query-based Actions will extend. This base class automatically handles activating and
@@ -436,7 +437,7 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem
private _editor: QueryEditor,
private _action: ListDatabasesAction,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IContextViewService contextViewProvider: IContextViewService,
@IThemeService themeService: IThemeService
) {
@@ -514,14 +515,19 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem
result => {
if (!result) {
this.resetDatabaseName();
this._messageService.show(Severity.Error, nls.localize('changeDatabase.failed', "Failed to change database"));
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('changeDatabase.failed', "Failed to change database")
});
}
},
error => {
this.resetDatabaseName();
this._messageService.show(Severity.Error, nls.localize('changeDatabase.failedWithError', "Failed to change database {0}", error));
}
);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('changeDatabase.failedWithError', "Failed to change database {0}", error)
});
});
}
private getCurrentDatabaseName() {

View File

@@ -21,11 +21,12 @@ import * as nls from 'vs/nls';
import * as statusbar from 'vs/workbench/browser/parts/statusbar/statusbar';
import * as platform from 'vs/platform/registry/common/platform';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import Event, { Emitter } from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import * as strings from 'vs/base/common/strings';
import * as types from 'vs/base/common/types';
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
const selectionSnippetMaxLen = 100;
@@ -76,7 +77,7 @@ export class QueryModelService implements IQueryModelService {
// CONSTRUCTOR /////////////////////////////////////////////////////////
constructor(
@IInstantiationService private _instantiationService: IInstantiationService,
@IMessageService private _messageService: IMessageService
@INotificationService private _notificationService: INotificationService
) {
this._queryInfoMap = new Map<string, QueryInfo>();
this._onRunQueryStart = new Emitter<string>();
@@ -179,7 +180,10 @@ export class QueryModelService implements IQueryModelService {
}
public showCommitError(error: string): void {
this._messageService.show(Severity.Error, nls.localize('commitEditFailed', 'Commit row failed: ') + error);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('commitEditFailed', 'Commit row failed: ') + error
});
}
public isRunningQuery(uri: string): boolean {
@@ -330,7 +334,10 @@ export class QueryModelService implements IQueryModelService {
queryRunner.cancelQuery().then(success => undefined, error => {
// On error, show error message and notify that the query is complete so that buttons and other status indicators
// can be correct
this._messageService.show(Severity.Error, strings.format(LocalizedConstants.msgCancelQueryFailed, error));
this._notificationService.notify({
severity: Severity.Error,
message: strings.format(LocalizedConstants.msgCancelQueryFailed, error)
});
this._fireQueryEvent(queryRunner.uri, 'complete', 0);
});
@@ -427,7 +434,10 @@ export class QueryModelService implements IQueryModelService {
let queryRunner = this._getQueryRunner(ownerUri);
if (queryRunner) {
return queryRunner.updateCell(ownerUri, rowId, columnId, newValue).then((result) => result, error => {
this._messageService.show(Severity.Error, nls.localize('updateCellFailed', 'Update cell failed: ') + error.message);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('updateCellFailed', 'Update cell failed: ') + error.message
});
return Promise.reject(error);
});
}
@@ -439,7 +449,10 @@ export class QueryModelService implements IQueryModelService {
let queryRunner = this._getQueryRunner(ownerUri);
if (queryRunner) {
return queryRunner.commitEdit(ownerUri).then(() => { }, error => {
this._messageService.show(Severity.Error, nls.localize('commitEditFailed', 'Commit row failed: ') + error.message);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('commitEditFailed', 'Commit row failed: ') + error.message
});
return Promise.reject(error);
});
}

View File

@@ -13,7 +13,6 @@ import { IQueryManagementService } from 'sql/parts/query/common/queryManagement'
import { ISlickRange } from 'angular2-slickgrid';
import * as Utils from 'sql/parts/connection/common/utils';
import { IMessageService } from 'vs/platform/message/common/message';
import Severity from 'vs/base/common/severity';
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
import * as nls from 'vs/nls';
@@ -21,6 +20,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
import * as types from 'vs/base/common/types';
import { EventEmitter } from 'sql/base/common/eventEmitter';
import { IDisposable } from 'vs/base/common/lifecycle';
import { INotificationService } from 'vs/platform/notification/common/notification';
export interface IEditSessionReadyEvent {
ownerUri: string;
@@ -66,7 +66,7 @@ export default class QueryRunner {
public uri: string,
public title: string,
@IQueryManagementService private _queryManagementService: IQueryManagementService,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IWorkspaceConfigurationService private _workspaceConfigurationService: IWorkspaceConfigurationService,
@IClipboardService private _clipboardService: IClipboardService
) { }
@@ -288,7 +288,10 @@ export default class QueryRunner {
self._queryManagementService.getQueryRows(rowData).then(result => {
resolve(result);
}, error => {
self._messageService.show(Severity.Error, nls.localize('query.gettingRowsFailedError', 'Something went wrong getting more rows: {0}', error));
self._notificationService.notify({
severity: Severity.Error,
message: nls.localize('query.gettingRowsFailedError', 'Something went wrong getting more rows: {0}', error)
});
reject(error);
});
});
@@ -312,8 +315,10 @@ export default class QueryRunner {
// TODO issue #228 add statusview callbacks here
this._isExecuting = false;
this._messageService.show(Severity.Error, nls.localize('query.initEditExecutionFailed', 'Init Edit Execution failed: ') + error);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('query.initEditExecutionFailed', 'Init Edit Execution failed: ') + error
});
});
}
@@ -334,13 +339,19 @@ export default class QueryRunner {
self._queryManagementService.getEditRows(rowData).then(result => {
if (!result.hasOwnProperty('rowCount')) {
let error = `Nothing returned from subset query`;
self._messageService.show(Severity.Error, error);
self._notificationService.notify({
severity: Severity.Error,
message: error
});
reject(error);
}
resolve(result);
}, error => {
let errorMessage = nls.localize('query.moreRowsFailedError', 'Something went wrong getting more rows:');
self._messageService.show(Severity.Error, `${errorMessage} ${error}`);
self._notificationService.notify({
severity: Severity.Error,
message: `${errorMessage} ${error}`
});
reject(error);
});
});

View File

@@ -14,20 +14,21 @@ import { sqlModeId, untitledFilePrefix, getSupportedInputResource } from 'sql/pa
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
import { IMode } from 'vs/editor/common/modes';
import { IModel } from 'vs/editor/common/editorCommon';
import { ITextModel } from 'vs/editor/common/model';
import { IEditor, IEditorInput, Position } from 'vs/platform/editor/common/editor';
import { CodeEditor } from 'vs/editor/browser/codeEditor';
import { IEditorGroup } from 'vs/workbench/common/editor';
import { IUntitledEditorService, UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
import { IMessageService } from 'vs/platform/message/common/message';
import Severity from 'vs/base/common/severity';
import nls = require('vs/nls');
import URI from 'vs/base/common/uri';
import paths = require('vs/base/common/paths');
import { isLinux } from 'vs/base/common/platform';
import { Schemas } from 'vs/base/common/network';
import { INotificationService } from 'vs/platform/notification/common/notification';
const fs = require('fs');
@@ -52,20 +53,20 @@ export class QueryEditorService implements IQueryEditorService {
private static editorService: IWorkbenchEditorService;
private static instantiationService: IInstantiationService;
private static editorGroupService: IEditorGroupService;
private static messageService: IMessageService;
private static notificationService: INotificationService;
constructor(
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
@IEditorGroupService private _editorGroupService: IEditorGroupService,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
) {
QueryEditorService.editorService = _editorService;
QueryEditorService.instantiationService = _instantiationService;
QueryEditorService.editorGroupService = _editorGroupService;
QueryEditorService.messageService = _messageService;
QueryEditorService.notificationService = _notificationService;
}
////// Public functions
@@ -78,7 +79,7 @@ export class QueryEditorService implements IQueryEditorService {
try {
// Create file path and file URI
let filePath = this.createUntitledSqlFilePath();
let docUri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: filePath });
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
// Create a sql document pane with accoutrements
const fileInput = this._untitledEditorService.createOrGet(docUri, 'sql');
@@ -126,7 +127,7 @@ export class QueryEditorService implements IQueryEditorService {
// Create file path and file URI
let objectName = schemaName ? schemaName + '.' + tableName : tableName;
let filePath = this.createEditDataFileName(objectName);
let docUri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: filePath });
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
// Create an EditDataInput for editing
let editDataInput: EditDataInput = this._instantiationService.createInstance(EditDataInput, docUri, schemaName, tableName);
@@ -192,7 +193,7 @@ export class QueryEditorService implements IQueryEditorService {
* In all other cases (when SQL is involved in the language change and the editor is not dirty),
* returns a promise that will resolve when the old editor has been replaced by a new editor.
*/
public static sqlLanguageModeCheck(model: IModel, mode: IMode, editor: IEditor): Promise<IModel> {
public static sqlLanguageModeCheck(model: ITextModel, mode: IMode, editor: IEditor): Promise<ITextModel> {
if (!model || !mode || !editor) {
return Promise.resolve(undefined);
}
@@ -211,16 +212,22 @@ export class QueryEditorService implements IQueryEditorService {
}
let uri: URI = QueryEditorService._getEditorChangeUri(editor.input, changingToSql);
if(uri.scheme === UNTITLED_SCHEMA && editor.input instanceof QueryInput)
if(uri.scheme === Schemas.untitled && editor.input instanceof QueryInput)
{
QueryEditorService.messageService.show(Severity.Error, QueryEditorService.CHANGE_UNSUPPORTED_ERROR_MESSAGE);
QueryEditorService.notificationService.notify({
severity: Severity.Error,
message: QueryEditorService.CHANGE_UNSUPPORTED_ERROR_MESSAGE
});
return Promise.resolve(undefined);
}
// Return undefined to notify the calling funciton to not perform the language change
// TODO change this - tracked by issue #727
if (editor.input.isDirty()) {
QueryEditorService.messageService.show(Severity.Error, QueryEditorService.CHANGE_ERROR_MESSAGE);
QueryEditorService.notificationService.notify({
severity: Severity.Error,
message: QueryEditorService.CHANGE_ERROR_MESSAGE
});
return Promise.resolve(undefined);
}
@@ -232,7 +239,7 @@ export class QueryEditorService implements IQueryEditorService {
options.pinned = group.isPinned(index);
// Return a promise that will resovle when the old editor has been replaced by a new editor
return new Promise<IModel>((resolve, reject) => {
return new Promise<ITextModel>((resolve, reject) => {
let newEditorInput = QueryEditorService._getNewEditorInput(changingToSql, editor.input, uri);
// Override queryEditorCheck to not open this file in a QueryEditor
@@ -344,7 +351,7 @@ export class QueryEditorService implements IQueryEditorService {
/**
* Handle all cleanup actions that need to wait until the editor is fully open.
*/
private static _onEditorOpened(editor: IEditor, uri: string, position: Position, isPinned: boolean): IModel {
private static _onEditorOpened(editor: IEditor, uri: string, position: Position, isPinned: boolean): ITextModel {
// Reset the editor pin state
// TODO: change this so it happens automatically in openEditor in sqlLanguageModeCheck. Performing this here

View File

@@ -148,18 +148,18 @@ export class ServerGroupDialog extends Modal {
this._colorCheckBoxesMap[this._selectedColorOption].checkbox.focus();
} else if (this.isFocusOnColors()) {
this._addServerButton.enabled ? this._addServerButton.focus() : this._closeButton.focus();
} else if (document.activeElement === this._addServerButton.getElement()) {
} else if (document.activeElement === this._addServerButton.element) {
this._closeButton.focus();
}
else if (document.activeElement === this._closeButton.getElement()) {
else if (document.activeElement === this._closeButton.element) {
this._groupNameInputBox.focus();
}
}
private focusPrevious(): void {
if (document.activeElement === this._closeButton.getElement()) {
if (document.activeElement === this._closeButton.element) {
this._addServerButton.enabled ? this._addServerButton.focus() : this._colorCheckBoxesMap[this._selectedColorOption].checkbox.focus();
} else if (document.activeElement === this._addServerButton.getElement()) {
} else if (document.activeElement === this._addServerButton.element) {
this._colorCheckBoxesMap[this._selectedColorOption].checkbox.focus();
} else if (this.isFocusOnColors()) {
this._groupDescriptionInputBox.focus();

View File

@@ -17,7 +17,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { attachInputBoxStyler } from 'vs/platform/theme/common/styler';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService } from 'vs/platform/message/common/message';
import { isPromiseCanceledError } from 'vs/base/common/errors';
import Severity from 'vs/base/common/severity';
import { IConnectionsViewlet, IConnectionManagementService, VIEWLET_ID } from 'sql/parts/connection/common/connectionManagement';
@@ -27,6 +26,8 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { ClearSearchAction, AddServerAction, AddServerGroupAction, ActiveConnectionsFilterAction } from 'sql/parts/registeredServer/viewlet/connectionTreeAction';
import { warn } from 'sql/base/common/log';
import { IObjectExplorerService } from 'sql/parts/registeredServer/common/objectExplorerService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { INotificationService } from 'vs/platform/notification/common/notification';
export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
@@ -49,10 +50,12 @@ export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
@IConnectionManagementService private connectionManagementService: IConnectionManagementService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IViewletService private viewletService: IViewletService,
@IMessageService private messageService: IMessageService,
@IObjectExplorerService private objectExplorerService: IObjectExplorerService
@INotificationService private _notificationService: INotificationService,
@IObjectExplorerService private objectExplorerService: IObjectExplorerService,
@IPartService partService: IPartService
) {
super(VIEWLET_ID, telemetryService, _themeService);
super(VIEWLET_ID, partService, telemetryService, _themeService);
this._searchDelayer = new ThrottledDelayer(500);
this._clearSearchAction = this._instantiationService.createInstance(ClearSearchAction, ClearSearchAction.ID, ClearSearchAction.LABEL, this);
@@ -71,7 +74,10 @@ export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
if (isPromiseCanceledError(err)) {
return;
}
this.messageService.show(Severity.Error, err);
this._notificationService.notify({
severity: Severity.Error,
message: err
});
}
public create(parent: Builder): TPromise<void> {

View File

@@ -10,10 +10,10 @@ import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import Event, { Emitter } from 'vs/base/common/event';
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { IChoiceService } from 'vs/platform/message/common/message';
import { localize } from 'vs/nls';
import Severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base';
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
export const SERVICE_ID = 'taskHistoryService';
export const ITaskService = createDecorator<ITaskService>(SERVICE_ID);

View File

@@ -14,12 +14,13 @@ import { toggleClass } from 'vs/base/browser/dom';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService } from 'vs/platform/message/common/message';
import { isPromiseCanceledError } from 'vs/base/common/errors';
import Severity from 'vs/base/common/severity';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { TaskHistoryView } from 'sql/parts/taskHistory/viewlet/taskHistoryView';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { INotificationService } from 'vs/platform/notification/common/notification';
export const VIEWLET_ID = 'workbench.view.taskHistory';
@@ -35,16 +36,20 @@ export class TaskHistoryViewlet extends Viewlet {
@IConnectionManagementService private connectionManagementService: IConnectionManagementService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IViewletService private viewletService: IViewletService,
@IMessageService private messageService: IMessageService
@INotificationService private _notificationService: INotificationService,
@IPartService partService: IPartService
) {
super(VIEWLET_ID, telemetryService, themeService);
super(VIEWLET_ID, partService, telemetryService, themeService);
}
private onError(err: any): void {
if (isPromiseCanceledError(err)) {
return;
}
this.messageService.show(Severity.Error, err);
this._notificationService.notify({
severity: Severity.Error,
message: err
});
}
public create(parent: Builder): TPromise<void> {

View File

@@ -8,6 +8,7 @@
import { IClipboardService } from 'sql/platform/clipboard/common/clipboardService';
import { IClipboardService as vsIClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { clipboard, nativeImage } from 'electron';
import URI from 'vs/base/common/uri';
export class ClipboardService implements IClipboardService {
_serviceBrand: any;
@@ -47,4 +48,25 @@ export class ClipboardService implements IClipboardService {
writeFindText(text: string): void {
this._vsClipboardService.writeFindText(text);
}
/**
* Writes files to the system clipboard.
*/
writeFiles(files: URI[]): void {
this._vsClipboardService.writeFiles(files);
}
/**
* Reads files from the system clipboard.
*/
readFiles(): URI[] {
return this._vsClipboardService.readFiles();
}
/**
* Find out if files are copied to the clipboard.
*/
hasFiles(): boolean {
return this._vsClipboardService.hasFiles();
}
}

View File

@@ -8,7 +8,7 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtension } from 'vs
import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';
import { deepClone } from 'vs/base/common/objects';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { ProviderProperties } from 'sql/parts/dashboard/widgets/properties/propertiesWidget.component';
import { DATABASE_DASHBOARD_TABS } from 'sql/parts/dashboard/pages/databaseDashboardPage.contribution';

View File

@@ -22,20 +22,21 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands';
export interface ITaskOptions {
id: string;
title: string;
iconClass: string;
iconPath: { dark: string; light: string; };
description?: ITaskHandlerDescription;
}
export abstract class Task {
public readonly id: string;
public readonly title: string;
public readonly iconClass: string;
public readonly iconPathDark: string;
public readonly iconPath: { dark: string; light: string; };
private readonly _description: ITaskHandlerDescription;
constructor(opts: ITaskOptions) {
this.id = opts.id;
this.title = opts.title;
this.iconClass = opts.iconClass;
this.iconPath = opts.iconPath;
this._description = opts.description;
}
@@ -49,7 +50,7 @@ export abstract class Task {
private toCommandAction(): ICommandAction {
return {
iconClass: this.iconClass,
iconPath: this.iconPath,
id: this.id,
title: this.title
};

View File

@@ -33,7 +33,6 @@ import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/work
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IMessageService } from 'vs/platform/message/common/message';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IAccountManagementService } from 'sql/services/accountManagement/interfaces';
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
@@ -42,6 +41,8 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { ConfigurationEditingService } from 'vs/workbench/services/configuration/node/configurationEditingService';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
export const BOOTSTRAP_SERVICE_ID = 'bootstrapService';
export const IBootstrapService = createDecorator<IBootstrapService>(BOOTSTRAP_SERVICE_ID);
@@ -78,7 +79,7 @@ export interface IBootstrapService {
insightsDialogService: IInsightsDialogService;
contextViewService: IContextViewService;
restoreDialogService: IRestoreDialogController;
messageService: IMessageService;
notificationService: INotificationService;
workspaceContextService: IWorkspaceContextService;
accountManagementService: IAccountManagementService;
windowsService: IWindowsService;
@@ -94,6 +95,7 @@ export interface IBootstrapService {
commandService: ICommandService;
dashboardWebviewService: IDashboardWebviewService;
jobManagementService: IJobManagementService;
environmentService: IEnvironmentService;
/*
* Bootstraps the Angular module described. Components that need singleton services should inject the

View File

@@ -37,7 +37,6 @@ import { IEditorInput } from 'vs/platform/editor/common/editor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from './bootstrapService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IMessageService } from 'vs/platform/message/common/message';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IAccountManagementService } from 'sql/services/accountManagement/interfaces';
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
@@ -46,6 +45,8 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { ConfigurationEditingService } from 'vs/workbench/services/configuration/node/configurationEditingService';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
export class BootstrapService implements IBootstrapService {
@@ -88,7 +89,7 @@ export class BootstrapService implements IBootstrapService {
@IConfigurationService public configurationService: IConfigurationService,
@IInsightsDialogService public insightsDialogService: IInsightsDialogService,
@IContextViewService public contextViewService: IContextViewService,
@IMessageService public messageService: IMessageService,
@INotificationService public notificationService: INotificationService,
@IWorkspaceContextService public workspaceContextService: IWorkspaceContextService,
@IAccountManagementService public accountManagementService: IAccountManagementService,
@IWindowsService public windowsService: IWindowsService,
@@ -102,7 +103,8 @@ export class BootstrapService implements IBootstrapService {
@ICapabilitiesService public capabilitiesService: ICapabilitiesService,
@ICommandService public commandService: ICommandService,
@IDashboardWebviewService public dashboardWebviewService: IDashboardWebviewService,
@IJobManagementService public jobManagementService: IJobManagementService
@IJobManagementService public jobManagementService: IJobManagementService,
@IEnvironmentService public environmentService: IEnvironmentService
) {
this.configurationEditorService = this.instantiationService.createInstance(ConfigurationEditingService);
this._bootstrapParameterMap = new Map<string, BootstrapParams>();

View File

@@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
@@ -17,7 +17,7 @@ export class MainThreadDashboard implements MainThreadDashboardShape {
context: IExtHostContext,
@IDashboardService private _dashboardService: IDashboardService
) {
this._proxy = context.get(SqlExtHostContext.ExtHostDashboard);
this._proxy = context.getProxy(SqlExtHostContext.ExtHostDashboard);
_dashboardService.onDidChangeToDashboard(e => {
this._proxy.$onDidChangeToDashboard(e);
});

View File

@@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { WebViewDialog } from 'sql/base/browser/ui/modal/webViewDialog';
@@ -22,7 +22,7 @@ export class MainThreadModalDialog implements MainThreadModalDialogShape {
@IWorkbenchEditorService private readonly _editorService: IWorkbenchEditorService,
@IInstantiationService private readonly _instantiationService: IInstantiationService
) {
this._proxy = context.get(SqlExtHostContext.ExtHostModalDialogs);
this._proxy = context.getProxy(SqlExtHostContext.ExtHostModalDialogs);
}
dispose(): void {

View File

@@ -32,7 +32,7 @@ export class MainThreadTasks implements MainThreadTasksShape {
constructor(
extHostContext: IExtHostContext
) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostTasks);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostTasks);
}
dispose() {

View File

@@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';

View File

@@ -7,22 +7,22 @@
import * as sqlops from 'sqlops';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { Disposable } from 'vs/workbench/api/node/extHostTypes';
import {
ExtHostAccountManagementShape,
MainThreadAccountManagementShape,
SqlMainContext,
} from 'sql/workbench/api/node/sqlExtHost.protocol';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
export class ExtHostAccountManagement extends ExtHostAccountManagementShape {
private _handlePool: number = 0;
private _proxy: MainThreadAccountManagementShape;
private _providers: { [handle: number]: AccountProviderWithMetadata } = {};
constructor(threadService: IThreadService) {
constructor(mainContext: IMainContext) {
super();
this._proxy = threadService.get(SqlMainContext.MainThreadAccountManagement);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadAccountManagement);
}
// PUBLIC METHODS //////////////////////////////////////////////////////

View File

@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { ExtHostConnectionManagementShape, SqlMainContext, MainThreadConnectionManagementShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import * as sqlops from 'sqlops';
export class ExtHostConnectionManagement extends ExtHostConnectionManagementShape {
@@ -13,10 +13,10 @@ export class ExtHostConnectionManagement extends ExtHostConnectionManagementShap
private _proxy: MainThreadConnectionManagementShape;
constructor(
threadService: IThreadService
mainContext: IMainContext
) {
super();
this._proxy = threadService.get(SqlMainContext.MainThreadConnectionManagement);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadConnectionManagement);
}
public $getActiveConnections(): Thenable<sqlops.connection.Connection[]> {

View File

@@ -5,7 +5,7 @@
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import { SqlMainContext, MainThreadCredentialManagementShape, ExtHostCredentialManagementShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import * as vscode from 'vscode';
import * as sqlops from 'sqlops';
@@ -41,12 +41,12 @@ export class ExtHostCredentialManagement extends ExtHostCredentialManagementShap
private _registrationPromise: Promise<void>;
private _registrationPromiseResolve;
constructor(threadService: IThreadService) {
constructor(mainContext: IMainContext) {
super();
let self = this;
this._proxy = threadService.get(SqlMainContext.MainThreadCredentialManagement);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadCredentialManagement);
// Create a promise to resolve when a credential provider has been registered.
// HACK: this gives us a deferred promise

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import Event, { Emitter } from 'vs/base/common/event';
import * as sqlops from 'sqlops';
@@ -20,8 +20,8 @@ export class ExtHostDashboard implements ExtHostDashboardShape {
private _proxy: MainThreadDashboardShape;
constructor(threadService: IThreadService) {
this._proxy = threadService.get(SqlMainContext.MainThreadDashboard);
constructor(mainContext: IMainContext) {
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadDashboard);
}
$onDidOpenDashboard(dashboard: sqlops.DashboardDocument) {

View File

@@ -67,7 +67,7 @@ export class ExtHostDashboardWebviews implements ExtHostDashboardWebviewsShape {
constructor(
mainContext: IMainContext
) {
this._proxy = mainContext.get(SqlMainContext.MainThreadDashboardWebview);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadDashboardWebview);
}
$onMessage(handle: number, message: any): void {

View File

@@ -5,7 +5,7 @@
'use strict';
import Event, { Emitter } from 'vs/base/common/event';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import { SqlMainContext, MainThreadDataProtocolShape, ExtHostDataProtocolShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import * as vscode from 'vscode';
import * as sqlops from 'sqlops';
@@ -23,10 +23,10 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
private _adapter = new Map<number, sqlops.DataProvider>();
constructor(
threadService: IThreadService
mainContext: IMainContext
) {
super();
this._proxy = threadService.get(SqlMainContext.MainThreadDataProtocol);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadDataProtocol);
}
private _createDisposable(handle: number): Disposable {

View File

@@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
@@ -92,7 +92,7 @@ export class ExtHostModalDialogs implements ExtHostModalDialogsShape {
constructor(
mainContext: IMainContext
) {
this._proxy = mainContext.get(SqlMainContext.MainThreadModalDialog);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadModalDialog);
}
createDialog(

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import { ExtHostObjectExplorerShape, SqlMainContext, MainThreadObjectExplorerShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import * as sqlops from 'sqlops';
import * as vscode from 'vscode';
@@ -14,9 +14,9 @@ export class ExtHostObjectExplorer implements ExtHostObjectExplorerShape {
private _proxy: MainThreadObjectExplorerShape;
constructor(
threadService: IThreadService
mainContext: IMainContext
) {
this._proxy = threadService.get(SqlMainContext.MainThreadObjectExplorer);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadObjectExplorer);
}
public $getNode(connectionId: string, nodePath?: string): Thenable<sqlops.objectexplorer.ObjectExplorerNode> {

View File

@@ -7,7 +7,7 @@
import * as sqlops from 'sqlops';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import { Disposable } from 'vs/workbench/api/node/extHostTypes';
import {
ExtHostResourceProviderShape,
@@ -20,9 +20,9 @@ export class ExtHostResourceProvider extends ExtHostResourceProviderShape {
private _proxy: MainThreadResourceProviderShape;
private _providers: { [handle: number]: ResourceProviderWithMetadata } = {};
constructor(threadService: IThreadService) {
constructor(mainContext: IMainContext) {
super();
this._proxy = threadService.get(SqlMainContext.MainThreadResourceProvider);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadResourceProvider);
}
// PUBLIC METHODS //////////////////////////////////////////////////////

View File

@@ -5,7 +5,7 @@
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import { SqlMainContext, MainThreadSerializationProviderShape, ExtHostSerializationProviderShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import * as vscode from 'vscode';
import * as sqlops from 'sqlops';
@@ -53,10 +53,10 @@ export class ExtHostSerializationProvider extends ExtHostSerializationProviderSh
}
constructor(
threadService: IThreadService
mainContext: IMainContext
) {
super();
this._proxy = threadService.get(SqlMainContext.MainThreadSerializationProvider);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadSerializationProvider);
}
public $registerSerializationProvider(provider: sqlops.SerializationProvider): vscode.Disposable {

View File

@@ -29,7 +29,7 @@ export class ExtHostTasks implements ExtHostTasksShape {
mainContext: IMainContext,
private logService: ILogService
) {
this._proxy = mainContext.get(SqlMainContext.MainThreadTasks);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadTasks);
}
registerTask(id: string, callback: sqlops.tasks.ITaskHandler, thisArg?: any, description?: ITaskHandlerDescription): extHostTypes.Disposable {

View File

@@ -29,7 +29,7 @@ export class MainThreadAccountManagement implements MainThreadAccountManagementS
) {
this._providerMetadata = {};
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostAccountManagement);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostAccountManagement);
}
this._toDispose = [];
}

View File

@@ -28,7 +28,7 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
@IWorkbenchEditorService private _workbenchEditorService: IWorkbenchEditorService
) {
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostConnectionManagement);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostConnectionManagement);
}
this._toDispose = [];
}

View File

@@ -29,7 +29,7 @@ export class MainThreadCredentialManagement implements MainThreadCredentialManag
@ICredentialsService private credentialService: ICredentialsService
) {
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostCredentialManagement);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostCredentialManagement);
}
}

View File

@@ -22,7 +22,7 @@ export class MainThreadDashboardWebview implements MainThreadDashboardWebviewSha
context: IExtHostContext,
@IDashboardWebviewService webviewService: IDashboardWebviewService
) {
this._proxy = context.get(SqlExtHostContext.ExtHostDashboardWebviews);
this._proxy = context.getProxy(SqlExtHostContext.ExtHostDashboardWebviews);
webviewService.onRegisteredWebview(e => {
if (this.knownWidgets.includes(e.id)) {
let handle = MainThreadDashboardWebview._handlePool++;

View File

@@ -27,7 +27,6 @@ import { ISerializationService } from 'sql/services/serialization/serializationS
import { IFileBrowserService } from 'sql/parts/fileBrowser/common/interfaces';
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
import { IMessageService } from 'vs/platform/message/common/message';
import severity from 'vs/base/common/severity';
/**
@@ -57,11 +56,10 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
@ITaskService private _taskService: ITaskService,
@IProfilerService private _profilerService: IProfilerService,
@ISerializationService private _serializationService: ISerializationService,
@IFileBrowserService private _fileBrowserService: IFileBrowserService,
@IMessageService private _messageService: IMessageService
@IFileBrowserService private _fileBrowserService: IFileBrowserService
) {
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostDataProtocol);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostDataProtocol);
}
if (this._connectionManagementService) {
this._connectionManagementService.onLanguageFlavorChanged(e => this._proxy.$languageFlavorChanged(e), this, this._toDispose);

View File

@@ -29,7 +29,7 @@ export class MainThreadObjectExplorer implements MainThreadObjectExplorerShape {
@IWorkbenchEditorService private _workbenchEditorService: IWorkbenchEditorService
) {
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostObjectExplorer);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostObjectExplorer);
}
this._toDispose = [];
}

View File

@@ -30,7 +30,7 @@ export class MainThreadResourceProvider implements MainThreadResourceProviderSha
) {
this._providerMetadata = {};
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostResourceProvider);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostResourceProvider);
}
this._toDispose = [];
}

View File

@@ -30,7 +30,7 @@ export class MainThreadSerializationProvider implements MainThreadSerializationP
) {
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostSerializationProvider);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostSerializationProvider);
}
}

View File

@@ -7,9 +7,9 @@
import * as extHostApi from 'vs/workbench/api/node/extHost.api.impl';
import { TrieMap } from 'sql/base/common/map';
import { TPromise } from 'vs/base/common/winjs.base';
import { IInitData } from 'vs/workbench/api/node/extHost.protocol';
import { IInitData, IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionService';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
import { realpath } from 'fs';
import * as extHostTypes from 'vs/workbench/api/node/extHostTypes';
@@ -21,17 +21,16 @@ import { ExtHostCredentialManagement } from 'sql/workbench/api/node/extHostCrede
import { ExtHostDataProtocol } from 'sql/workbench/api/node/extHostDataProtocol';
import { ExtHostSerializationProvider } from 'sql/workbench/api/node/extHostSerializationProvider';
import { ExtHostResourceProvider } from 'sql/workbench/api/node/extHostResourceProvider';
import { ExtHostThreadService } from 'vs/workbench/services/thread/node/extHostThreadService';
import * as sqlExtHostTypes from 'sql/workbench/api/common/sqlExtHostTypes';
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
import { ExtHostConfiguration } from 'vs/workbench/api/node/extHostConfiguration';
import { ExtHostModalDialogs } from 'sql/workbench/api/node/extHostModalDialog';
import { ExtHostTasks } from 'sql/workbench/api/node/extHostTasks';
import { ILogService } from 'vs/platform/log/common/log';
import { ExtHostDashboardWebviews } from 'sql/workbench/api/node/extHostDashboardWebview';
import { ExtHostConnectionManagement } from 'sql/workbench/api/node/extHostConnectionManagement';
import { ExtHostDashboard } from 'sql/workbench/api/node/extHostDashboard';
import { ExtHostObjectExplorer } from 'sql/workbench/api/node/extHostObjectExplorer';
import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService';
export interface ISqlExtensionApiFactory {
vsCodeFactory(extension: IExtensionDescription): typeof vscode;
@@ -43,26 +42,26 @@ export interface ISqlExtensionApiFactory {
*/
export function createApiFactory(
initData: IInitData,
threadService: ExtHostThreadService,
rpcProtocol: IExtHostContext,
extHostWorkspace: ExtHostWorkspace,
extHostConfiguration: ExtHostConfiguration,
extensionService: ExtHostExtensionService,
logService: ILogService
logService: ExtHostLogService
): ISqlExtensionApiFactory {
let vsCodeFactory = extHostApi.createApiFactory(initData, threadService, extHostWorkspace, extHostConfiguration, extensionService, logService);
let vsCodeFactory = extHostApi.createApiFactory(initData, rpcProtocol, extHostWorkspace, extHostConfiguration, extensionService, logService);
// Addressable instances
const extHostAccountManagement = threadService.set(SqlExtHostContext.ExtHostAccountManagement, new ExtHostAccountManagement(threadService));
const extHostConnectionManagement = threadService.set(SqlExtHostContext.ExtHostConnectionManagement, new ExtHostConnectionManagement(threadService));
const extHostCredentialManagement = threadService.set(SqlExtHostContext.ExtHostCredentialManagement, new ExtHostCredentialManagement(threadService));
const extHostDataProvider = threadService.set(SqlExtHostContext.ExtHostDataProtocol, new ExtHostDataProtocol(threadService));
const extHostObjectExplorer = threadService.set(SqlExtHostContext.ExtHostObjectExplorer, new ExtHostObjectExplorer(threadService));
const extHostSerializationProvider = threadService.set(SqlExtHostContext.ExtHostSerializationProvider, new ExtHostSerializationProvider(threadService));
const extHostResourceProvider = threadService.set(SqlExtHostContext.ExtHostResourceProvider, new ExtHostResourceProvider(threadService));
const extHostModalDialogs = threadService.set(SqlExtHostContext.ExtHostModalDialogs, new ExtHostModalDialogs(threadService));
const extHostTasks = threadService.set(SqlExtHostContext.ExtHostTasks, new ExtHostTasks(threadService, logService));
const extHostWebviewWidgets = threadService.set(SqlExtHostContext.ExtHostDashboardWebviews, new ExtHostDashboardWebviews(threadService));
const extHostDashboard = threadService.set(SqlExtHostContext.ExtHostDashboard, new ExtHostDashboard(threadService));
const extHostAccountManagement = rpcProtocol.set(SqlExtHostContext.ExtHostAccountManagement, new ExtHostAccountManagement(rpcProtocol));
const extHostConnectionManagement = rpcProtocol.set(SqlExtHostContext.ExtHostConnectionManagement, new ExtHostConnectionManagement(rpcProtocol));
const extHostCredentialManagement = rpcProtocol.set(SqlExtHostContext.ExtHostCredentialManagement, new ExtHostCredentialManagement(rpcProtocol));
const extHostDataProvider = rpcProtocol.set(SqlExtHostContext.ExtHostDataProtocol, new ExtHostDataProtocol(rpcProtocol));
const extHostObjectExplorer = rpcProtocol.set(SqlExtHostContext.ExtHostObjectExplorer, new ExtHostObjectExplorer(rpcProtocol));
const extHostSerializationProvider = rpcProtocol.set(SqlExtHostContext.ExtHostSerializationProvider, new ExtHostSerializationProvider(rpcProtocol));
const extHostResourceProvider = rpcProtocol.set(SqlExtHostContext.ExtHostResourceProvider, new ExtHostResourceProvider(rpcProtocol));
const extHostModalDialogs = rpcProtocol.set(SqlExtHostContext.ExtHostModalDialogs, new ExtHostModalDialogs(rpcProtocol));
const extHostTasks = rpcProtocol.set(SqlExtHostContext.ExtHostTasks, new ExtHostTasks(rpcProtocol, logService));
const extHostWebviewWidgets = rpcProtocol.set(SqlExtHostContext.ExtHostDashboardWebviews, new ExtHostDashboardWebviews(rpcProtocol));
const extHostDashboard = rpcProtocol.set(SqlExtHostContext.ExtHostDashboard, new ExtHostDashboard(rpcProtocol));
return {
vsCodeFactory: vsCodeFactory,

View File

@@ -7,8 +7,8 @@
import {
createMainContextProxyIdentifier as createMainId,
createExtHostContextProxyIdentifier as createExtId,
ProxyIdentifier
} from 'vs/workbench/services/thread/common/threadService';
ProxyIdentifier, IRPCProtocol } from 'vs/workbench/services/extensions/node/proxyIdentifier';
import { TPromise } from 'vs/base/common/winjs.base';
import { IDisposable } from 'vs/base/common/lifecycle';

View File

@@ -48,7 +48,11 @@ export class NewQueryAction extends Task {
public static ICON = 'new-query';
constructor() {
super({ id: NewQueryAction.ID, title: NewQueryAction.LABEL, iconClass: NewQueryAction.ICON });
super({
id: NewQueryAction.ID,
title: NewQueryAction.LABEL,
iconPath: { dark: NewQueryAction.ICON, light: NewQueryAction.ICON }
});
}
public runTask(accessor: ServicesAccessor, profile: IConnectionProfile): TPromise<void> {
@@ -285,7 +289,11 @@ export class BackupAction extends Task {
public static readonly ICON = Constants.BackupFeatureName;
constructor() {
super({ id: BackupAction.ID, title: BackupAction.LABEL, iconClass: BackupAction.ICON });
super({
id: BackupAction.ID,
title: BackupAction.LABEL,
iconPath: { dark: BackupAction.ICON, light: BackupAction.ICON }
});
}
runTask(accessor: ServicesAccessor, profile: IConnectionProfile): TPromise<void> {
@@ -311,7 +319,11 @@ export class RestoreAction extends Task {
public static readonly ICON = Constants.RestoreFeatureName;
constructor() {
super({ id: RestoreAction.ID, title: RestoreAction.LABEL, iconClass: RestoreAction.ICON });
super({
id: RestoreAction.ID,
title: RestoreAction.LABEL,
iconPath: { dark: RestoreAction.ICON, light: RestoreAction.ICON }
});
}
runTask(accessor: ServicesAccessor, profile: IConnectionProfile): TPromise<void> {
@@ -406,7 +418,11 @@ export class ConfigureDashboardAction extends Task {
private static readonly configHelpUri = 'https://aka.ms/sqldashboardconfig';
constructor() {
super({ id: ConfigureDashboardAction.ID, title: ConfigureDashboardAction.LABEL, iconClass: ConfigureDashboardAction.ICON });
super({
id: ConfigureDashboardAction.ID,
title: ConfigureDashboardAction.LABEL,
iconPath: { dark: ConfigureDashboardAction.ICON, light: ConfigureDashboardAction.ICON }
});
}
runTask(accessor: ServicesAccessor): TPromise<void> {

View File

@@ -75,7 +75,7 @@ export class ErrorMessageDialog extends Modal {
let copyButtonLabel = localize('copyDetails', 'Copy details');
this._copyButton = this.addFooterButton(copyButtonLabel, () => this._clipboardService.writeText(this._messageDetails), 'left');
this._copyButton.icon = 'icon scriptToClipboard';
this._copyButton.getElement().title = copyButtonLabel;
this._copyButton.element.title = copyButtonLabel;
this._register(attachButtonStyler(this._copyButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND }));
}
@@ -144,9 +144,9 @@ export class ErrorMessageDialog extends Modal {
this.title = headerTitle;
this._messageDetails = messageDetails;
if (this._messageDetails) {
this._copyButton.getElement().style.visibility = 'visible';
this._copyButton.element.style.visibility = 'visible';
} else {
this._copyButton.getElement().style.visibility = 'hidden';
this._copyButton.element.style.visibility = 'hidden';
}
this.resetActions();
if (actions && actions.length > 0) {
@@ -154,7 +154,7 @@ export class ErrorMessageDialog extends Modal {
this._actions.push(actions[i]);
let button = this._actionButtons[i];
button.label = actions[i].label;
button.getElement().style.visibility = 'visible';
button.element.style.visibility = 'visible';
}
this._okButton.label = this._closeLabel;
} else {
@@ -169,7 +169,7 @@ export class ErrorMessageDialog extends Modal {
private resetActions(): void {
this._actions = [];
for(let actionButton of this._actionButtons) {
actionButton.getElement().style.visibility = 'hidden';
actionButton.element.style.visibility = 'hidden';
}
}

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { localize } from 'vs/nls';
import Event, { Emitter } from 'vs/base/common/event';

View File

@@ -8,7 +8,6 @@
import nls = require('vs/nls');
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions';
import { IMessageService, CloseAction, Severity } from 'vs/platform/message/common/message';
import pkg from 'vs/platform/node/package';
import product from 'vs/platform/node/product';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -19,6 +18,8 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import URI from 'vs/base/common/uri';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { AbstractShowReleaseNotesAction, loadReleaseNotes } from 'vs/workbench/parts/update/electron-browser/update';
import { INotification, INotificationService, INotificationActions } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
export class OpenGettingStartedInBrowserAction extends Action {
@@ -57,7 +58,7 @@ export class ProductContribution implements IWorkbenchContribution {
constructor(
@IStorageService storageService: IStorageService,
@IInstantiationService instantiationService: IInstantiationService,
@IMessageService messageService: IMessageService,
@INotificationService notificationService: INotificationService,
@IWorkbenchEditorService editorService: IWorkbenchEditorService
) {
const lastVersion = storageService.get(ProductContribution.KEY, StorageScope.GLOBAL, '');
@@ -67,12 +68,16 @@ export class ProductContribution implements IWorkbenchContribution {
instantiationService.invokeFunction(loadReleaseNotes, pkg.version).then(
text => editorService.openEditor(instantiationService.createInstance(ReleaseNotesInput, pkg.version, text), { pinned: true }),
() => {
messageService.show(Severity.Info, {
message: nls.localize('read the release notes', "Welcome to {0} March Public Preview! Would you like to view the Getting Started Guide?", product.nameLong, pkg.version),
actions: [
instantiationService.createInstance(OpenGettingStartedInBrowserAction),
CloseAction
const actions: INotificationActions = {
primary: [
instantiationService.createInstance(OpenGettingStartedInBrowserAction)
]
};
notificationService.notify({
severity: Severity.Info,
message: nls.localize('read the release notes', "Welcome to {0} March Public Preview! Would you like to view the Getting Started Guide?", product.nameLong, pkg.version),
actions
});
});
}