Archived
Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
This commit is contained in:
+7
-6
@@ -5,12 +5,8 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
if (process.argv.indexOf('--prof-startup') >= 0) {
|
||||
var profiler = require('v8-profiler');
|
||||
var prefix = require('crypto').randomBytes(2).toString('hex');
|
||||
process.env.VSCODE_PROFILES_PREFIX = prefix;
|
||||
profiler.startProfiling('main', true);
|
||||
}
|
||||
var perf = require('./vs/base/common/performance');
|
||||
perf.mark('main:started');
|
||||
|
||||
// Perf measurements
|
||||
global.perfStartTime = Date.now();
|
||||
@@ -119,6 +115,10 @@ function getNLSConfiguration() {
|
||||
}
|
||||
|
||||
function getNodeCachedDataDir() {
|
||||
// flag to disable cached data support
|
||||
if (process.argv.indexOf('--no-cached-data') > 0) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
// IEnvironmentService.isBuilt
|
||||
if (process.env['VSCODE_DEV']) {
|
||||
@@ -218,6 +218,7 @@ var nodeCachedDataDir = getNodeCachedDataDir().then(function (value) {
|
||||
|
||||
// Load our code once ready
|
||||
app.once('ready', function () {
|
||||
perf.mark('main:appReady');
|
||||
global.perfAppReady = Date.now();
|
||||
var nlsConfig = getNLSConfiguration();
|
||||
process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfig);
|
||||
|
||||
@@ -119,7 +119,8 @@ export class Dropdown extends Disposable {
|
||||
|
||||
this._input = new InputBox(this.$input.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
showMessage: false,
|
||||
// @SQLTODO
|
||||
//showMessage: false,
|
||||
validation: v => this._inputValidator(v)
|
||||
},
|
||||
placeholder: this._options.placeholder,
|
||||
|
||||
@@ -339,7 +339,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
let footerButton = $('div.footer-button');
|
||||
let button = new Button(footerButton);
|
||||
button.label = label;
|
||||
button.addListener('click', () => onSelect());
|
||||
button.onDidClick(() => onSelect());
|
||||
if (orientation === 'left') {
|
||||
footerButton.appendTo(this._leftFooter);
|
||||
} else {
|
||||
|
||||
@@ -104,7 +104,7 @@ export class OptionsDialog extends Modal {
|
||||
super.render();
|
||||
attachModalDialogStyler(this, this._themeService);
|
||||
if (this.backButton) {
|
||||
this.backButton.addListener('click', () => this.cancel());
|
||||
this.backButton.onDidClick(() => this.cancel());
|
||||
attachButtonStyler(this.backButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND });
|
||||
}
|
||||
this._okButton = this.addFooterButton(this.okLabel, () => this.ok());
|
||||
|
||||
@@ -14,7 +14,7 @@ import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import data = require('data');
|
||||
import { localize } from 'vs/nls';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ServiceOptionType, ServiceOptionTypeNames } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
|
||||
export interface IOptionElement {
|
||||
optionWidget: any;
|
||||
@@ -30,52 +30,51 @@ export function createOptionElement(option: data.ServiceOption, rowContainer: Bu
|
||||
let inputElement: HTMLElement;
|
||||
let missingErrorMessage = localize('missingRequireField', ' is required.');
|
||||
let invalidInputMessage = localize('invalidInput', 'Invalid input. Numeric value expected.');
|
||||
switch (option.valueType) {
|
||||
case ServiceOptionType.number:
|
||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
validation: (value: string) => {
|
||||
if (!value && option.isRequired) {
|
||||
return { type: MessageType.ERROR, content: option.displayName + missingErrorMessage };
|
||||
} else if (!types.isNumber(Number(value))) {
|
||||
return { type: MessageType.ERROR, content: invalidInputMessage };
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
let typeName: string = option.valueType.toString();
|
||||
if (typeName === ServiceOptionTypeNames.number) {
|
||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
validation: (value: string) => {
|
||||
if (!value && option.isRequired) {
|
||||
return { type: MessageType.ERROR, content: option.displayName + missingErrorMessage };
|
||||
} else if (!types.isNumber(Number(value))) {
|
||||
return { type: MessageType.ERROR, content: invalidInputMessage };
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
optionWidget.value = optionValue;
|
||||
inputElement = this.findElement(rowContainer, 'input');
|
||||
break;
|
||||
case ServiceOptionType.category:
|
||||
case ServiceOptionType.boolean:
|
||||
optionWidget = new SelectBox(possibleInputs, optionValue.toString());
|
||||
DialogHelper.appendInputSelectBox(rowContainer, optionWidget);
|
||||
inputElement = this.findElement(rowContainer, 'select-box');
|
||||
break;
|
||||
case ServiceOptionType.string:
|
||||
case ServiceOptionType.password:
|
||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
validation: (value: string) => (!value && option.isRequired) ? ({ type: MessageType.ERROR, content: option.displayName + missingErrorMessage }) : null
|
||||
}
|
||||
});
|
||||
optionWidget.value = optionValue;
|
||||
if (option.valueType === ServiceOptionType.password) {
|
||||
optionWidget.inputElement.type = 'password';
|
||||
}
|
||||
inputElement = this.findElement(rowContainer, 'input');
|
||||
});
|
||||
optionWidget.value = optionValue;
|
||||
inputElement = this.findElement(rowContainer, 'input');
|
||||
} else if (typeName === ServiceOptionTypeNames.category || typeName === ServiceOptionTypeNames.boolean) {
|
||||
optionWidget = new SelectBox(possibleInputs, optionValue.toString());
|
||||
DialogHelper.appendInputSelectBox(rowContainer, optionWidget);
|
||||
inputElement = this.findElement(rowContainer, 'select-box');
|
||||
} else if (typeName === ServiceOptionTypeNames.string || typeName === ServiceOptionTypeNames.password) {
|
||||
optionWidget = new InputBox(rowContainer.getHTMLElement(), contextViewService, {
|
||||
validationOptions: {
|
||||
validation: (value: string) => (!value && option.isRequired) ? ({ type: MessageType.ERROR, content: option.displayName + missingErrorMessage }) : null
|
||||
}
|
||||
});
|
||||
optionWidget.value = optionValue;
|
||||
if (option.valueType === ServiceOptionType.password) {
|
||||
optionWidget.inputElement.type = 'password';
|
||||
}
|
||||
inputElement = this.findElement(rowContainer, 'input');
|
||||
}
|
||||
optionsMap[option.name] = { optionWidget: optionWidget, option: option, optionValue: optionValue };
|
||||
inputElement.onfocus = () => onFocus(option.name);
|
||||
}
|
||||
|
||||
export function getOptionValueAndCategoryValues(option: data.ServiceOption, options: { [optionName: string]: any }, possibleInputs: string[]): any {
|
||||
|
||||
let valueTypeName:string = option.valueType.toString();
|
||||
var optionValue = option.defaultValue;
|
||||
if (options[option.name]) {
|
||||
// if the value type is boolean, the option value can be either boolean or string
|
||||
if (option.valueType === ServiceOptionType.boolean) {
|
||||
if (valueTypeName === ServiceOptionTypeNames.boolean) {
|
||||
if (options[option.name] === true || options[option.name] === this.trueInputValue) {
|
||||
optionValue = this.trueInputValue;
|
||||
} else {
|
||||
@@ -86,13 +85,13 @@ export function getOptionValueAndCategoryValues(option: data.ServiceOption, opti
|
||||
}
|
||||
}
|
||||
|
||||
if (option.valueType === ServiceOptionType.boolean || option.valueType === ServiceOptionType.category) {
|
||||
if (valueTypeName === ServiceOptionTypeNames.boolean || valueTypeName === ServiceOptionTypeNames.category) {
|
||||
// If the option is not required, the empty string should be add at the top of possible choices
|
||||
if (!option.isRequired) {
|
||||
possibleInputs.push('');
|
||||
}
|
||||
|
||||
if (option.valueType === ServiceOptionType.boolean) {
|
||||
if (valueTypeName === ServiceOptionTypeNames.boolean) {
|
||||
possibleInputs.push(this.trueInputValue, this.falseInputValue);
|
||||
} else {
|
||||
option.categoryValues.map(c => possibleInputs.push(c.name));
|
||||
@@ -112,9 +111,9 @@ export function validateInputs(optionsMap: { [optionName: string]: IOptionElemen
|
||||
for (var optionName in optionsMap) {
|
||||
var optionElement: IOptionElement = optionsMap[optionName];
|
||||
var widget = optionElement.optionWidget;
|
||||
var isInputBox = (optionElement.option.valueType === ServiceOptionType.string ||
|
||||
optionElement.option.valueType === ServiceOptionType.password ||
|
||||
optionElement.option.valueType === ServiceOptionType.number);
|
||||
var isInputBox = (optionElement.option.valueType.toString() === ServiceOptionTypeNames.string ||
|
||||
optionElement.option.valueType.toString() === ServiceOptionTypeNames.password ||
|
||||
optionElement.option.valueType.toString() === ServiceOptionTypeNames.number);
|
||||
|
||||
if (isInputBox) {
|
||||
if (!widget.validate()) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IThemable } from 'vs/platform/theme/common/styler';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as objects from 'sql/base/common/objects';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { Dimension, $, Builder } from 'vs/base/browser/builder';
|
||||
import { EventType } from 'vs/base/browser/dom';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import 'vs/css!./splitview';
|
||||
import lifecycle = require('vs/base/common/lifecycle');
|
||||
import ee = require('vs/base/common/eventEmitter');
|
||||
import ee = require('sql/base/common/eventEmitter');
|
||||
import types = require('vs/base/common/types');
|
||||
import dom = require('vs/base/browser/dom');
|
||||
import numbers = require('vs/base/common/numbers');
|
||||
@@ -347,11 +347,11 @@ export abstract class AbstractCollapsibleView extends HeaderView {
|
||||
// Track state of focus in header so that other components can adjust styles based on that
|
||||
// (for example show or hide actions based on the state of being focused or not)
|
||||
this.focusTracker = dom.trackFocus(this.header);
|
||||
this.focusTracker.addFocusListener(() => {
|
||||
this.focusTracker.onDidFocus(() => {
|
||||
dom.addClass(this.header, 'focused');
|
||||
});
|
||||
|
||||
this.focusTracker.addBlurListener(() => {
|
||||
this.focusTracker.onDidBlur(() => {
|
||||
dom.removeClass(this.header, 'focused');
|
||||
});
|
||||
}
|
||||
@@ -602,8 +602,8 @@ export class SplitView extends lifecycle.Disposable implements
|
||||
if (this.views.length > 2) {
|
||||
let s = new sash.Sash(this.el, this, { orientation: this.sashOrientation });
|
||||
this.sashes.splice(index - 1, 0, s);
|
||||
this.sashesListeners.push(s.addListener('start', e => this.onSashStart(s, this.eventWrapper(e))));
|
||||
this.sashesListeners.push(s.addListener('change', e => this.onSashChange(s, this.eventWrapper(e))));
|
||||
this.sashesListeners.push(s.onDidStart((e) => this.onSashStart(s, this.eventWrapper(e))));
|
||||
this.sashesListeners.push(s.onDidChange((e) => this.onSashChange(s, this.eventWrapper(e))));
|
||||
}
|
||||
|
||||
this.viewChangeListeners.splice(index, 0, view.addListener('change', size => this.onViewChange(view, size)));
|
||||
@@ -611,7 +611,7 @@ export class SplitView extends lifecycle.Disposable implements
|
||||
|
||||
let viewFocusTracker = dom.trackFocus(viewElement);
|
||||
this.viewFocusListeners.splice(index, 0, viewFocusTracker);
|
||||
viewFocusTracker.addFocusListener(() => this._onFocus.fire(view));
|
||||
viewFocusTracker.onDidFocus(() => this._onFocus.fire(view));
|
||||
|
||||
this.viewFocusPreviousListeners.splice(index, 0, view.addListener('focusPrevious', () => index > 0 && this.views[index - 1].focus()));
|
||||
this.viewFocusNextListeners.splice(index, 0, view.addListener('focusNext', () => index < this.views.length && this.views[index + 1].focus()));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Adapted from https://github.com/naresh-n/slickgrid-column-data-autosize/blob/master/src/slick.autocolumnsize.js
|
||||
|
||||
import { mixin, clone } from 'vs/base/common/objects';
|
||||
import { mixin, clone } from 'sql/base/common/objects';
|
||||
|
||||
export interface IAutoColumnSizeOptions extends Slick.PluginOptions {
|
||||
maxWidth?: number;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Drag select selection model gist taken from https://gist.github.com/skoon/5312536
|
||||
// heavily modified
|
||||
|
||||
import { clone } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
|
||||
export class DragCellSelectionModel<T> implements Slick.SelectionModel<T, Array<Slick.Range>> {
|
||||
private readonly keyColResizeIncr = 5;
|
||||
|
||||
@@ -10,8 +10,7 @@ import 'vs/css!vs/base/browser/ui/actionbar/actionbar';
|
||||
import { Promise } from 'vs/base/common/winjs.base';
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions';
|
||||
import { EventType as CommonEventType } from 'vs/base/common/events';
|
||||
import { EventEmitter } from 'vs/base/common/eventEmitter';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import {
|
||||
@@ -32,7 +31,7 @@ let defaultOptions: IActionBarOptions = {
|
||||
* ActionBar vs/base/browser/ui/actionbar/actionbar. This class was needed because we
|
||||
* want the ability to display content other than Action icons in the QueryTaskbar.
|
||||
*/
|
||||
export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
export class ActionBar extends ActionRunner implements IActionRunner {
|
||||
|
||||
private _options: IActionBarOptions;
|
||||
private _actionRunner: IActionRunner;
|
||||
@@ -60,7 +59,7 @@ export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
this._toDispose.push(this._actionRunner);
|
||||
}
|
||||
|
||||
this._toDispose.push(this.addEmitter(this._actionRunner));
|
||||
//this._toDispose.push(this.addEmitter(this._actionRunner));
|
||||
|
||||
this._items = [];
|
||||
this._focusedItem = undefined;
|
||||
@@ -122,14 +121,16 @@ export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
});
|
||||
|
||||
this._focusTracker = DOM.trackFocus(this._domNode);
|
||||
this._focusTracker.addBlurListener(() => {
|
||||
this._focusTracker.onDidBlur(() => {
|
||||
if (document.activeElement === this._domNode || !DOM.isAncestor(document.activeElement, this._domNode)) {
|
||||
this.emit(DOM.EventType.BLUR, {});
|
||||
|
||||
// @SQLTODO
|
||||
//this.emit(DOM.EventType.BLUR, {});
|
||||
this._focusedItem = undefined;
|
||||
}
|
||||
});
|
||||
|
||||
this._focusTracker.addFocusListener(() => this.updateFocusedItem());
|
||||
this._focusTracker.onDidFocus(() => this.updateFocusedItem());
|
||||
|
||||
this._actionsList = document.createElement('ul');
|
||||
this._actionsList.className = 'actions-container';
|
||||
@@ -226,7 +227,7 @@ export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
|
||||
item.actionRunner = this._actionRunner;
|
||||
item.setActionContext(this.context);
|
||||
this.addEmitter(item);
|
||||
//this.addEmitter(item);
|
||||
item.render(actionItemElement);
|
||||
|
||||
if (index === null || index < 0 || index >= this._actionsList.children.length) {
|
||||
@@ -354,7 +355,7 @@ export class ActionBar extends EventEmitter implements IActionRunner {
|
||||
(<HTMLElement>document.activeElement).blur(); // remove focus from focussed action
|
||||
}
|
||||
|
||||
this.emit(CommonEventType.CANCEL);
|
||||
//this.emit('cancel');
|
||||
}
|
||||
|
||||
public run(action: IAction, context?: any): Promise {
|
||||
|
||||
@@ -5,6 +5,25 @@
|
||||
'use strict';
|
||||
import * as Types from 'vs/base/common/types';
|
||||
|
||||
export function clone<T>(obj: T): T {
|
||||
if (!obj || typeof obj !== 'object') {
|
||||
return obj;
|
||||
}
|
||||
if (obj instanceof RegExp) {
|
||||
// See https://github.com/Microsoft/TypeScript/issues/10990
|
||||
return obj as any;
|
||||
}
|
||||
const result = (Array.isArray(obj)) ? <any>[] : <any>{};
|
||||
Object.keys(obj).forEach(key => {
|
||||
if (obj[key] && typeof obj[key] === 'object') {
|
||||
result[key] = clone(obj[key]);
|
||||
} else {
|
||||
result[key] = obj[key];
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A copy of the vs mixin that accepts a custom behavior function
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'vs/css!sql/parts/accountManagement/common/media/accountActions';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { SplitView } from 'sql/base/browser/ui/splitview/splitview';
|
||||
import { List } from 'vs/base/browser/ui/list/listWidget';
|
||||
import { IListService } from 'vs/platform/list/browser/listService';
|
||||
import { IListService, ListService } from 'vs/platform/list/browser/listService';
|
||||
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { localize } from 'vs/nls';
|
||||
@@ -192,7 +192,9 @@ export class AccountDialog extends Modal {
|
||||
// Append the list view to the split view
|
||||
this._splitView.addView(providerView);
|
||||
this._register(attachListStyler(accountList, this._themeService));
|
||||
this._register(this._listService.register(accountList));
|
||||
|
||||
let listService = <ListService>this._listService;
|
||||
this._register(listService.register(accountList));
|
||||
this._splitView.layout(DOM.getContentHeight(this._container));
|
||||
|
||||
// Set the initial items of the list
|
||||
|
||||
@@ -64,7 +64,7 @@ export class AutoOAuthDialog extends Modal {
|
||||
public render() {
|
||||
super.render();
|
||||
attachModalDialogStyler(this, this._themeService);
|
||||
this.backButton.addListener('click', () => this.cancel());
|
||||
this.backButton.onDidClick(() => this.cancel());
|
||||
this._register(attachButtonStyler(this.backButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND }));
|
||||
|
||||
this._copyAndOpenButton = this.addFooterButton(localize('copyAndOpen', 'Copy & Open'), () => this.addAccount());
|
||||
|
||||
@@ -97,26 +97,23 @@ export class RemoveAccountAction extends Action {
|
||||
type: 'question'
|
||||
};
|
||||
|
||||
let confirmPromise = this._messageService.confirm(confirm);
|
||||
|
||||
return confirmPromise.then(confirmation => {
|
||||
if (!confirmation.confirmed) {
|
||||
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);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
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);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ export class FirewallRuleDialog extends Modal {
|
||||
public render() {
|
||||
super.render();
|
||||
attachModalDialogStyler(this, this._themeService);
|
||||
this.backButton.addListener('click', () => this.cancel());
|
||||
this.backButton.onDidClick(() => this.cancel());
|
||||
this._register(attachButtonStyler(this.backButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND }));
|
||||
this._createButton = this.addFooterButton(localize('ok', 'OK'), () => this.createFirewallRule());
|
||||
this._closeButton = this.addFooterButton(localize('cancel', 'Cancel'), () => this.cancel());
|
||||
|
||||
@@ -68,9 +68,10 @@ export class ConnectionConfig implements IConnectionConfig {
|
||||
allGroups = allGroups.concat(userGroups);
|
||||
}
|
||||
allGroups = allGroups.map(g => {
|
||||
if (g.parentId === '' || !g.parentId) {
|
||||
g.parentId = undefined;
|
||||
}
|
||||
// @SQLTODO
|
||||
// if (g.parentId === '' || !g.parentId) {
|
||||
// g.parentId = undefined;
|
||||
// }
|
||||
return g;
|
||||
});
|
||||
return allGroups;
|
||||
|
||||
@@ -205,7 +205,7 @@ export class ConnectionManagementService implements IConnectionManagementService
|
||||
|
||||
if (this._providerCount === 1) {
|
||||
// show the Registered Server viewlet
|
||||
let startupConfig = this._workspaceConfigurationService.getConfiguration('startup');
|
||||
let startupConfig = this._workspaceConfigurationService.getValue('startup');
|
||||
if (startupConfig) {
|
||||
let showServerViewlet = <boolean>startupConfig['alwaysShowServersView'];
|
||||
if (showServerViewlet) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import { ProviderConnectionInfo } from 'sql/parts/connection/common/providerConn
|
||||
import * as interfaces from 'sql/parts/connection/common/interfaces';
|
||||
import { equalsIgnoreCase } from 'vs/base/common/strings';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import * as objects from 'sql/base/common/objects';
|
||||
|
||||
// Concrete implementation of the IConnectionProfile interface
|
||||
|
||||
@@ -174,9 +175,9 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
connectionInfo.options = profile.options;
|
||||
|
||||
// append group ID and original display name to build unique OE session ID
|
||||
connectionInfo.options = profile.options;
|
||||
connectionInfo.options['groupId'] = connectionInfo.groupId;
|
||||
connectionInfo.options['databaseDisplayName'] = connectionInfo.databaseName;
|
||||
connectionInfo.options = objects.clone(profile.options);
|
||||
connectionInfo.options['groupId'] = connectionInfo.groupId;
|
||||
connectionInfo.options['databaseDisplayName'] = connectionInfo.databaseName;
|
||||
|
||||
connectionInfo.groupId = profile.groupId;
|
||||
connectionInfo.providerName = profile.providerName;
|
||||
|
||||
@@ -500,7 +500,7 @@ export class ConnectionStore {
|
||||
}
|
||||
|
||||
private getMaxRecentConnectionsCount(): number {
|
||||
let config = this._workspaceConfigurationService.getConfiguration(Constants.sqlConfigSectionName);
|
||||
let config = this._workspaceConfigurationService.getValue(Constants.sqlConfigSectionName);
|
||||
|
||||
let maxConnections: number = config[Constants.configMaxRecentConnections];
|
||||
if (typeof (maxConnections) !== 'number' || maxConnections <= 0) {
|
||||
|
||||
@@ -22,7 +22,7 @@ export interface IConnectionProfile extends data.ConnectionInfo {
|
||||
providerName: string;
|
||||
saveProfile: boolean;
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IConnectionProfileStore {
|
||||
options: {};
|
||||
@@ -30,5 +30,5 @@ export interface IConnectionProfileStore {
|
||||
providerName: string;
|
||||
savePassword: boolean;
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -261,15 +261,35 @@ export class ConnectionDialogWidget extends Modal {
|
||||
type: 'question'
|
||||
};
|
||||
|
||||
return this._messageService.confirm(confirm).then(confirmation => {
|
||||
if (!confirmation.confirmed) {
|
||||
return TPromise.as(false);
|
||||
} else {
|
||||
// @SQLTODO
|
||||
return new TPromise<boolean>((resolve, reject) => {
|
||||
let confirmed: boolean = this._messageService.confirm(confirm);
|
||||
if (confirmed) {
|
||||
this._connectionManagementService.clearRecentConnectionsList();
|
||||
this.open(false);
|
||||
return TPromise.as(true);
|
||||
}
|
||||
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 {
|
||||
|
||||
@@ -184,7 +184,7 @@ export class ConnectionWidget {
|
||||
cellContainer.div({ class: 'advanced-button' }, (divContainer) => {
|
||||
button = new Button(divContainer);
|
||||
button.label = title;
|
||||
button.addListener('click', () => {
|
||||
button.onDidClick(() => {
|
||||
//open advanced page
|
||||
this._callbacks.onAdvancedProperties();
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ import { IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeS
|
||||
import * as colors from 'vs/platform/theme/common/colorRegistry';
|
||||
import * as themeColors from 'vs/workbench/common/theme';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as objects from 'sql/base/common/objects';
|
||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,7 +75,7 @@ export class DashboardEditor extends BaseEditor {
|
||||
return TPromise.wrap(input.initializedPromise.then(() => this.bootstrapAngular(input)));
|
||||
} else {
|
||||
this._dashboardContainer = DOM.append(parentElement, this.input.container);
|
||||
return TPromise.as<void>(null);
|
||||
return TPromise.wrap<void>(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { mixin, clone } from 'vs/base/common/objects';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { mixin, clone } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { registerInsight } from 'sql/platform/dashboard/common/insightRegistry';
|
||||
import { chartInsightSchema } from 'sql/parts/dashboard/widgets/insights/views/charts/chartInsight.contribution';
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { mixin, clone } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
|
||||
import { registerInsight } from 'sql/platform/dashboard/common/insightRegistry';
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
import { ChartType, customMixin, defaultChartConfig, IDataSet, IPointDataSet } from 'sql/parts/dashboard/widgets/insights/views/charts/chartInsight.component';
|
||||
import BarChart, { IBarChartConfig } from './barChart.component';
|
||||
import { memoize, unmemoize } from 'sql/base/common/decorators';
|
||||
import { mixin } from 'sql/base/common/objects';
|
||||
import { clone } from 'vs/base/common/objects';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
|
||||
export enum DataType {
|
||||
Number = 'number',
|
||||
@@ -93,6 +93,7 @@ export default class LineChart extends BarChart {
|
||||
}
|
||||
};
|
||||
|
||||
this.options = mixin(this.options, options, true, customMixin);
|
||||
// @SQLTODO
|
||||
this.options = mixin(this.options, options, true);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { mixin, clone } from 'vs/base/common/objects';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { mixin, clone } from 'vs/base/common/objects';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { registerInsight } from 'sql/platform/dashboard/common/insightRegistry';
|
||||
import { chartInsightSchema } from 'sql/parts/dashboard/widgets/insights/views/charts/chartInsight.contribution';
|
||||
|
||||
+2
-1
@@ -6,7 +6,8 @@
|
||||
import { ChartType, defaultChartConfig } from 'sql/parts/dashboard/widgets/insights/views/charts/chartInsight.component';
|
||||
import LineChart, { ILineConfig } from './lineChart.component';
|
||||
|
||||
import { mixin, clone } from 'vs/base/common/objects';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
|
||||
const defaultScatterConfig = mixin(clone(defaultChartConfig), { dataType: 'point', dataDirection: 'horizontal' }) as ILineConfig;
|
||||
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { mixin, clone } from 'vs/base/common/objects';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
|
||||
import { registerInsight } from 'sql/platform/dashboard/common/insightRegistry';
|
||||
|
||||
+2
-1
@@ -6,7 +6,8 @@
|
||||
import { defaultChartConfig, IPointDataSet, ChartType } from 'sql/parts/dashboard/widgets/insights/views/charts/chartInsight.component';
|
||||
import LineChart, { ILineConfig } from './lineChart.component';
|
||||
|
||||
import { mixin, clone } from 'vs/base/common/objects';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
|
||||
const defaultTimeSeriesConfig = mixin(clone(defaultChartConfig), { dataType: 'point', dataDirection: 'horizontal' }) as ILineConfig;
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { mixin, clone } from 'vs/base/common/objects';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
|
||||
import { registerInsight } from 'sql/platform/dashboard/common/insightRegistry';
|
||||
|
||||
@@ -525,20 +525,11 @@ export class BackupComponent {
|
||||
|
||||
private addButtonClickHandler(button: Button, handler: () => void) {
|
||||
if (button && handler) {
|
||||
button.addListener(DOM.EventType.CLICK, () => {
|
||||
button.onDidClick(() => {
|
||||
if (button.enabled) {
|
||||
handler();
|
||||
}
|
||||
});
|
||||
|
||||
button.addListener(DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||
var event = new StandardKeyboardEvent(e);
|
||||
if (button.enabled && event.keyCode === KeyCode.Enter) {
|
||||
handler();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -607,19 +607,10 @@ export class RestoreDialog extends Modal {
|
||||
this.onFilePathLoseFocus(params);
|
||||
}));
|
||||
|
||||
this._browseFileButton.addListener(DOM.EventType.CLICK, () => {
|
||||
this._browseFileButton.onDidClick(() => {
|
||||
this.onFileBrowserRequested();
|
||||
});
|
||||
|
||||
this._browseFileButton.addListener(DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||
var event = new StandardKeyboardEvent(e);
|
||||
if (event.keyCode === KeyCode.Enter) {
|
||||
this.onFileBrowserRequested();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
this._register(this._sourceDatabaseSelectBox.onDidSelect(selectedDatabase => {
|
||||
this.onSourceDatabaseChanged(selectedDatabase.selected);
|
||||
}));
|
||||
|
||||
@@ -349,7 +349,7 @@ export class EditDataEditor extends BaseEditor {
|
||||
params,
|
||||
this.editDataInput);
|
||||
}
|
||||
return TPromise.as<void>(null);
|
||||
return TPromise.wrap<void>(null);
|
||||
}
|
||||
|
||||
private _setTableViewVisible(): void {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { EventEmitter } from 'vs/base/common/eventEmitter';
|
||||
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';
|
||||
|
||||
@@ -79,19 +79,10 @@ export class FileBrowserDialog extends Modal {
|
||||
|
||||
if (this.backButton) {
|
||||
|
||||
this.backButton.addListener(DOM.EventType.CLICK, () => {
|
||||
this.backButton.onDidClick(() => {
|
||||
this.close();
|
||||
});
|
||||
|
||||
this.backButton.addListener(DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||
var event = new StandardKeyboardEvent(e);
|
||||
if (event.keyCode === KeyCode.Enter) {
|
||||
this.close();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
this._register(attachButtonStyler(this.backButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND }));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { FileKind } from 'vs/platform/files/common/files';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FileLabel } from 'vs/workbench/browser/labels';
|
||||
import { IFileTemplateData } from 'vs/workbench/parts/files/browser/views/explorerViewer';
|
||||
import { IFileTemplateData } from 'vs/workbench/parts/files/electron-browser/views/explorerViewer';
|
||||
|
||||
/**
|
||||
* Renders the tree items.
|
||||
|
||||
@@ -42,7 +42,7 @@ export class FileBrowserTreeView {
|
||||
if (!this._tree) {
|
||||
DOM.addClass(container, 'show-file-icons');
|
||||
this._tree = this.createFileBrowserTree(container, this._instantiationService);
|
||||
this._toDispose.push(this._tree.addListener('selection', (event) => this.onSelected(event)));
|
||||
this._toDispose.push(this._tree.onDidChangeSelection((event) => this.onSelected(event)));
|
||||
this._toDispose.push(this._fileBrowserService.onExpandFolder(fileNode => this._tree.refresh(fileNode)));
|
||||
this._toDispose.push(attachListStyler(this._tree, this._themeService));
|
||||
this._tree.DOMFocus();
|
||||
|
||||
@@ -21,8 +21,7 @@ import { EditDataComponentParams } from 'sql/services/bootstrap/bootstrapParams'
|
||||
import { GridParentComponent } from 'sql/parts/grid/views/gridParentComponent';
|
||||
import { EditDataGridActionProvider } from 'sql/parts/grid/views/editData/editDataGridActions';
|
||||
import { error } from 'sql/base/common/log';
|
||||
|
||||
import { clone } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
|
||||
export const EDITDATA_SELECTOR: string = 'editdata-component';
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ export abstract class GridParentComponent {
|
||||
const self = this;
|
||||
this.initShortcutsBase();
|
||||
if (this._bootstrapService.configurationService) {
|
||||
let sqlConfig = this._bootstrapService.configurationService.getConfiguration('sql');
|
||||
let sqlConfig = this._bootstrapService.configurationService.getValue('sql');
|
||||
if (sqlConfig) {
|
||||
this._messageActive = sqlConfig['messagesDefaultOpen'];
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import { error } from 'sql/base/common/log';
|
||||
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
||||
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { clone } from 'vs/base/common/objects';
|
||||
import { clone } from 'sql/base/common/objects';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
|
||||
export const QUERY_SELECTOR: string = 'query-component';
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!vs/editor/contrib/find/browser/findWidget';
|
||||
import 'vs/css!vs/editor/contrib/find/findWidget';
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
@@ -21,10 +22,9 @@ import { Widget } from 'vs/base/browser/ui/widget';
|
||||
import { Sash, IHorizontalSashLayoutProvider, ISashEvent, Orientation } from 'vs/base/browser/ui/sash/sash';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IOverlayWidget, IOverlayWidgetPosition, OverlayWidgetPositionPreference } from 'vs/editor/browser/editorBrowser';
|
||||
import { FIND_IDS, MATCHES_LIMIT } from 'vs/editor/contrib/find/common/findModel';
|
||||
import { FindReplaceState, FindReplaceStateChangedEvent } from 'vs/editor/contrib/find/common/findState';
|
||||
import { FIND_IDS, MATCHES_LIMIT, CONTEXT_FIND_INPUT_FOCUSED } from 'vs/editor/contrib/find/findModel';
|
||||
import { FindReplaceState, FindReplaceStateChangedEvent } from 'vs/editor/contrib/find/findState';
|
||||
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { CONTEXT_FIND_INPUT_FOCUSED } from 'vs/editor/contrib/find/common/findController';
|
||||
import { ITheme, registerThemingParticipant, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { editorFindRangeHighlight, editorFindMatch, editorFindMatchHighlight, activeContrastBorder, contrastBorder, inputBackground, editorWidgetBackground, inputActiveOptionBorder, widgetShadow, inputForeground, inputBorder, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationErrorBackground, inputValidationErrorBorder, errorForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
@@ -102,7 +102,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
|
||||
this._isVisible = false;
|
||||
|
||||
this._register(this._state.addChangeListener((e) => this._onStateChanged(e)));
|
||||
this._register(this._state.onFindReplaceStateChange((e) => this._onStateChanged(e)));
|
||||
this._buildDomNode();
|
||||
this._updateButtons();
|
||||
|
||||
@@ -148,10 +148,10 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
|
||||
this._findInputFocussed = CONTEXT_FIND_INPUT_FOCUSED.bindTo(contextKeyService);
|
||||
this._focusTracker = this._register(dom.trackFocus(this._findInput.inputBox.inputElement));
|
||||
this._focusTracker.addFocusListener(() => {
|
||||
this._focusTracker.onDidFocus(() => {
|
||||
this._findInputFocussed.set(true);
|
||||
});
|
||||
this._focusTracker.addBlurListener(() => {
|
||||
this._focusTracker.onDidBlur(() => {
|
||||
this._findInputFocussed.set(false);
|
||||
});
|
||||
|
||||
@@ -480,11 +480,11 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
|
||||
this._resizeSash = new Sash(this._domNode, this, { orientation: Orientation.VERTICAL });
|
||||
let originalWidth = FIND_WIDGET_INITIAL_WIDTH;
|
||||
|
||||
this._register(this._resizeSash.addListener('start', (e: ISashEvent) => {
|
||||
this._register(this._resizeSash.onDidStart((e: ISashEvent) => {
|
||||
originalWidth = dom.getTotalWidth(this._domNode);
|
||||
}));
|
||||
|
||||
this._register(this._resizeSash.addListener('change', (evt: ISashEvent) => {
|
||||
this._register(this._resizeSash.onDidChange((evt: ISashEvent) => {
|
||||
let width = originalWidth + evt.startX - evt.currentX;
|
||||
|
||||
if (width < FIND_WIDGET_INITIAL_WIDTH) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IEditorAction } from 'vs/editor/common/editorCommon';
|
||||
import { IOverlayWidget } from 'vs/editor/browser/editorBrowser';
|
||||
import { FindReplaceState, FindReplaceStateChangedEvent } from 'vs/editor/contrib/find/common/findState';
|
||||
import { FindReplaceState, FindReplaceStateChangedEvent } from 'vs/editor/contrib/find/findState';
|
||||
import { Dimension, Builder } from 'vs/base/browser/builder';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -70,7 +70,7 @@ export class ProfilerTableEditor extends BaseEditor implements IProfilerControll
|
||||
attachTableStyler(this._profilerTable, this._themeService);
|
||||
|
||||
this._findState = new FindReplaceState();
|
||||
this._findState.addChangeListener(e => this._onFindStateChange(e));
|
||||
this._findState.onFindReplaceStateChange(e => this._onFindStateChange(e));
|
||||
|
||||
this._finder = new FindWidget(
|
||||
this,
|
||||
|
||||
@@ -28,19 +28,20 @@ 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, ICommonCodeEditor } from 'vs/editor/common/editorCommon';
|
||||
import { IModel } from 'vs/editor/common/editorCommon';
|
||||
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 * as nls from 'vs/nls';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Command } from 'vs/editor/common/editorCommonExtensions';
|
||||
import { Command } from 'vs/editor/browser/editorExtensions';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { ContextKeyExpr, IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { CommonFindController, FindStartFocusAction } from 'vs/editor/contrib/find/common/findController';
|
||||
import { CommonFindController, FindStartFocusAction } from 'vs/editor/contrib/find/findController';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
|
||||
@@ -354,11 +355,12 @@ export class ProfilerEditor extends BaseEditor {
|
||||
|
||||
public toggleSearch(): void {
|
||||
if (this._editor.getControl().isFocused()) {
|
||||
let editor = this._editor.getControl() as ICommonCodeEditor;
|
||||
let editor = this._editor.getControl() as ICodeEditor;
|
||||
let controller = CommonFindController.get(editor);
|
||||
if (controller) {
|
||||
controller.start({
|
||||
forceRevealReplace: false,
|
||||
seedSearchStringFromGlobalClipboard: false,
|
||||
seedSearchStringFromSelection: (controller.getState().searchString.length === 0),
|
||||
shouldFocus: FindStartFocusAction.FocusFindInput,
|
||||
shouldAnimate: true
|
||||
|
||||
@@ -22,8 +22,8 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { IEditorContributionCtor } from 'vs/editor/browser/editorBrowser';
|
||||
import { FoldingController } from 'vs/editor/contrib/folding/browser/folding';
|
||||
import { IEditorContributionCtor } from 'vs/editor/browser/editorExtensions';
|
||||
import { FoldingController } from 'vs/editor/contrib/folding/folding';
|
||||
|
||||
class ProfilerResourceCodeEditor extends CodeEditor {
|
||||
|
||||
@@ -53,7 +53,7 @@ export class ProfilerResourceEditor extends BaseTextEditor {
|
||||
@IEditorGroupService editorGroupService: IEditorGroupService
|
||||
|
||||
) {
|
||||
super(ProfilerResourceEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, modeService, textFileService, editorGroupService);
|
||||
super(ProfilerResourceEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorGroupService);
|
||||
}
|
||||
|
||||
public createEditorControl(parent: Builder, configuration: IEditorOptions): editorCommon.IEditor {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { EventEmitter } from 'vs/base/common/eventEmitter';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export interface IProfilerStateChangedEvent {
|
||||
|
||||
@@ -118,7 +118,7 @@ export class ProfilerService implements IProfilerService {
|
||||
}
|
||||
|
||||
public getSessionTemplates(provider?: string): Array<IProfilerSessionTemplate> {
|
||||
let config = <IProfilerSettings>this._configurationService.getConfiguration(PROFILER_SETTINGS);
|
||||
let config = <IProfilerSettings>this._configurationService.getValue(PROFILER_SETTINGS);
|
||||
|
||||
if (provider) {
|
||||
return config.sessionTemplates;
|
||||
|
||||
@@ -16,7 +16,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import errors = require('vs/base/common/errors');
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { getCodeEditor as getEditorWidget } from 'vs/editor/common/services/codeEditorService';
|
||||
import { getCodeEditor as getEditorWidget } from 'vs/editor/browser/services/codeEditorService';
|
||||
import nls = require('vs/nls');
|
||||
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
|
||||
@@ -49,7 +49,7 @@ export class QueryResultsEditor extends BaseEditor {
|
||||
if (!input.hasBootstrapped) {
|
||||
this._bootstrapAngular();
|
||||
}
|
||||
return TPromise.as<void>(null);
|
||||
return TPromise.wrap<void>(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { Dropdown } from 'sql/base/browser/ui/editableDropdown/dropdown';
|
||||
import { Action, IActionItem, IActionRunner } from 'vs/base/common/actions';
|
||||
import { EventEmitter } from 'vs/base/common/eventEmitter';
|
||||
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';
|
||||
|
||||
@@ -19,7 +19,7 @@ import { IWorkspaceConfigurationService } from 'vs/workbench/services/configurat
|
||||
import * as nls from 'vs/nls';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { EventEmitter } from 'vs/base/common/eventEmitter';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export interface IEditSessionReadyEvent {
|
||||
@@ -446,7 +446,7 @@ export default class QueryRunner {
|
||||
}
|
||||
|
||||
private getEolString(): string {
|
||||
const { eol } = this._workspaceConfigurationService.getConfiguration<{ eol: string }>('files');
|
||||
const { eol } = this._workspaceConfigurationService.getValue<{ eol: string }>('files');
|
||||
return eol;
|
||||
}
|
||||
|
||||
|
||||
@@ -354,10 +354,13 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
let group: IEditorGroup = QueryEditorService.editorGroupService.getStacksModel().groupAt(position);
|
||||
if (isPinned) {
|
||||
QueryEditorService.editorGroupService.pinEditor(group, editor.input);
|
||||
} else {
|
||||
QueryEditorService.editorGroupService.unpinEditor(group, editor.input);
|
||||
}
|
||||
|
||||
// @SQLTODO do we need the below
|
||||
// else {
|
||||
// QueryEditorService.editorGroupService.p .unpinEditor(group, editor.input);
|
||||
// }
|
||||
|
||||
// Grab and returns the IModel that will be used to resolve the sqlLanguageModeCheck promise.
|
||||
let control = editor.getControl();
|
||||
let codeEditor: CodeEditor = <CodeEditor> control;
|
||||
|
||||
@@ -65,10 +65,10 @@ export class VerticalFlexibleSash extends Disposable implements IVerticalSashLay
|
||||
this.top = 0;
|
||||
this.sash = new Sash(container, this);
|
||||
|
||||
this._register(this.sash.addListener('start', () => this.onSashDragStart()));
|
||||
this._register(this.sash.addListener('change', (e: ISashEvent) => this.onSashDrag(e)));
|
||||
this._register(this.sash.addListener('end', () => this.onSashDragEnd()));
|
||||
this._register(this.sash.addListener('reset', () => this.onSashReset()));
|
||||
this._register(this.sash.onDidStart(() => this.onSashDragStart()));
|
||||
this._register(this.sash.onDidChange((e: ISashEvent) => this.onSashDrag(e)));
|
||||
this._register(this.sash.onDidEnd(() => this.onSashDragEnd()));
|
||||
this._register(this.sash.onDidReset(() => this.onSashReset()));
|
||||
}
|
||||
|
||||
public getSplitPoint(): number {
|
||||
@@ -178,10 +178,10 @@ export class HorizontalFlexibleSash extends Disposable implements IHorizontalSas
|
||||
this.left = 0;
|
||||
this.sash = new Sash(container, this, { orientation: Orientation.HORIZONTAL });
|
||||
|
||||
this._register(this.sash.addListener('start', () => this.onSashDragStart()));
|
||||
this._register(this.sash.addListener('change', (e: ISashEvent) => this.onSashDrag(e)));
|
||||
this._register(this.sash.addListener('end', () => this.onSashDragEnd()));
|
||||
this._register(this.sash.addListener('reset', () => this.onSashReset()));
|
||||
this._register(this.sash.onDidStart(() => this.onSashDragStart()));
|
||||
this._register(this.sash.onDidChange((e: ISashEvent) => this.onSashDrag(e)));
|
||||
this._register(this.sash.onDidEnd(() => this.onSashDragEnd()));
|
||||
this._register(this.sash.onDidReset(() => this.onSashReset()));
|
||||
}
|
||||
|
||||
public getSplitPoint(): number {
|
||||
|
||||
@@ -82,7 +82,7 @@ export class ServerGroupController implements IServerGroupController {
|
||||
public showCreateGroupDialog(connectionManagementService: IConnectionManagementService, callbacks?: IServerGroupDialogCallbacks): TPromise<void> {
|
||||
this._connectionManagementService = connectionManagementService;
|
||||
this._group = null;
|
||||
this._viewModel = new ServerGroupViewModel(undefined, this._configurationService.getConfiguration(SERVER_GROUP_CONFIG)[SERVER_GROUP_COLORS_CONFIG]);
|
||||
this._viewModel = new ServerGroupViewModel(undefined, this._configurationService.getValue(SERVER_GROUP_CONFIG)[SERVER_GROUP_COLORS_CONFIG]);
|
||||
this._callbacks = callbacks ? callbacks : undefined;
|
||||
return this.openServerGroupDialog();
|
||||
}
|
||||
@@ -90,7 +90,7 @@ export class ServerGroupController implements IServerGroupController {
|
||||
public showEditGroupDialog(connectionManagementService: IConnectionManagementService, group: ConnectionProfileGroup): TPromise<void> {
|
||||
this._connectionManagementService = connectionManagementService;
|
||||
this._group = group;
|
||||
this._viewModel = new ServerGroupViewModel(group, this._configurationService.getConfiguration(SERVER_GROUP_CONFIG)[SERVER_GROUP_COLORS_CONFIG]);
|
||||
this._viewModel = new ServerGroupViewModel(group, this._configurationService.getValue(SERVER_GROUP_CONFIG)[SERVER_GROUP_COLORS_CONFIG]);
|
||||
return this.openServerGroupDialog();
|
||||
}
|
||||
|
||||
|
||||
@@ -90,16 +90,16 @@ export class ServerTreeView {
|
||||
var connectButton = new Button(this._buttonSection);
|
||||
connectButton.label = localize('addConnection', 'Add Connection');
|
||||
this._toDispose.push(attachButtonStyler(connectButton, this._themeService));
|
||||
this._toDispose.push(connectButton.addListener('click', () => {
|
||||
this._toDispose.push(connectButton.onDidClick(() => {
|
||||
this._connectionManagementService.showConnectionDialog();
|
||||
}));
|
||||
}
|
||||
|
||||
this._tree = TreeCreationUtils.createRegisteredServersTree(container, this._instantiationService);
|
||||
//this._tree.setInput(undefined);
|
||||
this._toDispose.push(this._tree.addListener('selection', (event) => this.onSelected(event)));
|
||||
this._toDispose.push(this._tree.onDOMBlur(() => this._onSelectionOrFocusChange.fire()));
|
||||
this._toDispose.push(this._tree.onDOMFocus(() => this._onSelectionOrFocusChange.fire()));
|
||||
this._toDispose.push(this._tree.onDidChangeSelection((event) => this.onSelected(event)));
|
||||
this._toDispose.push(this._tree.onDidBlur(() => this._onSelectionOrFocusChange.fire()));
|
||||
this._toDispose.push(this._tree.onDidChangeFocus(() => this._onSelectionOrFocusChange.fire()));
|
||||
|
||||
// Theme styler
|
||||
this._toDispose.push(attachListStyler(this._tree, this._themeService));
|
||||
|
||||
@@ -20,6 +20,7 @@ import lifecycle = require('vs/base/common/lifecycle');
|
||||
import ext = require('vs/workbench/common/contributions');
|
||||
import { ITaskService } from 'sql/parts/taskHistory/common/taskService';
|
||||
import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
|
||||
export class StatusUpdater implements ext.IWorkbenchContribution {
|
||||
static ID = 'data.taskhistory.statusUpdater';
|
||||
@@ -97,7 +98,7 @@ const viewletDescriptor = new ViewletDescriptor(
|
||||
Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets).registerViewlet(viewletDescriptor);
|
||||
|
||||
// Register StatusUpdater
|
||||
(<ext.IWorkbenchContributionsRegistry>Registry.as(ext.Extensions.Workbench)).registerWorkbenchContribution(StatusUpdater);
|
||||
(<ext.IWorkbenchContributionsRegistry>Registry.as(ext.Extensions.Workbench)).registerWorkbenchContribution(StatusUpdater, LifecyclePhase.Running);
|
||||
|
||||
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
|
||||
registry.registerWorkbenchAction(
|
||||
|
||||
@@ -59,7 +59,7 @@ export class TaskHistoryView {
|
||||
$('span').text(noTaskMessage).appendTo(this._messages);
|
||||
|
||||
this._tree = this.createTaskHistoryTree(container, this._instantiationService);
|
||||
this._toDispose.push(this._tree.addListener('selection', (event) => this.onSelected(event)));
|
||||
this._toDispose.push(this._tree.onDidChangeSelection((event) => this.onSelected(event)));
|
||||
|
||||
// Theme styler
|
||||
this._toDispose.push(attachListStyler(this._tree, this._themeService));
|
||||
|
||||
@@ -27,4 +27,24 @@ export class ClipboardService implements IClipboardService {
|
||||
writeText(text: string): void {
|
||||
this._vsClipboardService.writeText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the content of the clipboard in plain text
|
||||
*/
|
||||
readText(): string {
|
||||
return this._vsClipboardService.readText();
|
||||
}
|
||||
/**
|
||||
* Reads text from the system find pasteboard.
|
||||
*/
|
||||
readFindText(): string {
|
||||
return this._vsClipboardService.readFindText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes text to the system find pasteboard.
|
||||
*/
|
||||
writeFindText(text: string): void {
|
||||
this._vsClipboardService.writeFindText(text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,14 +99,34 @@ export class CapabilitiesService implements ICapabilitiesService {
|
||||
// Get extensions and filter where the category has 'Data Provider' in it
|
||||
this.extensionManagementService.getInstalled(LocalExtensionType.User).then((extensions: ILocalExtension[]) => {
|
||||
let dataProviderExtensions = extensions.filter(extension =>
|
||||
extension.manifest.categories.indexOf(CapabilitiesService.DATA_PROVIDER_CATEGORY) > -1)
|
||||
extension.manifest.categories.indexOf(CapabilitiesService.DATA_PROVIDER_CATEGORY) > -1);
|
||||
|
||||
if(dataProviderExtensions.length > 0) {
|
||||
if (dataProviderExtensions.length > 0) {
|
||||
// Scrape out disabled extensions
|
||||
const disabledExtensions = this.extensionEnablementService.getGloballyDisabledExtensions()
|
||||
.map(disabledExtension => disabledExtension.id);
|
||||
dataProviderExtensions = dataProviderExtensions.filter(extension =>
|
||||
disabledExtensions.indexOf(getGalleryExtensionId(extension.manifest.publisher, extension.manifest.name)) < 0)
|
||||
|
||||
// @SQLTODO reenable this code
|
||||
// this.extensionEnablementService.getDisabledExtensions()
|
||||
// .then(disabledExtensions => {
|
||||
|
||||
// let disabledExtensionsId = disabledExtensions.map(disabledExtension => disabledExtension.id);
|
||||
// dataProviderExtensions = dataProviderExtensions.filter(extension =>
|
||||
// disabledExtensions.indexOf(getGalleryExtensionId(extension.manifest.publisher, extension.manifest.name)) < 0);
|
||||
|
||||
|
||||
// // return extensions.map(extension => {
|
||||
// // return {
|
||||
// // identifier: { id: adoptToGalleryExtensionId(stripVersion(extension.identifier.id)), uuid: extension.identifier.uuid },
|
||||
// // local: extension,
|
||||
// // globallyEnabled: disabledExtensions.every(disabled => !areSameExtensions(disabled, extension.identifier))
|
||||
// // };
|
||||
// // });
|
||||
// });
|
||||
|
||||
|
||||
// const disabledExtensions = this.extensionEnablementService.getGloballyDisabledExtensions()
|
||||
// .map(disabledExtension => disabledExtension.id);
|
||||
// dataProviderExtensions = dataProviderExtensions.filter(extension =>
|
||||
// disabledExtensions.indexOf(getGalleryExtensionId(extension.manifest.publisher, extension.manifest.name)) < 0);
|
||||
}
|
||||
|
||||
this._expectedCapabilitiesCount += dataProviderExtensions.length;
|
||||
|
||||
@@ -15,6 +15,17 @@ export enum ServiceOptionType {
|
||||
object = 6
|
||||
}
|
||||
|
||||
// SQL added extension host types
|
||||
export enum ServiceOptionTypeNames {
|
||||
string = 'string',
|
||||
multistring = 'multistring',
|
||||
password = 'password',
|
||||
number = 'number',
|
||||
category = 'category',
|
||||
boolean = 'boolean',
|
||||
object = 'object'
|
||||
}
|
||||
|
||||
export enum ConnectionOptionSpecialType {
|
||||
serverName = 'serverName',
|
||||
databaseName = 'databaseName',
|
||||
|
||||
@@ -17,9 +17,8 @@ import {
|
||||
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadAccountManagement)
|
||||
export class MainThreadAccountManagement extends MainThreadAccountManagementShape {
|
||||
export class MainThreadAccountManagement implements MainThreadAccountManagementShape {
|
||||
private _providerMetadata: { [handle: number]: data.AccountProviderMetadata };
|
||||
private _proxy: ExtHostAccountManagementShape;
|
||||
private _toDispose: IDisposable[];
|
||||
@@ -28,7 +27,6 @@ export class MainThreadAccountManagement extends MainThreadAccountManagementShap
|
||||
extHostContext: IExtHostContext,
|
||||
@IAccountManagementService private _accountManagementService: IAccountManagementService
|
||||
) {
|
||||
super();
|
||||
this._providerMetadata = {};
|
||||
if (extHostContext) {
|
||||
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostAccountManagement);
|
||||
|
||||
@@ -15,7 +15,7 @@ import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadCredentialManagement)
|
||||
export class MainThreadCredentialManagement extends MainThreadCredentialManagementShape {
|
||||
export class MainThreadCredentialManagement implements MainThreadCredentialManagementShape {
|
||||
|
||||
private _proxy: ExtHostCredentialManagementShape;
|
||||
|
||||
@@ -27,7 +27,6 @@ export class MainThreadCredentialManagement extends MainThreadCredentialManageme
|
||||
extHostContext: IExtHostContext,
|
||||
@ICredentialsService private credentialService: ICredentialsService
|
||||
) {
|
||||
super();
|
||||
if (extHostContext) {
|
||||
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostCredentialManagement);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostC
|
||||
* Main thread class for handling data protocol management registration.
|
||||
*/
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadDataProtocol)
|
||||
export class MainThreadDataProtocol extends MainThreadDataProtocolShape {
|
||||
export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
|
||||
|
||||
private _proxy: ExtHostDataProtocolShape;
|
||||
|
||||
@@ -55,7 +55,6 @@ export class MainThreadDataProtocol extends MainThreadDataProtocolShape {
|
||||
@ISerializationService private _serializationService: ISerializationService,
|
||||
@IFileBrowserService private _fileBrowserService: IFileBrowserService
|
||||
) {
|
||||
super();
|
||||
if (extHostContext) {
|
||||
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostDataProtocol);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostC
|
||||
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadResourceProvider)
|
||||
export class MainThreadResourceProvider extends MainThreadResourceProviderShape {
|
||||
export class MainThreadResourceProvider implements MainThreadResourceProviderShape {
|
||||
private _providerMetadata: {[handle: number]: data.AccountProviderMetadata};
|
||||
private _proxy: ExtHostResourceProviderShape;
|
||||
private _toDispose: IDisposable[];
|
||||
@@ -28,7 +28,6 @@ export class MainThreadResourceProvider extends MainThreadResourceProviderShape
|
||||
extHostContext: IExtHostContext,
|
||||
@IResourceProviderService private _resourceProviderService: IResourceProviderService
|
||||
) {
|
||||
super();
|
||||
this._providerMetadata = {};
|
||||
if (extHostContext) {
|
||||
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostResourceProvider);
|
||||
|
||||
@@ -16,7 +16,7 @@ import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadSerializationProvider)
|
||||
export class MainThreadSerializationProvider extends MainThreadSerializationProviderShape {
|
||||
export class MainThreadSerializationProvider implements MainThreadSerializationProviderShape {
|
||||
|
||||
private _proxy: ExtHostSerializationProviderShape;
|
||||
|
||||
@@ -29,7 +29,6 @@ export class MainThreadSerializationProvider extends MainThreadSerializationProv
|
||||
@ISerializationService private serializationService: ISerializationService
|
||||
|
||||
) {
|
||||
super();
|
||||
if (extHostContext) {
|
||||
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostSerializationProvider);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import { ExtHostThreadService } from 'vs/workbench/services/thread/node/extHostT
|
||||
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 { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IExtensionApiFactory } from 'vs/workbench/api/node/extHost.api.impl';
|
||||
|
||||
export interface ISqlExtensionApiFactory {
|
||||
vsCodeFactory(extension: IExtensionDescription): typeof vscode;
|
||||
@@ -32,18 +34,17 @@ export interface ISqlExtensionApiFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method instantiates and returns the extension API surface. This overrides the default ApiFactory by extending it to add Carbon-related functions
|
||||
* This method instantiates and returns the extension API surface
|
||||
*/
|
||||
export function createApiFactory(
|
||||
initData: IInitData,
|
||||
threadService: ExtHostThreadService,
|
||||
extHostWorkspace: ExtHostWorkspace,
|
||||
extHostConfiguration: ExtHostConfiguration,
|
||||
extensionService: ExtHostExtensionService
|
||||
|
||||
|
||||
extensionService: ExtHostExtensionService,
|
||||
logService: ILogService
|
||||
): ISqlExtensionApiFactory {
|
||||
let vsCodeFactory = extHostApi.createApiFactory(initData, threadService, extHostWorkspace, extHostConfiguration, extensionService);
|
||||
let vsCodeFactory = extHostApi.createApiFactory(initData, threadService, extHostWorkspace, extHostConfiguration, extensionService, logService);
|
||||
|
||||
// Addressable instances
|
||||
const extHostAccountManagement = threadService.set(SqlExtHostContext.ExtHostAccountManagement, new ExtHostAccountManagement(threadService));
|
||||
|
||||
@@ -15,6 +15,7 @@ import 'sql/workbench/api/node/mainThreadDataProtocol';
|
||||
import 'sql/workbench/api/node/mainThreadSerializationProvider';
|
||||
import 'sql/workbench/api/node/mainThreadResourceProvider';
|
||||
import './mainThreadAccountManagement';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
|
||||
export class SqlExtHostContribution implements IWorkbenchContribution {
|
||||
|
||||
@@ -30,5 +31,6 @@ export class SqlExtHostContribution implements IWorkbenchContribution {
|
||||
|
||||
// Register File Tracker
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(
|
||||
SqlExtHostContribution
|
||||
SqlExtHostContribution,
|
||||
LifecyclePhase.Running
|
||||
);
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
import * as data from 'data';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
export abstract class ExtHostAccountManagementShape {
|
||||
$autoOAuthCancelled(handle: number): Thenable<void> { throw ni(); }
|
||||
$clear(handle: number, accountKey: data.AccountKey): Thenable<void> { throw ni(); }
|
||||
@@ -336,104 +336,69 @@ export abstract class ExtHostSerializationProviderShape {
|
||||
$saveAs(saveFormat: string, savePath: string, results: string, appendToFile: boolean): Thenable<data.SaveResultRequestResult> { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class MainThreadAccountManagementShape {
|
||||
$registerAccountProvider(providerMetadata: data.AccountProviderMetadata, handle: number): Thenable<any> { throw ni(); }
|
||||
$unregisterAccountProvider(handle: number): Thenable<any> { throw ni(); }
|
||||
export interface MainThreadAccountManagementShape extends IDisposable {
|
||||
$registerAccountProvider(providerMetadata: data.AccountProviderMetadata, handle: number): Thenable<any>;
|
||||
$unregisterAccountProvider(handle: number): Thenable<any>;
|
||||
|
||||
$beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Thenable<void> { throw ni(); }
|
||||
$endAutoOAuthDeviceCode(): void { throw ni(); }
|
||||
$beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Thenable<void>;
|
||||
$endAutoOAuthDeviceCode(): void;
|
||||
|
||||
$accountUpdated(updatedAccount: data.Account): void { throw ni(); }
|
||||
$accountUpdated(updatedAccount: data.Account): void;
|
||||
}
|
||||
|
||||
export abstract class MainThreadResourceProviderShape {
|
||||
$registerResourceProvider(providerMetadata: data.ResourceProviderMetadata, handle: number): Thenable<any> { throw ni(); }
|
||||
$unregisterResourceProvider(handle: number): Thenable<any> { throw ni(); }
|
||||
export interface MainThreadResourceProviderShape extends IDisposable {
|
||||
$registerResourceProvider(providerMetadata: data.ResourceProviderMetadata, handle: number): Thenable<any>;
|
||||
$unregisterResourceProvider(handle: number): Thenable<any>;
|
||||
}
|
||||
|
||||
export abstract class MainThreadDataProtocolShape {
|
||||
$registerConnectionProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerBackupProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerRestoreProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerScriptingProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerQueryProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerProfilerProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerObjectExplorerProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerMetadataProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerTaskServicesProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerFileBrowserProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerCapabilitiesServiceProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$registerAdminServicesProvider(providerId: string, handle: number): TPromise<any> { throw ni(); }
|
||||
$unregisterProvider(handle: number): TPromise<any> { throw ni(); }
|
||||
$onConnectionComplete(handle: number, connectionInfoSummary: data.ConnectionInfoSummary): void { throw ni(); }
|
||||
$onIntelliSenseCacheComplete(handle: number, connectionUri: string): void { throw ni(); }
|
||||
$onConnectionChangeNotification(handle: number, changedConnInfo: data.ChangedConnectionInfo): void { throw ni(); }
|
||||
$onQueryComplete(handle: number, result: data.QueryExecuteCompleteNotificationResult): void { throw ni(); }
|
||||
$onBatchStart(handle: number, batchInfo: data.QueryExecuteBatchNotificationParams): void { throw ni(); }
|
||||
$onBatchComplete(handle: number, batchInfo: data.QueryExecuteBatchNotificationParams): void { throw ni(); }
|
||||
$onResultSetComplete(handle: number, resultSetInfo: data.QueryExecuteResultSetCompleteNotificationParams): void { throw ni(); }
|
||||
$onQueryMessage(handle: number, message: data.QueryExecuteMessageParams): void { throw ni(); }
|
||||
$onObjectExplorerSessionCreated(handle: number, message: data.ObjectExplorerSession): void { throw ni(); }
|
||||
$onObjectExplorerNodeExpanded(handle: number, message: data.ObjectExplorerExpandInfo): void { throw ni(); }
|
||||
$onTaskCreated(handle: number, sessionResponse: data.TaskInfo): void { throw ni(); }
|
||||
$onTaskStatusChanged(handle: number, sessionResponse: data.TaskProgressInfo): void { throw ni(); }
|
||||
$onFileBrowserOpened(handle: number, response: data.FileBrowserOpenedParams): void { throw ni(); }
|
||||
$onFolderNodeExpanded(handle: number, response: data.FileBrowserExpandedParams): void { throw ni(); }
|
||||
$onFilePathsValidated(handle: number, response: data.FileBrowserValidatedParams): void { throw ni(); }
|
||||
$onScriptingComplete(handle: number, message: data.ScriptingCompleteResult): void { throw ni(); }
|
||||
$onSessionEventsAvailable(handle: number, response: data.ProfilerSessionEvents): void { throw ni(); }
|
||||
export interface MainThreadDataProtocolShape extends IDisposable {
|
||||
$registerConnectionProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$registerBackupProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$registerRestoreProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$registerScriptingProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$registerQueryProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$registerProfilerProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$registerObjectExplorerProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$registerMetadataProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$registerTaskServicesProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$registerFileBrowserProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$registerCapabilitiesServiceProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$registerAdminServicesProvider(providerId: string, handle: number): TPromise<any>;
|
||||
$unregisterProvider(handle: number): TPromise<any>;
|
||||
$onConnectionComplete(handle: number, connectionInfoSummary: data.ConnectionInfoSummary): void;
|
||||
$onIntelliSenseCacheComplete(handle: number, connectionUri: string): void;
|
||||
$onConnectionChangeNotification(handle: number, changedConnInfo: data.ChangedConnectionInfo): void;
|
||||
$onQueryComplete(handle: number, result: data.QueryExecuteCompleteNotificationResult): void;
|
||||
$onBatchStart(handle: number, batchInfo: data.QueryExecuteBatchNotificationParams): void;
|
||||
$onBatchComplete(handle: number, batchInfo: data.QueryExecuteBatchNotificationParams): void;
|
||||
$onResultSetComplete(handle: number, resultSetInfo: data.QueryExecuteResultSetCompleteNotificationParams): void;
|
||||
$onQueryMessage(handle: number, message: data.QueryExecuteMessageParams): void;
|
||||
$onObjectExplorerSessionCreated(handle: number, message: data.ObjectExplorerSession): void;
|
||||
$onObjectExplorerNodeExpanded(handle: number, message: data.ObjectExplorerExpandInfo): void;
|
||||
$onTaskCreated(handle: number, sessionResponse: data.TaskInfo): void;
|
||||
$onTaskStatusChanged(handle: number, sessionResponse: data.TaskProgressInfo): void;
|
||||
$onFileBrowserOpened(handle: number, response: data.FileBrowserOpenedParams): void;
|
||||
$onFolderNodeExpanded(handle: number, response: data.FileBrowserExpandedParams): void;
|
||||
$onFilePathsValidated(handle: number, response: data.FileBrowserValidatedParams): void;
|
||||
$onScriptingComplete(handle: number, message: data.ScriptingCompleteResult): void;
|
||||
$onSessionEventsAvailable(handle: number, response: data.ProfilerSessionEvents): void;
|
||||
|
||||
/**
|
||||
* Callback when a session has completed initialization
|
||||
*/
|
||||
$onEditSessionReady(handle: number, ownerUri: string, success: boolean, message: string) { throw ni(); }
|
||||
$onEditSessionReady(handle: number, ownerUri: string, success: boolean, message: string);
|
||||
}
|
||||
|
||||
export abstract class MainThreadCredentialManagementShape {
|
||||
$registerCredentialProvider(handle: number): TPromise<any> { throw ni(); }
|
||||
$unregisterCredentialProvider(handle: number): TPromise<any> { throw ni(); }
|
||||
export interface MainThreadCredentialManagementShape extends IDisposable {
|
||||
$registerCredentialProvider(handle: number): TPromise<any>;
|
||||
$unregisterCredentialProvider(handle: number): TPromise<any>;
|
||||
}
|
||||
|
||||
export abstract class MainThreadSerializationProviderShape {
|
||||
$registerSerializationProvider(handle: number): TPromise<any> { throw ni(); }
|
||||
$unregisterSerializationProvider(handle: number): TPromise<any> { throw ni(); }
|
||||
export interface MainThreadSerializationProviderShape extends IDisposable {
|
||||
$registerSerializationProvider(handle: number): TPromise<any>;
|
||||
$unregisterSerializationProvider(handle: number): TPromise<any>;
|
||||
}
|
||||
|
||||
// export class SqlInstanceCollection {
|
||||
// private _items: { [id: string]: any; };
|
||||
|
||||
// constructor() {
|
||||
// this._items = Object.create(null);
|
||||
// }
|
||||
|
||||
// public define<T>(id: ProxyIdentifier<T>): InstanceSetter<T> {
|
||||
// let that = this;
|
||||
// return new class {
|
||||
// set<R extends T>(value: T): R {
|
||||
// that._set(id, value);
|
||||
// return <R>value;
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
|
||||
// _set<T>(id: ProxyIdentifier<T>, value: T): void {
|
||||
// this._items[id.id] = value;
|
||||
// }
|
||||
|
||||
// public finish(isMain: boolean, threadService: IThreadService): void {
|
||||
// let expected = (isMain ? SqlMainContext : SqlExtHostContext);
|
||||
// Object.keys(expected).forEach((key) => {
|
||||
// let id = expected[key];
|
||||
// let value = this._items[id.id];
|
||||
|
||||
// if (!value) {
|
||||
// throw new Error(`Missing actor ${key} (isMain: ${id.isMain}, id: ${id.id})`);
|
||||
// }
|
||||
// threadService.set<any>(id, value);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
function ni() { return new Error('Not implemented'); }
|
||||
|
||||
// --- proxy identifiers
|
||||
|
||||
@@ -13,6 +13,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { ShowCurrentReleaseNotesAction, ProductContribution } from 'sql/workbench/update/releaseNotes';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
|
||||
const backupSchema: IJSONSchema = {
|
||||
description: nls.localize('carbon.actions.back', 'Open up backup dialog'),
|
||||
@@ -46,7 +47,7 @@ registerTask('configure-dashboard', '', configureDashboardSchema, Actions.Config
|
||||
|
||||
// add product update and release notes contributions
|
||||
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
|
||||
.registerWorkbenchContribution(ProductContribution);
|
||||
.registerWorkbenchContribution(ProductContribution, LifecyclePhase.Running);
|
||||
|
||||
Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions)
|
||||
.registerWorkbenchAction(new SyncActionDescriptor(ShowCurrentReleaseNotesAction, ShowCurrentReleaseNotesAction.ID, ShowCurrentReleaseNotesAction.LABEL), 'Show Getting Started');
|
||||
|
||||
@@ -21,12 +21,12 @@ import URI from 'vs/base/common/uri';
|
||||
* @returns {*}
|
||||
*/
|
||||
export function getSqlConfigSection(workspaceConfigService: IConfigurationService, sectionName: string): any {
|
||||
let config = workspaceConfigService.getConfiguration(ConnectionConstants.sqlConfigSectionName);
|
||||
let config = workspaceConfigService.getValue(ConnectionConstants.sqlConfigSectionName);
|
||||
return config ? config[sectionName] : {};
|
||||
}
|
||||
|
||||
export function getSqlConfigValue<T>(workspaceConfigService: IConfigurationService, configName: string): T {
|
||||
let config = workspaceConfigService.getConfiguration(ConnectionConstants.sqlConfigSectionName);
|
||||
let config = workspaceConfigService.getValue(ConnectionConstants.sqlConfigSectionName);
|
||||
return config[configName];
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export class ShowCurrentReleaseNotesAction extends AbstractShowReleaseNotesActio
|
||||
@IWorkbenchEditorService editorService: IWorkbenchEditorService,
|
||||
@IInstantiationService instantiationService: IInstantiationService
|
||||
) {
|
||||
super(id, label, true, pkg.version, editorService, instantiationService);
|
||||
super(id, label, pkg.version, editorService, instantiationService);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,9 +81,9 @@ function createInstantiationService(addAccountFailureEmitter?: Emitter<string>):
|
||||
|
||||
// Create a mocked out instantiation service
|
||||
let instantiationService = TypeMoq.Mock.ofType(InstantiationService, TypeMoq.MockBehavior.Strict);
|
||||
instantiationService.setup(x => x.createInstance<AccountViewModel>(TypeMoq.It.isValue(AccountViewModel)))
|
||||
instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AccountViewModel)))
|
||||
.returns(() => mockAccountViewModel.object);
|
||||
instantiationService.setup(x => x.createInstance<AccountListRenderer>(TypeMoq.It.isValue(AccountListRenderer)))
|
||||
instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AccountListRenderer)))
|
||||
.returns(() => undefined);
|
||||
|
||||
// Create a mock account dialog
|
||||
@@ -97,7 +97,7 @@ function createInstantiationService(addAccountFailureEmitter?: Emitter<string>):
|
||||
.returns(() => undefined);
|
||||
mockAccountDialog.setup(x => x.open())
|
||||
.returns(() => undefined);
|
||||
instantiationService.setup(x => x.createInstance<AccountDialog>(TypeMoq.It.isValue(AccountDialog)))
|
||||
instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AccountDialog)))
|
||||
.returns(() => mockAccountDialog.object);
|
||||
|
||||
return instantiationService.object;
|
||||
|
||||
@@ -94,7 +94,7 @@ function createInstantiationService(): InstantiationService {
|
||||
|
||||
// Create a mocked out instantiation service
|
||||
let instantiationService = TypeMoq.Mock.ofType(InstantiationService, TypeMoq.MockBehavior.Strict);
|
||||
instantiationService.setup(x => x.createInstance<AccountPickerViewModel>(TypeMoq.It.isValue(AccountPickerViewModel), TypeMoq.It.isAny()))
|
||||
instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AccountPickerViewModel), TypeMoq.It.isAny()))
|
||||
.returns(() => mockAccountViewModel.object);
|
||||
|
||||
// Create a mock account picker
|
||||
@@ -113,7 +113,7 @@ function createInstantiationService(): InstantiationService {
|
||||
.returns((container) => undefined);
|
||||
mockAccountDialog.setup(x => x.createAccountPickerComponent());
|
||||
|
||||
instantiationService.setup(x => x.createInstance<AccountPicker>(TypeMoq.It.isValue(AccountPicker), TypeMoq.It.isAny()))
|
||||
instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AccountPicker), TypeMoq.It.isAny()))
|
||||
.returns(() => mockAccountDialog.object);
|
||||
|
||||
return instantiationService.object;
|
||||
|
||||
@@ -52,7 +52,7 @@ suite('auto OAuth dialog controller tests', () => {
|
||||
|
||||
// Create a mocked out instantiation service
|
||||
instantiationService = TypeMoq.Mock.ofType(InstantiationService, TypeMoq.MockBehavior.Strict);
|
||||
instantiationService.setup(x => x.createInstance<AutoOAuthDialog>(TypeMoq.It.isValue(AutoOAuthDialog)))
|
||||
instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AutoOAuthDialog)))
|
||||
.returns(() => mockAutoOAuthDialog.object);
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ suite('Firewall rule dialog controller tests', () => {
|
||||
|
||||
// Create a mocked out instantiation service
|
||||
instantiationService = TypeMoq.Mock.ofType(InstantiationService, TypeMoq.MockBehavior.Strict);
|
||||
instantiationService.setup(x => x.createInstance<FirewallRuleViewModel>(TypeMoq.It.isValue(FirewallRuleViewModel)))
|
||||
instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(FirewallRuleViewModel)))
|
||||
.returns(() => mockFirewallRuleViewModel.object);
|
||||
|
||||
// Create a mock account picker
|
||||
@@ -73,7 +73,7 @@ suite('Firewall rule dialog controller tests', () => {
|
||||
mockFirewallRuleDialog.setup(x => x.open());
|
||||
mockFirewallRuleDialog.setup(x => x.close());
|
||||
|
||||
instantiationService.setup(x => x.createInstance<FirewallRuleDialog>(TypeMoq.It.isValue(FirewallRuleDialog)))
|
||||
instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(FirewallRuleDialog)))
|
||||
.returns(() => mockFirewallRuleDialog.object);
|
||||
|
||||
connectionProfile = {
|
||||
|
||||
@@ -10,7 +10,7 @@ import data = require('data');
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as assert from 'assert';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ServiceOptionType, ServiceOptionTypeNames } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
|
||||
suite('Advanced options helper tests', () => {
|
||||
var possibleInputs: string[];
|
||||
@@ -41,7 +41,7 @@ suite('Advanced options helper tests', () => {
|
||||
],
|
||||
defaultValue: null,
|
||||
isRequired: false,
|
||||
valueType: ServiceOptionType.category,
|
||||
valueType: <any>ServiceOptionTypeNames.category,
|
||||
objectType: undefined,
|
||||
isArray: undefined
|
||||
};
|
||||
@@ -54,7 +54,7 @@ suite('Advanced options helper tests', () => {
|
||||
categoryValues: null,
|
||||
defaultValue: null,
|
||||
isRequired: false,
|
||||
valueType: ServiceOptionType.boolean,
|
||||
valueType: <any>ServiceOptionTypeNames.boolean,
|
||||
objectType: undefined,
|
||||
isArray: undefined
|
||||
};
|
||||
@@ -67,7 +67,7 @@ suite('Advanced options helper tests', () => {
|
||||
categoryValues: null,
|
||||
defaultValue: '15',
|
||||
isRequired: false,
|
||||
valueType: ServiceOptionType.number,
|
||||
valueType: <any>ServiceOptionTypeNames.number,
|
||||
objectType: undefined,
|
||||
isArray: undefined
|
||||
};
|
||||
@@ -80,7 +80,7 @@ suite('Advanced options helper tests', () => {
|
||||
categoryValues: null,
|
||||
defaultValue: null,
|
||||
isRequired: false,
|
||||
valueType: ServiceOptionType.string,
|
||||
valueType: <any>ServiceOptionTypeNames.string,
|
||||
objectType: undefined,
|
||||
isArray: undefined
|
||||
};
|
||||
@@ -93,7 +93,7 @@ suite('Advanced options helper tests', () => {
|
||||
categoryValues: null,
|
||||
defaultValue: null,
|
||||
isRequired: false,
|
||||
valueType: ServiceOptionType.string,
|
||||
valueType: <any>ServiceOptionTypeNames.string,
|
||||
objectType: undefined,
|
||||
isArray: undefined
|
||||
};
|
||||
|
||||
@@ -130,7 +130,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
|
||||
// Setup configuration to return a config that can be modified later.
|
||||
workspaceConfigurationServiceMock = TypeMoq.Mock.ofType(WorkspaceConfigurationTestService);
|
||||
workspaceConfigurationServiceMock.setup(x => x.getConfiguration(Constants.sqlConfigSectionName))
|
||||
workspaceConfigurationServiceMock.setup(x => x.getValue(Constants.sqlConfigSectionName))
|
||||
.returns(() => configResult);
|
||||
|
||||
connectionManagementService = createConnectionManagementService();
|
||||
|
||||
@@ -168,7 +168,6 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
||||
let savedProfile = storedProfile;
|
||||
let connectionProfile = ConnectionProfile.createFromStoredProfile(savedProfile, msSQLCapabilities);
|
||||
assert.equal(savedProfile.groupId, connectionProfile.groupId);
|
||||
assert.deepEqual(savedProfile.options, connectionProfile.options);
|
||||
assert.deepEqual(savedProfile.providerName, connectionProfile.providerName);
|
||||
assert.deepEqual(savedProfile.savePassword, connectionProfile.savePassword);
|
||||
assert.deepEqual(savedProfile.id, connectionProfile.id);
|
||||
@@ -178,7 +177,6 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
||||
let savedProfile = Object.assign({}, storedProfile, { id: undefined });
|
||||
let connectionProfile = ConnectionProfile.createFromStoredProfile(savedProfile, msSQLCapabilities);
|
||||
assert.equal(savedProfile.groupId, connectionProfile.groupId);
|
||||
assert.deepEqual(savedProfile.options, connectionProfile.options);
|
||||
assert.deepEqual(savedProfile.providerName, connectionProfile.providerName);
|
||||
assert.equal(savedProfile.savePassword, connectionProfile.savePassword);
|
||||
assert.notEqual(connectionProfile.id, undefined);
|
||||
|
||||
@@ -85,7 +85,7 @@ suite('SQL ConnectionStore tests', () => {
|
||||
configResult[Constants.configMaxRecentConnections] = maxRecent;
|
||||
|
||||
workspaceConfigurationServiceMock = TypeMoq.Mock.ofType(WorkspaceConfigurationTestService);
|
||||
workspaceConfigurationServiceMock.setup(x => x.getConfiguration(Constants.sqlConfigSectionName))
|
||||
workspaceConfigurationServiceMock.setup(x => x.getValue(Constants.sqlConfigSectionName))
|
||||
.returns(() => configResult);
|
||||
|
||||
storageServiceMock = TypeMoq.Mock.ofType(StorageTestService);
|
||||
|
||||
@@ -13,7 +13,7 @@ import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
|
||||
import { IDbColumn, BatchSummary, QueryExecuteSubsetResult, ResultSetSubset } from 'data';
|
||||
import { EventEmitter } from 'vs/base/common/eventEmitter';
|
||||
import { EventEmitter } from 'sql/base/common/eventEmitter';
|
||||
import { equal } from 'assert';
|
||||
import { Mock, MockBehavior, It } from 'typemoq';
|
||||
|
||||
@@ -35,7 +35,7 @@ suite('Insights Dialog Controller Tests', () => {
|
||||
let { runner, complete } = getPrimedQueryRunner(testData, testColumns);
|
||||
|
||||
let instMoq = Mock.ofType(InstantiationService, MockBehavior.Strict);
|
||||
instMoq.setup(x => x.createInstance<QueryRunner>(It.isValue(QueryRunner), It.isAny(), undefined))
|
||||
instMoq.setup(x => x.createInstance(It.isValue(QueryRunner), It.isAny(), undefined))
|
||||
.returns(() => runner);
|
||||
|
||||
let connMoq = Mock.ofType(ConnectionManagementService, MockBehavior.Strict, {}, {});
|
||||
|
||||
@@ -445,7 +445,7 @@ suite('Account Management Service Tests:', () => {
|
||||
// ... Add mocking for instantiating an account dialog controller
|
||||
let mockDialogController = TypeMoq.Mock.ofType(AccountDialogController);
|
||||
mockDialogController.setup(x => x.openAccountDialog());
|
||||
state.instantiationService.setup(x => x.createInstance<AccountDialogController>(TypeMoq.It.isValue(AccountDialogController)))
|
||||
state.instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AccountDialogController)))
|
||||
.returns(() => mockDialogController.object);
|
||||
|
||||
// If: I open the account dialog when it doesn't exist
|
||||
@@ -453,7 +453,7 @@ suite('Account Management Service Tests:', () => {
|
||||
.then(() => {
|
||||
// Then:
|
||||
// ... The instantiation service should have been called once
|
||||
state.instantiationService.verify(x => x.createInstance<AccountDialogController>(TypeMoq.It.isValue(AccountDialogController)), TypeMoq.Times.once());
|
||||
state.instantiationService.verify(x => x.createInstance(TypeMoq.It.isValue(AccountDialogController)), TypeMoq.Times.once());
|
||||
|
||||
// ... The dialog should have been opened
|
||||
mockDialogController.verify(x => x.openAccountDialog(), TypeMoq.Times.once());
|
||||
@@ -472,7 +472,7 @@ suite('Account Management Service Tests:', () => {
|
||||
// ... Add mocking for instantiating an account dialog controller
|
||||
let mockDialogController = TypeMoq.Mock.ofType(AccountDialogController);
|
||||
mockDialogController.setup(x => x.openAccountDialog());
|
||||
state.instantiationService.setup(x => x.createInstance<AccountDialogController>(TypeMoq.It.isValue(AccountDialogController)))
|
||||
state.instantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AccountDialogController)))
|
||||
.returns(() => mockDialogController.object);
|
||||
|
||||
// If: I open the account dialog for a second time
|
||||
@@ -481,7 +481,7 @@ suite('Account Management Service Tests:', () => {
|
||||
.then(() => {
|
||||
// Then:
|
||||
// ... The instantiation service should have only been called once
|
||||
state.instantiationService.verify(x => x.createInstance<AccountDialogController>(TypeMoq.It.isValue(AccountDialogController)), TypeMoq.Times.once());
|
||||
state.instantiationService.verify(x => x.createInstance(TypeMoq.It.isValue(AccountDialogController)), TypeMoq.Times.once());
|
||||
|
||||
// ... The dialog should have been opened twice
|
||||
mockDialogController.verify(x => x.openAccountDialog(), TypeMoq.Times.exactly(2));
|
||||
@@ -559,7 +559,7 @@ function getTestState(): AccountManagementState {
|
||||
|
||||
// Create instantiation service
|
||||
let mockInstantiationService = TypeMoq.Mock.ofType(InstantiationService, TypeMoq.MockBehavior.Strict);
|
||||
mockInstantiationService.setup(x => x.createInstance<AccountStore>(TypeMoq.It.isValue(AccountStore), TypeMoq.It.isAny()))
|
||||
mockInstantiationService.setup(x => x.createInstance(TypeMoq.It.isValue(AccountStore), TypeMoq.It.isAny()))
|
||||
.returns(() => mockAccountStore.object);
|
||||
|
||||
// Create mock memento
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IContextKeyService, IContextKeyServiceTarget, IContextKey, ContextKeyExpr, IContext } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
||||
import { IContextKeyService, IContextKeyServiceTarget, IContextKey, ContextKeyExpr, IContext, IContextKeyChangeEvent } from 'vs/platform/contextkey/common/contextkey';
|
||||
import Event from 'vs/base/common/event';
|
||||
|
||||
export class ContextKeyServiceStub implements IContextKeyService {
|
||||
@@ -13,7 +14,7 @@ export class ContextKeyServiceStub implements IContextKeyService {
|
||||
//
|
||||
}
|
||||
|
||||
onDidChangeContext: Event<string[]>;
|
||||
onDidChangeContext: Event<IContextKeyChangeEvent>;
|
||||
|
||||
createKey<T>(key: string, defaultValue: T): IContextKey<T> {
|
||||
return undefined;
|
||||
|
||||
@@ -25,8 +25,8 @@ export class MessageServiceStub implements IMessageService{
|
||||
return undefined;
|
||||
}
|
||||
|
||||
confirm(confirmation: IConfirmation): TPromise<IConfirmationResult> {
|
||||
return undefined;
|
||||
confirm(confirmation: IConfirmation): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,4 +35,11 @@ export class MessageServiceStub implements IMessageService{
|
||||
confirmSync(confirmation: IConfirmation): boolean {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the user for confirmation with a checkbox.
|
||||
*/
|
||||
confirmWithCheckbox(confirmation: IConfirmation): TPromise<IConfirmationResult> {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@@ -16,20 +16,26 @@ import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
export class WorkspaceConfigurationTestService implements IWorkspaceConfigurationService {
|
||||
_serviceBrand: any;
|
||||
|
||||
getValue<T>(): T;
|
||||
getValue<T>(section: string): T;
|
||||
getValue<T>(overrides: IConfigurationOverrides): T;
|
||||
getValue<T>(section: string, overrides: IConfigurationOverrides): T;
|
||||
getValue(arg1?: any, arg2?: any): any {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
onDidChangeConfiguration: Event<IConfigurationChangeEvent>;
|
||||
|
||||
getConfigurationData(): IConfigurationData { return undefined; }
|
||||
|
||||
getConfiguration<T>(): T
|
||||
getConfiguration<T>(section: string): T
|
||||
getConfiguration<T>(overrides: IConfigurationOverrides): T
|
||||
getConfiguration<T>(section: string, overrides: IConfigurationOverrides): T
|
||||
getConfiguration<T>(): T;
|
||||
getConfiguration<T>(section: string): T;
|
||||
getConfiguration<T>(overrides: IConfigurationOverrides): T;
|
||||
getConfiguration<T>(section: string, overrides: IConfigurationOverrides): T;
|
||||
getConfiguration(arg1?: any, arg2?: any): any {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
getValue<T>(key: string, overrides?: IConfigurationOverrides): T { return undefined; }
|
||||
|
||||
updateValue(key: string, value: any): TPromise<void>
|
||||
updateValue(key: string, value: any, overrides: IConfigurationOverrides): TPromise<void>
|
||||
updateValue(key: string, value: any, target: ConfigurationTarget): TPromise<void>
|
||||
|
||||
+1
-1
@@ -15,4 +15,4 @@
|
||||
"typings"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/tsconfig",
|
||||
"compilerOptions": {
|
||||
"noEmit": true,
|
||||
"module": "amd",
|
||||
"moduleResolution": "classic",
|
||||
"noImplicitAny": false,
|
||||
"removeComments": false,
|
||||
"preserveConstEnums": true,
|
||||
"target": "es5",
|
||||
"sourceMap": false,
|
||||
"experimentalDecorators": true,
|
||||
"declaration": true,
|
||||
"noImplicitReturns": true,
|
||||
"baseUrl": ".",
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"typings/require.d.ts",
|
||||
"typings/thenable.d.ts",
|
||||
"typings/es6-promise.d.ts",
|
||||
"typings/lib.array-ext.d.ts",
|
||||
"typings/lib.ie11_safe_es6.d.ts",
|
||||
"vs/css.d.ts",
|
||||
"vs/monaco.d.ts",
|
||||
"vs/nls.d.ts",
|
||||
"vs/editor/*",
|
||||
"vs/base/common/*",
|
||||
"vs/base/browser/*",
|
||||
"vs/base/parts/tree/*",
|
||||
"vs/base/parts/quickopen/*",
|
||||
"vs/platform/*/common/*",
|
||||
"vs/platform/*/browser/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules/*"
|
||||
]
|
||||
}
|
||||
Vendored
+3
-3
@@ -2718,9 +2718,9 @@ declare module "fs" {
|
||||
export function writeFile(filename: string | number, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string | number, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFile(filename: string | number, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function writeFileSync(filename: string, data: any, encoding: string): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
||||
export function writeFileSync(filename: string | number, data: any, encoding: string): void;
|
||||
export function writeFileSync(filename: string | number, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void;
|
||||
export function writeFileSync(filename: string | number, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void;
|
||||
export function appendFile(filename: string, data: any, encoding: string, callback: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void;
|
||||
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
declare module 'spdlog' {
|
||||
|
||||
export const version: string;
|
||||
export function setAsyncMode(bufferSize: number, flushInterval: number);
|
||||
|
||||
export enum LogLevel {
|
||||
CRITICAL,
|
||||
ERROR,
|
||||
WARN,
|
||||
INFO,
|
||||
DEBUG,
|
||||
TRACE,
|
||||
OFF
|
||||
}
|
||||
|
||||
export class RotatingLogger {
|
||||
constructor(name: string, filename: string, filesize: number, filecount: number);
|
||||
|
||||
trace(message: string);
|
||||
debug(message: string);
|
||||
info(message: string);
|
||||
warn(message: string);
|
||||
error(message: string);
|
||||
critical(message: string);
|
||||
setLevel(level: number);
|
||||
flush(): void;
|
||||
drop(): void;
|
||||
}
|
||||
}
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
declare module 'v8-inspect-profiler' {
|
||||
|
||||
export interface ProfileResult {
|
||||
profile: Profile;
|
||||
}
|
||||
|
||||
export interface Profile {
|
||||
nodes: ProfileNode[];
|
||||
samples?: number[];
|
||||
timeDeltas?: number[];
|
||||
startTime: number;
|
||||
endTime: number;
|
||||
}
|
||||
|
||||
export interface ProfileNode {
|
||||
id: number;
|
||||
hitCount?: number;
|
||||
children?: number[];
|
||||
callFrame: {
|
||||
url: string;
|
||||
scriptId: string;
|
||||
functionName: string;
|
||||
lineNumber: number;
|
||||
columnNumber: number;
|
||||
};
|
||||
deoptReason?: string;
|
||||
positionTicks?: { line: number; ticks: number }[];
|
||||
}
|
||||
|
||||
export interface ProfilingSession {
|
||||
stop(afterDelay?: number): PromiseLike<ProfileResult>;
|
||||
}
|
||||
|
||||
export function startProfiling(options: { port: number, tries?: number, retyWait?: number }): PromiseLike<ProfilingSession>;
|
||||
export function writeProfile(profile: ProfileResult, name?: string): PromiseLike<void>;
|
||||
export function rewriteAbsolutePaths(profile, replaceWith?);
|
||||
}
|
||||
Vendored
+1
-1
@@ -364,7 +364,7 @@ declare module 'xterm' {
|
||||
* Scroll the display of the terminal
|
||||
* @param amount The number of lines to scroll down (negative scroll up).
|
||||
*/
|
||||
scrollDisp(amount: number): void;
|
||||
scrollLines(amount: number): void;
|
||||
|
||||
/**
|
||||
* Scroll the display of the terminal by a number of pages.
|
||||
|
||||
@@ -10,7 +10,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
class WindowManager {
|
||||
|
||||
public static INSTANCE = new WindowManager();
|
||||
public static readonly INSTANCE = new WindowManager();
|
||||
|
||||
// --- Zoom Level
|
||||
private _zoomLevel: number = 0;
|
||||
|
||||
+20
-567
@@ -70,30 +70,6 @@ let DATA_BINDING_ID = '__$binding';
|
||||
let LISTENER_BINDING_ID = '__$listeners';
|
||||
let VISIBILITY_BINDING_ID = '__$visibility';
|
||||
|
||||
export class Position {
|
||||
public x: number;
|
||||
public y: number;
|
||||
|
||||
constructor(x: number, y: number) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
|
||||
export class Box {
|
||||
public top: number;
|
||||
public right: number;
|
||||
public bottom: number;
|
||||
public left: number;
|
||||
|
||||
constructor(top: number, right: number, bottom: number, left: number) {
|
||||
this.top = top;
|
||||
this.right = right;
|
||||
this.bottom = bottom;
|
||||
this.left = left;
|
||||
}
|
||||
}
|
||||
|
||||
export class Dimension {
|
||||
public width: number;
|
||||
public height: number;
|
||||
@@ -102,15 +78,6 @@ export class Dimension {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public substract(box: Box): Dimension {
|
||||
return new Dimension(this.width - box.left - box.right, this.height - box.top - box.bottom);
|
||||
}
|
||||
}
|
||||
|
||||
export interface IRange {
|
||||
start: number;
|
||||
end: number;
|
||||
}
|
||||
|
||||
function data(element: any): any {
|
||||
@@ -169,32 +136,6 @@ export class Builder implements IDisposable {
|
||||
return builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Builder that performs all operations on the current element of the builder and
|
||||
* the builder or element being passed in.
|
||||
*/
|
||||
public and(element: HTMLElement): MultiBuilder;
|
||||
public and(builder: Builder): MultiBuilder;
|
||||
public and(obj: any): MultiBuilder {
|
||||
|
||||
// Convert HTMLElement to Builder as necessary
|
||||
if (!(obj instanceof Builder) && !(obj instanceof MultiBuilder)) {
|
||||
obj = new Builder((<HTMLElement>obj), this.offdom);
|
||||
}
|
||||
|
||||
// Wrap Builders into MultiBuilder
|
||||
let builders: Builder[] = [this];
|
||||
if (obj instanceof MultiBuilder) {
|
||||
for (let i = 0; i < (<MultiBuilder>obj).length; i++) {
|
||||
builders.push((<MultiBuilder>obj).item(i));
|
||||
}
|
||||
} else {
|
||||
builders.push(obj);
|
||||
}
|
||||
|
||||
return new MultiBuilder(builders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts all created elements of this builder as children to the given container. If the
|
||||
* container is not provided, the element that was passed into the Builder at construction
|
||||
@@ -362,18 +303,6 @@ export class Builder implements IDisposable {
|
||||
return this.doElement('ul', attributes, fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new element of this kind as child of the current element or parent.
|
||||
* Accepts an object literal as first parameter that can be used to describe the
|
||||
* attributes of the element.
|
||||
* Accepts a function as second parameter that can be used to create child elements
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public ol(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement('ol', attributes, fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new element of this kind as child of the current element or parent.
|
||||
* Accepts an object literal as first parameter that can be used to describe the
|
||||
@@ -422,42 +351,6 @@ export class Builder implements IDisposable {
|
||||
return this.doElement('a', attributes, fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new element of this kind as child of the current element or parent.
|
||||
* Accepts an object literal as first parameter that can be used to describe the
|
||||
* attributes of the element.
|
||||
* Accepts a function as second parameter that can be used to create child elements
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public header(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement('header', attributes, fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new element of this kind as child of the current element or parent.
|
||||
* Accepts an object literal as first parameter that can be used to describe the
|
||||
* attributes of the element.
|
||||
* Accepts a function as second parameter that can be used to create child elements
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public section(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement('section', attributes, fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new element of this kind as child of the current element or parent.
|
||||
* Accepts an object literal as first parameter that can be used to describe the
|
||||
* attributes of the element.
|
||||
* Accepts a function as second parameter that can be used to create child elements
|
||||
* of the element. The function will be called with a new builder created with the
|
||||
* provided element.
|
||||
*/
|
||||
public footer(attributes?: any, fn?: (builder: Builder) => void): Builder {
|
||||
return this.doElement('footer', attributes, fn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new element of given tag name as child of the current element or parent.
|
||||
* Accepts an object literal as first parameter that can be used to describe the
|
||||
@@ -514,30 +407,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the current element of this builder is the active element.
|
||||
*/
|
||||
public hasFocus(): boolean {
|
||||
let activeElement: Element = document.activeElement;
|
||||
|
||||
return (activeElement === this.currentElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls select() on the current HTML element;
|
||||
*/
|
||||
public domSelect(range: IRange = null): Builder {
|
||||
let input = <HTMLInputElement>this.currentElement;
|
||||
|
||||
input.select();
|
||||
|
||||
if (range) {
|
||||
input.setSelectionRange(range.start, range.end);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls blur() on the current HTML element;
|
||||
*/
|
||||
@@ -547,21 +416,12 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls click() on the current HTML element;
|
||||
*/
|
||||
public domClick(): Builder {
|
||||
this.currentElement.click();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers listener on event types on the current element.
|
||||
*/
|
||||
public on(type: string, fn: (e: Event, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public on(typeArray: string[], fn: (e: Event, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public on(arg1: any, fn: (e: Event, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder {
|
||||
public on<E extends Event = Event>(type: string, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public on<E extends Event = Event>(typeArray: string[], fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public on<E extends Event = Event>(arg1: any, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder {
|
||||
|
||||
// Event Type Array
|
||||
if (types.isArray(arg1)) {
|
||||
@@ -575,7 +435,7 @@ export class Builder implements IDisposable {
|
||||
let type = arg1;
|
||||
|
||||
// Add Listener
|
||||
let unbind: IDisposable = DOM.addDisposableListener(this.currentElement, type, (e: Event) => {
|
||||
let unbind: IDisposable = DOM.addDisposableListener(this.currentElement, type, (e) => {
|
||||
fn(e, this, unbind); // Pass in Builder as Second Argument
|
||||
}, useCapture || false);
|
||||
|
||||
@@ -637,13 +497,23 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
public overflow(overflow: string): Builder {
|
||||
this.currentElement.style.overflow = overflow;
|
||||
return this;
|
||||
}
|
||||
public background(color: string): Builder {
|
||||
this.currentElement.style.backgroundColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers listener on event types on the current element and removes
|
||||
* them after first invocation.
|
||||
*/
|
||||
public once(type: string, fn: (e: Event, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public once(typesArray: string[], fn: (e: Event, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public once(arg1: any, fn: (e: Event, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder {
|
||||
public once<E extends Event = Event>(type: string, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public once<E extends Event = Event>(typesArray: string[], fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public once<E extends Event = Event>(arg1: any, fn: (e: E, builder: Builder, unbind: IDisposable) => void, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder {
|
||||
|
||||
// Event Type Array
|
||||
if (types.isArray(arg1)) {
|
||||
@@ -657,7 +527,7 @@ export class Builder implements IDisposable {
|
||||
let type = arg1;
|
||||
|
||||
// Add Listener
|
||||
let unbind: IDisposable = DOM.addDisposableListener(this.currentElement, type, (e: Event) => {
|
||||
let unbind: IDisposable = DOM.addDisposableListener(this.currentElement, type, (e) => {
|
||||
fn(e, this, unbind); // Pass in Builder as Second Argument
|
||||
unbind.dispose();
|
||||
}, useCapture || false);
|
||||
@@ -671,30 +541,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers listener on event types on the current element and causes
|
||||
* the event to prevent default execution (e.preventDefault()). If the
|
||||
* parameter "cancelBubble" is set to true, it will also prevent bubbling
|
||||
* of the event.
|
||||
*/
|
||||
public preventDefault(type: string, cancelBubble: boolean, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public preventDefault(typesArray: string[], cancelBubble: boolean, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder;
|
||||
public preventDefault(arg1: any, cancelBubble: boolean, listenerToUnbindContainer?: IDisposable[], useCapture?: boolean): Builder {
|
||||
let fn = function (e: Event) {
|
||||
e.preventDefault();
|
||||
|
||||
if (cancelBubble) {
|
||||
if (e.stopPropagation) {
|
||||
e.stopPropagation();
|
||||
} else {
|
||||
e.cancelBubble = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return this.on(arg1, fn, listenerToUnbindContainer, useCapture);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method has different characteristics based on the parameter provided:
|
||||
* a) a single string passed in as argument will return the attribute value using the
|
||||
@@ -771,24 +617,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the src attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
public src(src: string): Builder {
|
||||
this.currentElement.setAttribute('src', src);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the href attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
public href(href: string): Builder {
|
||||
this.currentElement.setAttribute('href', href);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
@@ -798,15 +626,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
public name(name: string): Builder {
|
||||
this.currentElement.setAttribute('name', name);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
@@ -825,24 +644,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the alt attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
public alt(alt: string): Builder {
|
||||
this.currentElement.setAttribute('alt', alt);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name draggable to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
public draggable(isDraggable: boolean): Builder {
|
||||
this.currentElement.setAttribute('draggable', isDraggable ? 'true' : 'false');
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tabindex attribute to the value provided for the current HTML element of the builder.
|
||||
*/
|
||||
@@ -986,22 +787,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the first class to the current HTML element of the builder if the second class is currently set
|
||||
* and vice versa otherwise.
|
||||
*/
|
||||
public swapClass(classA: string, classB: string): Builder {
|
||||
if (this.hasClass(classA)) {
|
||||
this.removeClass(classA);
|
||||
this.addClass(classB);
|
||||
} else {
|
||||
this.removeClass(classB);
|
||||
this.addClass(classA);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds or removes the provided className for the current HTML element of the builder.
|
||||
*/
|
||||
@@ -1024,15 +809,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property background.
|
||||
*/
|
||||
public background(color: string): Builder {
|
||||
this.currentElement.style.backgroundColor = color;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property padding.
|
||||
*/
|
||||
@@ -1195,71 +971,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property float.
|
||||
*/
|
||||
public float(float: string): Builder {
|
||||
this.currentElement.style.cssFloat = float;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property clear.
|
||||
*/
|
||||
public clear(clear: string): Builder {
|
||||
this.currentElement.style.clear = clear;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property for fonts back to default.
|
||||
*/
|
||||
public normal(): Builder {
|
||||
this.currentElement.style.fontStyle = 'normal';
|
||||
this.currentElement.style.fontWeight = 'normal';
|
||||
this.currentElement.style.textDecoration = 'none';
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property font-style to italic.
|
||||
*/
|
||||
public italic(): Builder {
|
||||
this.currentElement.style.fontStyle = 'italic';
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property font-weight to bold.
|
||||
*/
|
||||
public bold(): Builder {
|
||||
this.currentElement.style.fontWeight = 'bold';
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property text-decoration to underline.
|
||||
*/
|
||||
public underline(): Builder {
|
||||
this.currentElement.style.textDecoration = 'underline';
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property overflow.
|
||||
*/
|
||||
public overflow(overflow: string): Builder {
|
||||
this.currentElement.style.overflow = overflow;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property display.
|
||||
*/
|
||||
@@ -1269,18 +980,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public disable(): Builder {
|
||||
this.currentElement.setAttribute('disabled', 'disabled');
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public enable(): Builder {
|
||||
this.currentElement.removeAttribute('disabled');
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the current element of the builder.
|
||||
*/
|
||||
@@ -1342,26 +1041,6 @@ export class Builder implements IDisposable {
|
||||
return this.hasClass('builder-hidden') || this.currentElement.style.display === 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles visibility of the current element of the builder.
|
||||
*/
|
||||
public toggleVisibility(): Builder {
|
||||
|
||||
// Cancel any pending showDelayed() invocation
|
||||
this.cancelVisibilityPromise();
|
||||
|
||||
this.swapClass('builder-visible', 'builder-hidden');
|
||||
|
||||
if (this.isHidden()) {
|
||||
this.attr('aria-hidden', 'true');
|
||||
}
|
||||
else {
|
||||
this.attr('aria-hidden', 'false');
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private cancelVisibilityPromise(): void {
|
||||
let promise: TPromise<void> = this.getProperty(VISIBILITY_BINDING_ID);
|
||||
if (promise) {
|
||||
@@ -1485,24 +1164,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property text-align.
|
||||
*/
|
||||
public textAlign(textAlign: string): Builder {
|
||||
this.currentElement.style.textAlign = textAlign;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the CSS property vertical-align.
|
||||
*/
|
||||
public verticalAlign(valign: string): Builder {
|
||||
this.currentElement.style.verticalAlign = valign;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private toPixel(obj: any): string {
|
||||
if (obj.toString().indexOf('px') === -1) {
|
||||
return obj.toString() + 'px';
|
||||
@@ -1553,32 +1214,6 @@ export class Builder implements IDisposable {
|
||||
return this.innerHtml(strings.escape(html), append);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the provided object as property to the current element. Call getBinding()
|
||||
* to retrieve it again.
|
||||
*/
|
||||
public bind(object: any): Builder {
|
||||
bindElement(this.currentElement, object);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the binding of the current element.
|
||||
*/
|
||||
public unbind(): Builder {
|
||||
unbindElement(this.currentElement);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the object that was passed into the bind() call.
|
||||
*/
|
||||
public getBinding(): any {
|
||||
return getBindingFromElement(this.currentElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to store arbritary data into the current element.
|
||||
*/
|
||||
@@ -1606,29 +1241,6 @@ export class Builder implements IDisposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new builder with the parent element of the current element of the builder.
|
||||
*/
|
||||
public parent(offdom?: boolean): Builder {
|
||||
assert.ok(!this.offdom, 'Builder was created with offdom = true and thus has no parent set');
|
||||
|
||||
return withElement(<HTMLElement>this.currentElement.parentNode, offdom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new builder with all child elements of the current element of the builder.
|
||||
*/
|
||||
public children(offdom?: boolean): MultiBuilder {
|
||||
let children = this.currentElement.children;
|
||||
|
||||
let builders: Builder[] = [];
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
builders.push(withElement(<HTMLElement>children.item(i), offdom));
|
||||
}
|
||||
|
||||
return new MultiBuilder(builders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new builder with the child at the given index.
|
||||
*/
|
||||
@@ -1638,55 +1250,6 @@ export class Builder implements IDisposable {
|
||||
return withElement(<HTMLElement>children.item(index));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the current HTMLElement from the given builder from this builder if this builders
|
||||
* current HTMLElement is the direct parent.
|
||||
*/
|
||||
public removeChild(builder: Builder): Builder {
|
||||
if (this.currentElement === builder.parent().getHTMLElement()) {
|
||||
this.currentElement.removeChild(builder.getHTMLElement());
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new builder with all elements matching the provided selector scoped to the
|
||||
* current element of the builder. Use Build.withElementsBySelector() to run the selector
|
||||
* over the entire DOM.
|
||||
* The returned builder is an instance of array that can have 0 elements if the selector does not match any
|
||||
* elements.
|
||||
*/
|
||||
public select(selector: string, offdom?: boolean): MultiBuilder {
|
||||
assert.ok(types.isString(selector), 'Expected String as parameter');
|
||||
|
||||
let elements = this.currentElement.querySelectorAll(selector);
|
||||
|
||||
let builders: Builder[] = [];
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
builders.push(withElement(<HTMLElement>elements.item(i), offdom));
|
||||
}
|
||||
|
||||
return new MultiBuilder(builders);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the current element of the builder matches the given selector and false otherwise.
|
||||
*/
|
||||
public matches(selector: string): boolean {
|
||||
let element = this.currentElement;
|
||||
let matches = (<any>element).webkitMatchesSelector || (<any>element).mozMatchesSelector || (<any>element).msMatchesSelector || (<any>element).oMatchesSelector;
|
||||
|
||||
return matches && matches.call(element, selector);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the current element of the builder has no children.
|
||||
*/
|
||||
public isEmpty(): boolean {
|
||||
return !this.currentElement.childNodes || this.currentElement.childNodes.length === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recurse through all descendant nodes and remove their data binding.
|
||||
*/
|
||||
@@ -1737,6 +1300,7 @@ export class Builder implements IDisposable {
|
||||
* Removes all HTML elements from the current element of the builder.
|
||||
*/
|
||||
public clearChildren(): Builder {
|
||||
|
||||
// Remove Elements
|
||||
if (this.currentElement) {
|
||||
DOM.clearNode(this.currentElement);
|
||||
@@ -1818,16 +1382,6 @@ export class Builder implements IDisposable {
|
||||
return new Dimension(totalWidth, totalHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the size (in pixels) of the inside of the element, excluding the border and padding.
|
||||
*/
|
||||
public getContentSize(): Dimension {
|
||||
let contentWidth = DOM.getContentWidth(this.currentElement);
|
||||
let contentHeight = DOM.getContentHeight(this.currentElement);
|
||||
|
||||
return new Dimension(contentWidth, contentHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Another variant of getting the inner dimensions of an element.
|
||||
*/
|
||||
@@ -1956,74 +1510,9 @@ export class MultiBuilder extends Builder {
|
||||
this.length = this.builders.length;
|
||||
}
|
||||
|
||||
public pop(): Builder {
|
||||
let element = this.builders.pop();
|
||||
this.length = this.builders.length;
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
public concat(items: Builder[]): Builder[] {
|
||||
let elements = this.builders.concat(items);
|
||||
this.length = this.builders.length;
|
||||
|
||||
return elements;
|
||||
}
|
||||
|
||||
public shift(): Builder {
|
||||
let element = this.builders.shift();
|
||||
this.length = this.builders.length;
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
public unshift(item: Builder): number {
|
||||
let res = this.builders.unshift(item);
|
||||
this.length = this.builders.length;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public slice(start: number, end?: number): Builder[] {
|
||||
let elements = this.builders.slice(start, end);
|
||||
this.length = this.builders.length;
|
||||
|
||||
return elements;
|
||||
}
|
||||
|
||||
public splice(start: number, deleteCount?: number): Builder[] {
|
||||
let elements = this.builders.splice(start, deleteCount);
|
||||
this.length = this.builders.length;
|
||||
|
||||
return elements;
|
||||
}
|
||||
|
||||
public clone(): MultiBuilder {
|
||||
return new MultiBuilder(this);
|
||||
}
|
||||
|
||||
public and(element: HTMLElement): MultiBuilder;
|
||||
public and(builder: Builder): MultiBuilder;
|
||||
public and(obj: any): MultiBuilder {
|
||||
|
||||
// Convert HTMLElement to Builder as necessary
|
||||
if (!(obj instanceof Builder) && !(obj instanceof MultiBuilder)) {
|
||||
obj = new Builder((<HTMLElement>obj));
|
||||
}
|
||||
|
||||
let builders: Builder[] = [];
|
||||
if (obj instanceof MultiBuilder) {
|
||||
for (let i = 0; i < (<MultiBuilder>obj).length; i++) {
|
||||
builders.push((<MultiBuilder>obj).item(i));
|
||||
}
|
||||
} else {
|
||||
builders.push(obj);
|
||||
}
|
||||
|
||||
this.push.apply(this, builders);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
function withBuilder(builder: Builder, offdom?: boolean): Builder {
|
||||
@@ -2034,7 +1523,7 @@ function withBuilder(builder: Builder, offdom?: boolean): Builder {
|
||||
return new Builder(builder.getHTMLElement(), offdom);
|
||||
}
|
||||
|
||||
function withElement(element: HTMLElement, offdom?: boolean): Builder {
|
||||
export function withElement(element: HTMLElement, offdom?: boolean): Builder {
|
||||
return new Builder(element, offdom);
|
||||
}
|
||||
|
||||
@@ -2065,15 +1554,6 @@ export function getPropertyFromElement(element: HTMLElement, key: string, fallba
|
||||
return fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a property from an element.
|
||||
*/
|
||||
export function removePropertyFromElement(element: HTMLElement, key: string): void {
|
||||
if (hasData(element)) {
|
||||
delete data(element)[key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the provided object as property to the given element. Call getBinding()
|
||||
* to retrieve it again.
|
||||
@@ -2082,29 +1562,6 @@ export function bindElement(element: HTMLElement, object: any): void {
|
||||
setPropertyOnElement(element, DATA_BINDING_ID, object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the binding of the given element.
|
||||
*/
|
||||
export function unbindElement(element: HTMLElement): void {
|
||||
removePropertyFromElement(element, DATA_BINDING_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the object that was passed into the bind() call for the element.
|
||||
*/
|
||||
export function getBindingFromElement(element: HTMLElement): any {
|
||||
return getPropertyFromElement(element, DATA_BINDING_ID);
|
||||
}
|
||||
|
||||
export const Binding = {
|
||||
setPropertyOnElement: setPropertyOnElement,
|
||||
getPropertyFromElement: getPropertyFromElement,
|
||||
removePropertyFromElement: removePropertyFromElement,
|
||||
bindElement: bindElement,
|
||||
unbindElement: unbindElement,
|
||||
getBindingFromElement: getBindingFromElement
|
||||
};
|
||||
|
||||
let SELECTOR_REGEX = /([\w\-]+)?(#([\w\-]+))?((.([\w\-]+))*)/;
|
||||
|
||||
export const $: QuickBuilder = function (arg?: any): Builder {
|
||||
@@ -2197,10 +1654,6 @@ export const $: QuickBuilder = function (arg?: any): Builder {
|
||||
}
|
||||
};
|
||||
|
||||
(<any>$).Box = Box;
|
||||
(<any>$).Dimension = Dimension;
|
||||
(<any>$).Position = Position;
|
||||
(<any>$).Builder = Builder;
|
||||
(<any>$).MultiBuilder = MultiBuilder;
|
||||
(<any>$).Build = Build;
|
||||
(<any>$).Binding = Binding;
|
||||
@@ -6,7 +6,6 @@
|
||||
'use strict';
|
||||
|
||||
import { $ } from 'vs/base/browser/builder';
|
||||
import URI from 'vs/base/common/uri';
|
||||
|
||||
/**
|
||||
* A helper that will execute a provided function when the provided HTMLElement receives
|
||||
@@ -40,42 +39,4 @@ export class DelayedDragHandler {
|
||||
public dispose(): void {
|
||||
this.clearDragTimeout();
|
||||
}
|
||||
}
|
||||
|
||||
export interface IDraggedResource {
|
||||
resource: URI;
|
||||
isExternal: boolean;
|
||||
}
|
||||
|
||||
export function extractResources(e: DragEvent, externalOnly?: boolean): IDraggedResource[] {
|
||||
const resources: IDraggedResource[] = [];
|
||||
if (e.dataTransfer.types.length > 0) {
|
||||
|
||||
// Check for in-app DND
|
||||
if (!externalOnly) {
|
||||
const rawData = e.dataTransfer.getData('URL');
|
||||
if (rawData) {
|
||||
try {
|
||||
resources.push({ resource: URI.parse(rawData), isExternal: false });
|
||||
} catch (error) {
|
||||
// Invalid URI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for native file transfer
|
||||
if (e.dataTransfer && e.dataTransfer.files) {
|
||||
for (let i = 0; i < e.dataTransfer.files.length; i++) {
|
||||
if (e.dataTransfer.files[i] && e.dataTransfer.files[i].path) {
|
||||
try {
|
||||
resources.push({ resource: URI.file(e.dataTransfer.files[i].path), isExternal: true });
|
||||
} catch (error) {
|
||||
// Invalid URI
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resources;
|
||||
}
|
||||
+72
-93
@@ -8,13 +8,13 @@ import * as platform from 'vs/base/common/platform';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { TimeoutTimer } from 'vs/base/common/async';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { EventEmitter } from 'vs/base/common/eventEmitter';
|
||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { isObject } from 'vs/base/common/types';
|
||||
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import { IKeyboardEvent, StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { IMouseEvent, StandardMouseEvent } from 'vs/base/browser/mouseEvent';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { domEvent } from 'vs/base/browser/event';
|
||||
|
||||
export function clearNode(node: HTMLElement) {
|
||||
while (node.firstChild) {
|
||||
@@ -22,31 +22,6 @@ export function clearNode(node: HTMLElement) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls JSON.Stringify with a replacer to break apart any circular references.
|
||||
* This prevents JSON.stringify from throwing the exception
|
||||
* "Uncaught TypeError: Converting circular structure to JSON"
|
||||
*/
|
||||
export function safeStringifyDOMAware(obj: any): string {
|
||||
let seen: any[] = [];
|
||||
return JSON.stringify(obj, (key, value) => {
|
||||
|
||||
// HTML elements are never going to serialize nicely
|
||||
if (value instanceof Element) {
|
||||
return '[Element]';
|
||||
}
|
||||
|
||||
if (isObject(value) || Array.isArray(value)) {
|
||||
if (seen.indexOf(value) !== -1) {
|
||||
return '[Circular]';
|
||||
} else {
|
||||
seen.push(value);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
});
|
||||
}
|
||||
|
||||
export function isInDOM(node: Node): boolean {
|
||||
while (node) {
|
||||
if (node === document.body) {
|
||||
@@ -57,7 +32,14 @@ export function isInDOM(node: Node): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
const _manualClassList = new class {
|
||||
interface IDomClassList {
|
||||
hasClass(node: HTMLElement, className: string): boolean;
|
||||
addClass(node: HTMLElement, className: string): void;
|
||||
removeClass(node: HTMLElement, className: string): void;
|
||||
toggleClass(node: HTMLElement, className: string, shouldHaveIt?: boolean): void;
|
||||
}
|
||||
|
||||
const _manualClassList = new class implements IDomClassList {
|
||||
|
||||
private _lastStart: number;
|
||||
private _lastEnd: number;
|
||||
@@ -159,7 +141,7 @@ const _manualClassList = new class {
|
||||
}
|
||||
};
|
||||
|
||||
const _nativeClassList = new class {
|
||||
const _nativeClassList = new class implements IDomClassList {
|
||||
hasClass(node: HTMLElement, className: string): boolean {
|
||||
return className && node.classList && node.classList.contains(className);
|
||||
}
|
||||
@@ -185,7 +167,7 @@ const _nativeClassList = new class {
|
||||
|
||||
// In IE11 there is only partial support for `classList` which makes us keep our
|
||||
// custom implementation. Otherwise use the native implementation, see: http://caniuse.com/#search=classlist
|
||||
const _classList = browser.isIE ? _manualClassList : _nativeClassList;
|
||||
const _classList: IDomClassList = browser.isIE ? _manualClassList : _nativeClassList;
|
||||
export const hasClass: (node: HTMLElement, className: string) => boolean = _classList.hasClass.bind(_classList);
|
||||
export const addClass: (node: HTMLElement, className: string) => void = _classList.addClass.bind(_classList);
|
||||
export const removeClass: (node: HTMLElement, className: string) => void = _classList.removeClass.bind(_classList);
|
||||
@@ -413,18 +395,23 @@ class AnimationFrameQueueItem implements IDisposable {
|
||||
/**
|
||||
* Add a throttled listener. `handler` is fired at most every 16ms or with the next animation frame (if browser supports it).
|
||||
*/
|
||||
export interface IEventMerger<R> {
|
||||
(lastEvent: R, currentEvent: Event): R;
|
||||
export interface IEventMerger<R, E> {
|
||||
(lastEvent: R, currentEvent: E): R;
|
||||
}
|
||||
|
||||
export interface DOMEvent {
|
||||
preventDefault(): void;
|
||||
stopPropagation(): void;
|
||||
}
|
||||
|
||||
const MINIMUM_TIME_MS = 16;
|
||||
const DEFAULT_EVENT_MERGER: IEventMerger<Event> = function (lastEvent: Event, currentEvent: Event) {
|
||||
const DEFAULT_EVENT_MERGER: IEventMerger<DOMEvent, DOMEvent> = function (lastEvent: DOMEvent, currentEvent: DOMEvent) {
|
||||
return currentEvent;
|
||||
};
|
||||
|
||||
class TimeoutThrottledDomListener<R> extends Disposable {
|
||||
class TimeoutThrottledDomListener<R, E extends DOMEvent> extends Disposable {
|
||||
|
||||
constructor(node: any, type: string, handler: (event: R) => void, eventMerger: IEventMerger<R> = <any>DEFAULT_EVENT_MERGER, minimumTimeMs: number = MINIMUM_TIME_MS) {
|
||||
constructor(node: any, type: string, handler: (event: R) => void, eventMerger: IEventMerger<R, E> = <any>DEFAULT_EVENT_MERGER, minimumTimeMs: number = MINIMUM_TIME_MS) {
|
||||
super();
|
||||
|
||||
let lastEvent: R = null;
|
||||
@@ -452,8 +439,8 @@ class TimeoutThrottledDomListener<R> extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
export function addDisposableThrottledListener<R>(node: any, type: string, handler: (event: R) => void, eventMerger?: IEventMerger<R>, minimumTimeMs?: number): IDisposable {
|
||||
return new TimeoutThrottledDomListener<R>(node, type, handler, eventMerger, minimumTimeMs);
|
||||
export function addDisposableThrottledListener<R, E extends DOMEvent = DOMEvent>(node: any, type: string, handler: (event: R) => void, eventMerger?: IEventMerger<R, E>, minimumTimeMs?: number): IDisposable {
|
||||
return new TimeoutThrottledDomListener<R, E>(node, type, handler, eventMerger, minimumTimeMs);
|
||||
}
|
||||
|
||||
export function getComputedStyle(el: HTMLElement): CSSStyleDeclaration {
|
||||
@@ -490,22 +477,13 @@ const sizeUtils = {
|
||||
getBorderTopWidth: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'border-top-width', 'borderTopWidth');
|
||||
},
|
||||
getBorderRightWidth: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'border-right-width', 'borderRightWidth');
|
||||
},
|
||||
getBorderBottomWidth: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'border-bottom-width', 'borderBottomWidth');
|
||||
},
|
||||
|
||||
getPaddingLeft: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'padding-left', 'paddingLeft');
|
||||
},
|
||||
getPaddingTop: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'padding-top', 'paddingTop');
|
||||
},
|
||||
getPaddingRight: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'padding-right', 'paddingRight');
|
||||
},
|
||||
getPaddingBottom: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'padding-bottom', 'paddingBottom');
|
||||
},
|
||||
@@ -522,7 +500,23 @@ const sizeUtils = {
|
||||
getMarginBottom: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'margin-bottom', 'marginBottom');
|
||||
},
|
||||
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
getPaddingLeft: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'padding-left', 'paddingLeft');
|
||||
},
|
||||
getPaddingRight: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'padding-right', 'paddingRight');
|
||||
},
|
||||
getBorderRightWidth: function (element: HTMLElement): number {
|
||||
return getDimension(element, 'border-right-width', 'borderRightWidth');
|
||||
},
|
||||
|
||||
|
||||
__commaSentinel: false
|
||||
|
||||
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@@ -601,14 +595,6 @@ export const StandardWindow: IStandardWindow = new class {
|
||||
}
|
||||
};
|
||||
|
||||
// Adapted from WinJS
|
||||
// Gets the width of the content of the specified element. The content width does not include borders or padding.
|
||||
export function getContentWidth(element: HTMLElement): number {
|
||||
let border = sizeUtils.getBorderLeftWidth(element) + sizeUtils.getBorderRightWidth(element);
|
||||
let padding = sizeUtils.getPaddingLeft(element) + sizeUtils.getPaddingRight(element);
|
||||
return element.offsetWidth - border - padding;
|
||||
}
|
||||
|
||||
// Adapted from WinJS
|
||||
// Gets the width of the element, including margins.
|
||||
export function getTotalWidth(element: HTMLElement): number {
|
||||
@@ -629,6 +615,16 @@ export function getContentHeight(element: HTMLElement): number {
|
||||
return element.offsetHeight - border - padding;
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
// Adapted from WinJS
|
||||
// Gets the width of the content of the specified element. The content width does not include borders or padding.
|
||||
export function getContentWidth(element: HTMLElement): number {
|
||||
let border = sizeUtils.getBorderLeftWidth(element) + sizeUtils.getBorderRightWidth(element);
|
||||
let padding = sizeUtils.getPaddingLeft(element) + sizeUtils.getPaddingRight(element);
|
||||
return element.offsetWidth - border - padding;
|
||||
}
|
||||
|
||||
|
||||
// Adapted from WinJS
|
||||
// Gets the height of the element, including its margins.
|
||||
export function getTotalHeight(element: HTMLElement): number {
|
||||
@@ -714,23 +710,6 @@ export function createCSSRule(selector: string, cssText: string, style: HTMLStyl
|
||||
(<CSSStyleSheet>style.sheet).insertRule(selector + '{' + cssText + '}', 0);
|
||||
}
|
||||
|
||||
export function getCSSRule(selector: string, style: HTMLStyleElement = sharedStyle): any {
|
||||
if (!style) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let rules = getDynamicStyleSheetRules(style);
|
||||
for (let i = 0; i < rules.length; i++) {
|
||||
let rule = rules[i];
|
||||
let normalizedSelectorText = rule.selectorText.replace(/::/gi, ':');
|
||||
if (normalizedSelectorText === selector) {
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export function removeCSSRulesContainingSelector(ruleName: string, style = sharedStyle): void {
|
||||
if (!style) {
|
||||
return;
|
||||
@@ -830,8 +809,8 @@ export const EventHelper = {
|
||||
};
|
||||
|
||||
export interface IFocusTracker {
|
||||
addBlurListener(fn: () => void): IDisposable;
|
||||
addFocusListener(fn: () => void): IDisposable;
|
||||
onDidFocus: Event<void>;
|
||||
onDidBlur: Event<void>;
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
@@ -853,49 +832,49 @@ export function restoreParentsScrollTop(node: Element, state: number[]): void {
|
||||
}
|
||||
}
|
||||
|
||||
class FocusTracker extends Disposable implements IFocusTracker {
|
||||
class FocusTracker implements IFocusTracker {
|
||||
|
||||
private _eventEmitter: EventEmitter;
|
||||
private _onDidFocus = new Emitter<void>();
|
||||
readonly onDidFocus: Event<void> = this._onDidFocus.event;
|
||||
|
||||
private _onDidBlur = new Emitter<void>();
|
||||
readonly onDidBlur: Event<void> = this._onDidBlur.event;
|
||||
|
||||
private disposables: IDisposable[] = [];
|
||||
|
||||
constructor(element: HTMLElement | Window) {
|
||||
super();
|
||||
|
||||
let hasFocus = false;
|
||||
let loosingFocus = false;
|
||||
|
||||
this._eventEmitter = this._register(new EventEmitter());
|
||||
|
||||
let onFocus = (event: Event) => {
|
||||
let onFocus = () => {
|
||||
loosingFocus = false;
|
||||
if (!hasFocus) {
|
||||
hasFocus = true;
|
||||
this._eventEmitter.emit('focus', {});
|
||||
this._onDidFocus.fire();
|
||||
}
|
||||
};
|
||||
|
||||
let onBlur = (event: Event) => {
|
||||
let onBlur = () => {
|
||||
if (hasFocus) {
|
||||
loosingFocus = true;
|
||||
window.setTimeout(() => {
|
||||
if (loosingFocus) {
|
||||
loosingFocus = false;
|
||||
hasFocus = false;
|
||||
this._eventEmitter.emit('blur', {});
|
||||
this._onDidBlur.fire();
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
|
||||
this._register(addDisposableListener(element, EventType.FOCUS, onFocus, true));
|
||||
this._register(addDisposableListener(element, EventType.BLUR, onBlur, true));
|
||||
domEvent(element, EventType.FOCUS, true)(onFocus, null, this.disposables);
|
||||
domEvent(element, EventType.BLUR, true)(onBlur, null, this.disposables);
|
||||
}
|
||||
|
||||
public addFocusListener(fn: () => void): IDisposable {
|
||||
return this._eventEmitter.addListener('focus', fn);
|
||||
}
|
||||
|
||||
public addBlurListener(fn: () => void): IDisposable {
|
||||
return this._eventEmitter.addListener('blur', fn);
|
||||
dispose(): void {
|
||||
this.disposables = dispose(this.disposables);
|
||||
this._onDidFocus.dispose();
|
||||
this._onDidBlur.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1024,7 +1003,7 @@ export function getElementsByTagName(tag: string): HTMLElement[] {
|
||||
return Array.prototype.slice.call(document.getElementsByTagName(tag), 0);
|
||||
}
|
||||
|
||||
export function finalHandler<T extends Event>(fn: (event: T) => any): (event: T) => any {
|
||||
export function finalHandler<T extends DOMEvent>(fn: (event: T) => any): (event: T) => any {
|
||||
return e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
@@ -64,14 +64,6 @@ export class FastDomNode<T extends HTMLElement> {
|
||||
this.domNode.style.width = this._width + 'px';
|
||||
}
|
||||
|
||||
public unsetWidth(): void {
|
||||
if (this._width === -1) {
|
||||
return;
|
||||
}
|
||||
this._width = -1;
|
||||
this.domNode.style.width = '';
|
||||
}
|
||||
|
||||
public setHeight(height: number): void {
|
||||
if (this._height === height) {
|
||||
return;
|
||||
@@ -80,14 +72,6 @@ export class FastDomNode<T extends HTMLElement> {
|
||||
this.domNode.style.height = this._height + 'px';
|
||||
}
|
||||
|
||||
public unsetHeight(): void {
|
||||
if (this._height === -1) {
|
||||
return;
|
||||
}
|
||||
this._height = -1;
|
||||
this.domNode.style.height = '';
|
||||
}
|
||||
|
||||
public setTop(top: number): void {
|
||||
if (this._top === top) {
|
||||
return;
|
||||
@@ -217,18 +201,10 @@ export class FastDomNode<T extends HTMLElement> {
|
||||
this.domNode.setAttribute(name, value);
|
||||
}
|
||||
|
||||
public getAttribute(name: string): string {
|
||||
return this.domNode.getAttribute(name);
|
||||
}
|
||||
|
||||
public removeAttribute(name: string): void {
|
||||
this.domNode.removeAttribute(name);
|
||||
}
|
||||
|
||||
public hasAttribute(name: string): boolean {
|
||||
return this.domNode.hasAttribute(name);
|
||||
}
|
||||
|
||||
public appendChild(child: FastDomNode<any>): void {
|
||||
this.domNode.appendChild(child.domNode);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ export class GlobalMouseMoveMonitor<R> extends Disposable {
|
||||
for (let i = 0; i < windowChain.length; i++) {
|
||||
this.hooks.push(dom.addDisposableThrottledListener(windowChain[i].window.document, 'mousemove',
|
||||
(data: R) => this.mouseMoveCallback(data),
|
||||
(lastEvent: R, currentEvent: MouseEvent) => this.mouseMoveEventMerger(lastEvent, currentEvent)
|
||||
(lastEvent: R, currentEvent) => this.mouseMoveEventMerger(lastEvent, currentEvent as MouseEvent)
|
||||
));
|
||||
this.hooks.push(dom.addDisposableListener(windowChain[i].window.document, 'mouseup', (e: MouseEvent) => this.stopMonitoring(true)));
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user