Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

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

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions
+32
View File
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
var path = require('path');
var fs = require('fs');
var loader = require('./vs/loader');
function uriFromPath(_path) {
@@ -16,9 +17,40 @@ function uriFromPath(_path) {
return encodeURI('file://' + pathName);
}
function readFile(file) {
return new Promise(function(resolve, reject) {
fs.readFile(file, 'utf8', function(err, data) {
if (err) {
reject(err);
return;
}
resolve(data);
});
});
}
var rawNlsConfig = process.env['VSCODE_NLS_CONFIG'];
var nlsConfig = rawNlsConfig ? JSON.parse(rawNlsConfig) : { availableLanguages: {} };
// We have a special location of the nls files. They come from a language pack
if (nlsConfig._resolvedLanguagePackCoreLocation) {
let bundles = Object.create(null);
nlsConfig.loadBundle = function(bundle, language, cb) {
let result = bundles[bundle];
if (result) {
cb(undefined, result);
return;
}
let bundleFile = path.join(nlsConfig._resolvedLanguagePackCoreLocation, bundle.replace(/\//g, '!') + '.nls.json');
readFile(bundleFile).then(function (content) {
let json = JSON.parse(content);
bundles[bundle] = json;
cb(undefined, json);
})
.catch(cb);
};
}
loader.config({
baseUrl: uriFromPath(__dirname),
catchError: true,
+23 -4
View File
@@ -3,10 +3,29 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// disable electron's asar support early on because bootstrap.js is used in forked processes
// where the environment is purely node based. this will instruct electron to not treat files
// with *.asar ending any special from normal files.
process.noAsar = true;
//#region Add support for using node_modules.asar
(function () {
const path = require('path');
const Module = require('module');
const NODE_MODULES_PATH = path.join(__dirname, '../node_modules');
const NODE_MODULES_ASAR_PATH = NODE_MODULES_PATH + '.asar';
const originalResolveLookupPaths = Module._resolveLookupPaths;
Module._resolveLookupPaths = function (request, parent) {
const result = originalResolveLookupPaths(request, parent);
const paths = result[1];
for (let i = 0, len = paths.length; i < len; i++) {
if (paths[i] === NODE_MODULES_PATH) {
paths.splice(i, 0, NODE_MODULES_ASAR_PATH);
break;
}
}
return result;
};
})();
//#endregion
// Will be defined if we got forked from another node process
// In that case we override console.log/warn/error to be able
+1
View File
@@ -10,6 +10,7 @@ exports.base = [{
append: [ 'vs/base/worker/workerMain' ],
dest: 'vs/base/worker/workerMain.js'
}];
//@ts-ignore review
exports.workbench = require('./vs/workbench/buildfile').collectModules(['vs/workbench/workbench.main']);
exports.code = require('./vs/code/buildfile').collectModules();
+24
View File
@@ -3,4 +3,28 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//#region Add support for using node_modules.asar
(function () {
const path = require('path');
const Module = require('module');
const NODE_MODULES_PATH = path.join(__dirname, '../node_modules');
const NODE_MODULES_ASAR_PATH = NODE_MODULES_PATH + '.asar';
const originalResolveLookupPaths = Module._resolveLookupPaths;
Module._resolveLookupPaths = function (request, parent) {
const result = originalResolveLookupPaths(request, parent);
const paths = result[1];
for (let i = 0, len = paths.length; i < len; i++) {
if (paths[i] === NODE_MODULES_PATH) {
paths.splice(i, 0, NODE_MODULES_ASAR_PATH);
break;
}
}
return result;
};
})();
//#endregion
require('./bootstrap-amd').bootstrap('vs/code/node/cli');
+382 -92
View File
@@ -2,44 +2,65 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
var perf = require('./vs/base/common/performance');
let perf = require('./vs/base/common/performance');
perf.mark('main:started');
// Perf measurements
global.perfStartTime = Date.now();
var app = require('electron').app;
var fs = require('fs');
var path = require('path');
var minimist = require('minimist');
var paths = require('./paths');
//#region Add support for using node_modules.asar
(function () {
const path = require('path');
const Module = require('module');
const NODE_MODULES_PATH = path.join(__dirname, '../node_modules');
const NODE_MODULES_ASAR_PATH = NODE_MODULES_PATH + '.asar';
var args = minimist(process.argv, {
const originalResolveLookupPaths = Module._resolveLookupPaths;
Module._resolveLookupPaths = function (request, parent) {
const result = originalResolveLookupPaths(request, parent);
const paths = result[1];
for (let i = 0, len = paths.length; i < len; i++) {
if (paths[i] === NODE_MODULES_PATH) {
paths.splice(i, 0, NODE_MODULES_ASAR_PATH);
break;
}
}
return result;
};
})();
//#endregion
let app = require('electron').app;
let fs = require('fs');
let path = require('path');
let minimist = require('minimist');
let paths = require('./paths');
let args = minimist(process.argv, {
string: ['user-data-dir', 'locale']
});
function stripComments(content) {
var regexp = /("(?:[^\\\"]*(?:\\.)?)*")|('(?:[^\\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
var result = content.replace(regexp, function (match, m1, m2, m3, m4) {
let regexp = /("(?:[^\\\"]*(?:\\.)?)*")|('(?:[^\\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
let result = content.replace(regexp, function (match, m1, m2, m3, m4) {
// Only one of m1, m2, m3, m4 matches
if (m3) {
// A block comment. Replace with nothing
return '';
}
else if (m4) {
} else if (m4) {
// A line comment. If it ends in \r?\n then keep it.
var length_1 = m4.length;
let length_1 = m4.length;
if (length_1 > 2 && m4[length_1 - 1] === '\n') {
return m4[length_1 - 2] === '\r' ? '\r\n' : '\n';
}
else {
return '';
}
}
else {
} else {
// We match a string
return match;
}
@@ -47,71 +68,322 @@ function stripComments(content) {
return result;
}
function getNLSConfiguration() {
var locale = args['locale'];
let _commit;
function getCommit() {
if (_commit) {
return _commit;
}
if (_commit === null) {
return undefined;
}
try {
let productJson = require(path.join(__dirname, '../product.json'));
if (productJson.commit) {
_commit = productJson.commit;
} else {
_commit = null;
}
} catch (exp) {
_commit = null;
}
return _commit || undefined;
}
if (!locale) {
var userData = app.getPath('userData');
var localeConfig = path.join(userData, 'User', 'locale.json');
if (fs.existsSync(localeConfig)) {
try {
var content = stripComments(fs.readFileSync(localeConfig, 'utf8'));
var value = JSON.parse(content).locale;
if (value && typeof value === 'string') {
locale = value;
function mkdirp(dir) {
return mkdir(dir)
.then(null, (err) => {
if (err && err.code === 'ENOENT') {
let parent = path.dirname(dir);
if (parent !== dir) { // if not arrived at root
return mkdirp(parent)
.then(() => {
return mkdir(dir);
});
}
}
throw err;
});
}
function mkdir(dir) {
return new Promise((resolve, reject) => {
fs.mkdir(dir, (err) => {
if (err && err.code !== 'EEXIST') {
reject(err);
} else {
resolve(dir);
}
});
});
}
function exists(file) {
return new Promise((resolve) => {
fs.exists(file, (result) => {
resolve(result);
});
});
}
function readFile(file) {
return new Promise((resolve, reject) => {
fs.readFile(file, 'utf8', (err, data) => {
if (err) {
reject(err);
return;
}
resolve(data);
});
});
}
function writeFile(file, content) {
return new Promise((resolve, reject) => {
fs.writeFile(file, content, 'utf8', (err) => {
if (err) {
reject(err);
return;
}
resolve(undefined);
});
});
}
function touch(file) {
return new Promise((resolve, reject) => {
let d = new Date();
fs.utimes(file, d, d, (err) => {
if (err) {
reject(err);
return;
}
resolve(undefined);
});
});
}
function resolveJSFlags() {
let jsFlags = [];
if (args['js-flags']) {
jsFlags.push(args['js-flags']);
}
if (args['max-memory'] && !/max_old_space_size=(\d+)/g.exec(args['js-flags'])) {
jsFlags.push(`--max_old_space_size=${args['max-memory']}`);
}
if (jsFlags.length > 0) {
return jsFlags.join(' ');
} else {
return null;
}
}
// Language tags are case insensitve however an amd loader is case sensitive
// To make this work on case preserving & insensitive FS we do the following:
// the language bundles have lower case language tags and we always lower case
// the locale we receive from the user or OS.
function getUserDefinedLocale() {
let locale = args['locale'];
if (locale) {
return Promise.resolve(locale.toLowerCase());
}
let userData = app.getPath('userData');
let localeConfig = path.join(userData, 'User', 'locale.json');
return exists(localeConfig).then((result) => {
if (result) {
return readFile(localeConfig).then((content) => {
content = stripComments(content);
try {
let value = JSON.parse(content).locale;
return value && typeof value === 'string' ? value.toLowerCase() : undefined;
} catch (e) {
return undefined;
}
});
} else {
return undefined;
}
});
}
function getLanguagePackConfigurations() {
let userData = app.getPath('userData');
let configFile = path.join(userData, 'languagepacks.json');
try {
return require(configFile);
} catch (err) {
// Do nothing. If we can't read the file we have no
// language pack config.
}
return undefined;
}
function resolveLanguagePackLocale(config, locale) {
try {
while (locale) {
if (config[locale]) {
return locale;
} else {
let index = locale.lastIndexOf('-');
if (index > 0) {
locale = locale.substring(0, index);
} else {
return undefined;
}
} catch (e) {
// noop
}
}
} catch (err) {
console.error('Resolving language pack configuration failed.', err);
}
return undefined;
}
function getNLSConfiguration(locale) {
if (locale === 'pseudo') {
return Promise.resolve({ locale: locale, availableLanguages: {}, pseudo: true });
}
var appLocale = app.getLocale();
locale = locale || appLocale;
// Language tags are case insensitve however an amd loader is case sensitive
// To make this work on case preserving & insensitive FS we do the following:
// the language bundles have lower case language tags and we always lower case
// the locale we receive from the user or OS.
locale = locale ? locale.toLowerCase() : locale;
if (locale === 'pseudo') {
return { locale: locale, availableLanguages: {}, pseudo: true };
}
var initialLocale = locale;
if (process.env['VSCODE_DEV']) {
return { locale: locale, availableLanguages: {} };
return Promise.resolve({ locale: locale, availableLanguages: {} });
}
let userData = app.getPath('userData');
// We have a built version so we have extracted nls file. Try to find
// the right file to use.
// Check if we have an English locale. If so fall to default since that is our
// English translation (we don't ship *.nls.en.json files)
if (locale && (locale == 'en' || locale.startsWith('en-'))) {
return { locale: locale, availableLanguages: {} };
return Promise.resolve({ locale: locale, availableLanguages: {} });
}
let initialLocale = locale;
function resolveLocale(locale) {
while (locale) {
var candidate = path.join(__dirname, 'vs', 'code', 'electron-main', 'main.nls.') + locale + '.js';
let candidate = path.join(__dirname, 'vs', 'code', 'electron-main', 'main.nls.') + locale + '.js';
if (fs.existsSync(candidate)) {
return { locale: initialLocale, availableLanguages: { '*': locale } };
} else {
var index = locale.lastIndexOf('-');
let index = locale.lastIndexOf('-');
if (index > 0) {
locale = locale.substring(0, index);
} else {
locale = null;
locale = undefined;
}
}
}
return null;
return undefined;
}
var resolvedLocale = resolveLocale(locale);
if (!resolvedLocale && appLocale && appLocale !== locale) {
resolvedLocale = resolveLocale(appLocale);
let isCoreLangaguage = true;
if (locale) {
isCoreLangaguage = ['de', 'es', 'fr', 'it', 'ja', 'ko', 'ru', 'zh-cn', 'zh-tw'].some((language) => {
return locale === language || locale.startsWith(language + '-');
});
}
if (isCoreLangaguage) {
return Promise.resolve(resolveLocale(locale));
} else {
perf.mark('nlsGeneration:start');
let defaultResult = function() {
perf.mark('nlsGeneration:end');
return Promise.resolve({ locale: locale, availableLanguages: {} });
};
try {
let commit = getCommit();
if (!commit) {
return defaultResult();
}
let configs = getLanguagePackConfigurations();
if (!configs) {
return defaultResult();
}
let initialLocale = locale;
locale = resolveLanguagePackLocale(configs, locale);
if (!locale) {
return defaultResult();
}
let packConfig = configs[locale];
let mainPack;
if (!packConfig || typeof packConfig.hash !== 'string' || !packConfig.translations || typeof (mainPack = packConfig.translations['vscode']) !== 'string') {
return defaultResult();
}
return exists(mainPack).then((fileExists) => {
if (!fileExists) {
return defaultResult();
}
let packId = packConfig.hash + '.' + locale;
let cacheRoot = path.join(userData, 'clp', packId);
let coreLocation = path.join(cacheRoot, commit);
let translationsConfigFile = path.join(cacheRoot, 'tcf.json');
let result = {
locale: initialLocale,
availableLanguages: { '*': locale },
_languagePackId: packId,
_translationsConfigFile: translationsConfigFile,
_cacheRoot: cacheRoot,
_resolvedLanguagePackCoreLocation: coreLocation
};
return exists(coreLocation).then((fileExists) => {
if (fileExists) {
// We don't wait for this. No big harm if we can't touch
touch(coreLocation).catch(() => {});
perf.mark('nlsGeneration:end');
return result;
}
return mkdirp(coreLocation).then(() => {
return Promise.all([readFile(path.join(__dirname, 'nls.metadata.json')), readFile(mainPack)]);
}).then((values) => {
let metadata = JSON.parse(values[0]);
let packData = JSON.parse(values[1]).contents;
let bundles = Object.keys(metadata.bundles);
let writes = [];
for (let bundle of bundles) {
let modules = metadata.bundles[bundle];
let target = Object.create(null);
for (let module of modules) {
let keys = metadata.keys[module];
let defaultMessages = metadata.messages[module];
let translations = packData[module];
let targetStrings;
if (translations) {
targetStrings = [];
for (let i = 0; i < keys.length; i++) {
let elem = keys[i];
let key = typeof elem === 'string' ? elem : elem.key;
let translatedMessage = translations[key];
if (translatedMessage === undefined) {
translatedMessage = defaultMessages[i];
}
targetStrings.push(translatedMessage);
}
} else {
targetStrings = defaultMessages;
}
target[module] = targetStrings;
}
writes.push(writeFile(path.join(coreLocation, bundle.replace(/\//g,'!') + '.nls.json'), JSON.stringify(target)));
}
writes.push(writeFile(translationsConfigFile, JSON.stringify(packConfig.translations)));
return Promise.all(writes);
}).then(() => {
perf.mark('nlsGeneration:end');
return result;
}).catch((err) => {
console.error('Generating translation files failed.', err);
return defaultResult();
});
});
});
} catch (err) {
console.error('Generating translation files failed.', err);
return defaultResult();
}
}
return resolvedLocale ? resolvedLocale : { locale: initialLocale, availableLanguages: {} };
}
function getNodeCachedDataDir() {
@@ -126,52 +398,24 @@ function getNodeCachedDataDir() {
}
// find commit id
var productJson = require(path.join(__dirname, '../product.json'));
if (!productJson.commit) {
let commit = getCommit();
if (!commit) {
return Promise.resolve(undefined);
}
var dir = path.join(app.getPath('userData'), 'CachedData', productJson.commit);
let dir = path.join(app.getPath('userData'), 'CachedData', commit);
return mkdirp(dir).then(undefined, function () { /*ignore*/ });
}
function mkdirp(dir) {
return mkdir(dir)
.then(null, function (err) {
if (err && err.code === 'ENOENT') {
var parent = path.dirname(dir);
if (parent !== dir) { // if not arrived at root
return mkdirp(parent)
.then(function () {
return mkdir(dir);
});
}
}
throw err;
});
}
function mkdir(dir) {
return new Promise(function (resolve, reject) {
fs.mkdir(dir, function (err) {
if (err && err.code !== 'EEXIST') {
reject(err);
} else {
resolve(dir);
}
});
});
}
// Set userData path before app 'ready' event and call to process.chdir
var userData = path.resolve(args['user-data-dir'] || paths.getDefaultUserDataPath(process.platform));
let userData = path.resolve(args['user-data-dir'] || paths.getDefaultUserDataPath(process.platform));
app.setPath('userData', userData);
// Update cwd based on environment and platform
try {
if (process.platform === 'win32') {
process.env['VSCODE_CWD'] = process.cwd(); // remember as environment variable
process.env['VSCODE_CWD'] = process.cwd(); // remember as environment letiable
process.chdir(path.dirname(app.getPath('exe'))); // always set application folder as cwd
} else if (process.env['VSCODE_CWD']) {
process.chdir(process.env['VSCODE_CWD']);
@@ -187,8 +431,8 @@ app.on('open-file', function (event, path) {
global.macOpenFiles.push(path);
});
var openUrls = [];
var onOpenUrl = function (event, url) {
let openUrls = [];
let onOpenUrl = function (event, url) {
event.preventDefault();
openUrls.push(url);
};
@@ -205,25 +449,71 @@ global.getOpenUrls = function () {
// use '<UserData>/CachedData'-directory to store
// node/v8 cached data.
var nodeCachedDataDir = getNodeCachedDataDir().then(function (value) {
let nodeCachedDataDir = getNodeCachedDataDir().then(function (value) {
if (value) {
// store the data directory
process.env['VSCODE_NODE_CACHED_DATA_DIR_' + process.pid] = value;
// tell v8 to not be lazy when parsing JavaScript. Generally this makes startup slower
// but because we generate cached data it makes subsequent startups much faster
app.commandLine.appendSwitch('--js-flags', '--nolazy');
let existingJSFlags = resolveJSFlags();
app.commandLine.appendSwitch('--js-flags', existingJSFlags ? existingJSFlags + ' --nolazy' : '--nolazy');
}
return value;
});
let nlsConfiguration = undefined;
let userDefinedLocale = getUserDefinedLocale();
userDefinedLocale.then((locale) => {
if (locale && !nlsConfiguration) {
nlsConfiguration = getNLSConfiguration(locale);
}
});
let jsFlags = resolveJSFlags();
if (jsFlags) {
app.commandLine.appendSwitch('--js-flags', jsFlags);
}
// 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);
nodeCachedDataDir.then(function () {
require('./bootstrap-amd').bootstrap('vs/code/electron-main/main');
Promise.all([nodeCachedDataDir, userDefinedLocale]).then((values) => {
let locale = values[1];
if (locale && !nlsConfiguration) {
nlsConfiguration = getNLSConfiguration(locale);
}
if (!nlsConfiguration) {
nlsConfiguration = Promise.resolve(undefined);
}
// We first need to test a user defined locale. If it fails we try the app locale.
// If that fails we fall back to English.
nlsConfiguration.then((nlsConfig) => {
let boot = (nlsConfig) => {
process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfig);
require('./bootstrap-amd').bootstrap('vs/code/electron-main/main');
};
// We recevied a valid nlsConfig from a user defined locale
if (nlsConfig) {
boot(nlsConfig);
} else {
// Try to use the app locale. Please note that the app locale is only
// valid after we have received the app ready event. This is why the
// code is here.
let appLocale = app.getLocale();
if (!appLocale) {
boot({ locale: 'en', availableLanguages: {} });
} else {
// See above the comment about the loader and case sensitiviness
appLocale = appLocale.toLowerCase();
getNLSConfiguration(appLocale).then((nlsConfig) => {
if (!nlsConfig) {
nlsConfig = { locale: appLocale, availableLanguages: {} };
}
boot(nlsConfig);
});
}
}
});
}, console.error);
});
@@ -43,11 +43,11 @@ export class DropdownList extends Dropdown {
if (_action) {
let button = new Button(_contentContainer);
button.label = _action.label;
this.toDispose.push(DOM.addDisposableListener(button.getElement(), DOM.EventType.CLICK, () => {
this.toDispose.push(DOM.addDisposableListener(button.element, DOM.EventType.CLICK, () => {
this._action.run();
this.hide();
}));
this.toDispose.push(DOM.addDisposableListener(button.getElement(), DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
this.toDispose.push(DOM.addDisposableListener(button.element, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
let event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.Enter)) {
e.stopPropagation();
+8 -2
View File
@@ -13,6 +13,7 @@ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { IContextViewProvider, AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { RenderOptions, renderFormattedText, renderText } from 'vs/base/browser/htmlContentRenderer';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
const $ = dom.$;
@@ -50,8 +51,13 @@ export class ListBox extends SelectBox {
private contextViewProvider: IContextViewProvider;
private isValid: boolean;
constructor(options: string[], selectedOption: string, contextViewProvider: IContextViewProvider, private _clipboardService: IClipboardService) {
super(options, 0);
constructor(
options: string[],
selectedOption: string,
contextViewProvider: IContextViewProvider,
private _clipboardService: IClipboardService) {
super(options, 0, contextViewProvider);
this.contextViewProvider = contextViewProvider;
this.isValid = true;
this.selectElement.multiple = true;
@@ -44,7 +44,7 @@ export function appendRowLink(container: Builder, label: string, labelClass: str
});
});
return new Builder(rowButton.getElement());
return new Builder(rowButton.element);
}
export function appendInputSelectBox(container: Builder, selectBox: SelectBox): SelectBox {
@@ -48,7 +48,7 @@ export function createOptionElement(option: sqlops.ServiceOption, rowContainer:
optionWidget.value = optionValue;
inputElement = this.findElement(rowContainer, 'input');
} else if (option.valueType === ServiceOptionType.category || option.valueType === ServiceOptionType.boolean) {
optionWidget = new SelectBox(possibleInputs, optionValue.toString());
optionWidget = new SelectBox(possibleInputs, optionValue.toString(), contextViewService);
DialogHelper.appendInputSelectBox(rowContainer, optionWidget);
inputElement = this.findElement(rowContainer, 'select-box');
} else if (option.valueType === ServiceOptionType.string || option.valueType === ServiceOptionType.password) {
@@ -18,7 +18,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { localize } from 'vs/nls';
import WebView from 'vs/workbench/parts/html/browser/webview';
import { Webview } from 'vs/workbench/parts/html/browser/webview';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
@@ -29,7 +29,7 @@ export class WebViewDialog extends Modal {
private _okButton: Button;
private _okLabel: string;
private _closeLabel: string;
private _webview: WebView;
private _webview: Webview;
private _html: string;
private _headerTitle: string;
@@ -89,14 +89,17 @@ export class WebViewDialog extends Modal {
protected renderBody(container: HTMLElement) {
new Builder(container).div({ 'class': 'webview-dialog' }, (bodyBuilder) => {
this._body = bodyBuilder.getHTMLElement();
this._webview = new WebView(this._body, this._webViewPartService.getContainer(Parts.EDITOR_PART),
this._webview = new Webview(
this._body,
this._webViewPartService.getContainer(Parts.EDITOR_PART),
this._themeService,
this._environmentService,
this._contextViewService,
undefined,
undefined,
{
allowScripts: true,
enableWrappedPostMessage: true,
hideFind: true
enableWrappedPostMessage: true
}
);
@@ -130,7 +133,7 @@ export class WebViewDialog extends Modal {
}
private updateDialogBody(): void {
this._webview.contents = [this.html];
this._webview.contents = this.html;
}
/* espace key */
@@ -16,8 +16,8 @@ import nls = require('vs/nls');
const $ = dom.$;
export interface ISelectBoxStyles extends vsISelectBoxStyles {
disabledSelectBackground?: Color,
disabledSelectForeground?: Color,
disabledSelectBackground?: Color;
disabledSelectForeground?: Color;
inputValidationInfoBorder?: Color;
inputValidationInfoBackground?: Color;
inputValidationWarningBorder?: Color;
@@ -46,8 +46,8 @@ export class SelectBox extends vsSelectBox {
private inputValidationErrorBackground: Color;
private element: HTMLElement;
constructor(options: string[], selectedOption: string, container?: HTMLElement, contextViewProvider?: IContextViewProvider) {
super(options, 0);
constructor(options: string[], selectedOption: string, contextViewProvider: IContextViewProvider, container?: HTMLElement) {
super(options, 0, contextViewProvider);
this._optionsDictionary = new Array();
for (var i = 0; i < options.length; i++) {
this._optionsDictionary[options[i]] = i;
@@ -115,7 +115,8 @@ export class SelectBox extends vsSelectBox {
}
public enable(): void {
this.selectElement.disabled = false;
//@SQLTODO
//this.selectElement.disabled = false;
this.selectBackground = this.enabledSelectBackground;
this.selectForeground = this.enabledSelectForeground;
this.selectBorder = this.enabledSelectBorder;
@@ -123,7 +124,8 @@ export class SelectBox extends vsSelectBox {
}
public disable(): void {
this.selectElement.disabled = true;
//@SQLTODO
//this.selectElement.disabled = true;
this.selectBackground = this.disabledSelectBackground;
this.selectForeground = this.disabledSelectForeground;
this.selectBorder = this.disabledSelectBorder;
+2 -2
View File
@@ -7,8 +7,8 @@ import * as path from 'path';
import * as os from 'os';
import URI from 'vs/base/common/uri';
import { UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { Schemas } from 'vs/base/common/network';
export const FILE_SCHEMA: string = 'file';
@@ -19,7 +19,7 @@ export function resolveCurrentDirectory(uri: string, rootPath: string): string {
// use current directory of the sql file if sql file is saved
if (sqlUri.scheme === FILE_SCHEMA) {
currentDirectory = path.dirname(sqlUri.fsPath);
} else if (sqlUri.scheme === UNTITLED_SCHEMA) {
} else if (sqlUri.scheme === Schemas.untitled) {
// if sql file is unsaved/untitled but a workspace is open use workspace root
let root = rootPath;
if (root) {
@@ -10,11 +10,13 @@ import Event, { Emitter } from 'vs/base/common/event';
import { localize } from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions';
import { IMessageService, IConfirmation, Severity } from 'vs/platform/message/common/message';
import { error } from 'sql/base/common/log';
import { IAccountManagementService } from 'sql/services/accountManagement/interfaces';
import { IErrorMessageService } from 'sql/parts/connection/common/connectionManagement';
import { IConfirmationService, IConfirmation } from 'vs/platform/dialogs/common/dialogs';
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
/**
* Actions to add a new account
@@ -79,7 +81,8 @@ export class RemoveAccountAction extends Action {
constructor(
private _account: sqlops.Account,
@IMessageService private _messageService: IMessageService,
@IConfirmationService private _confirmationService: IConfirmationService,
@INotificationService private _notificationService: INotificationService,
@IErrorMessageService private _errorMessageService: IErrorMessageService,
@IAccountManagementService private _accountManagementService: IAccountManagementService
) {
@@ -97,23 +100,26 @@ export class RemoveAccountAction extends Action {
type: 'question'
};
let confirmPromise: boolean = this._messageService.confirm(confirm);
if (!confirmPromise) {
return TPromise.as(false);
} else {
return new TPromise((resolve, reject) => {
self._accountManagementService.removeAccount(self._account.key)
.then(
(result) => { resolve(result); },
(err) => {
// Must handle here as this is an independent action
self._errorMessageService.showDialog(Severity.Error,
localize('removeAccountFailed', 'Failed to remove account'), err);
resolve(false);
}
);
});
}
return this._confirmationService.confirm(confirm).then(result => {
if (!result) {
return TPromise.as(false);
} else {
return new TPromise((resolve, reject) => {
self._accountManagementService.removeAccount(self._account.key)
.then(
(result) => { resolve(result); },
(err) => {
// Must handle here as this is an independent action
self._notificationService.notify({
severity: Severity.Error,
message: localize('removeAccountFailed', 'Failed to remove account')
});
resolve(false);
}
);
});
}
});
}
}
@@ -8,7 +8,7 @@
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { localize } from 'vs/nls';
import { join } from 'path';
@@ -7,10 +7,11 @@ import nls = require('vs/nls');
import { Action } from 'vs/base/common/actions';
import { TPromise } from 'vs/base/common/winjs.base';
import Event, { Emitter } from 'vs/base/common/event';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { INotificationService, INotificationActions } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
/**
* Workbench action to clear the recent connnections list
@@ -24,7 +25,7 @@ export class ClearRecentConnectionsAction extends Action {
id: string,
label: string,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IQuickOpenService private _quickOpenService: IQuickOpenService
) {
super(id, label);
@@ -36,7 +37,13 @@ export class ClearRecentConnectionsAction extends Action {
return self.promptToClearRecentConnectionsList().then(result => {
if (result) {
self._connectionManagementService.clearRecentConnectionsList();
self._messageService.show(Severity.Info, nls.localize('ClearedRecentConnections', 'Recent connections list cleared'));
const actions: INotificationActions = { primary: [ ] };
self._notificationService.notify({
severity: Severity.Info,
message: nls.localize('ClearedRecentConnections', 'Recent connections list cleared'),
actions
});
}
});
}
@@ -203,7 +203,9 @@ export class ConnectionDialogService implements IConnectionDialogService {
}
private handleShowUiComponent(input: OnShowUIResponse) {
this._currentProviderType = input.selectedProviderType;
if (input.selectedProviderType) {
this._currentProviderType = input.selectedProviderType;
}
this._model.providerName = this.getCurrentProviderName();
this._model = new ConnectionProfile(this._capabilitiesService, this._model);
@@ -30,12 +30,13 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { localize } from 'vs/nls';
import { ITree } from 'vs/base/parts/tree/browser/tree';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService, IConfirmation } from 'vs/platform/message/common/message';
import { IConfirmationService, IChoiceService, IConfirmation, IConfirmationResult, Choice } from 'vs/platform/dialogs/common/dialogs';
import * as styler from 'vs/platform/theme/common/styler';
import { TPromise } from 'vs/base/common/winjs.base';
import * as DOM from 'vs/base/browser/dom';
import { DialogService } from 'vs/workbench/services/dialogs/electron-browser/dialogs';
export interface OnShowUIResponse {
selectedProviderType: string;
@@ -89,7 +90,8 @@ export class ConnectionDialogWidget extends Modal {
@ITelemetryService telemetryService: ITelemetryService,
@IContextKeyService contextKeyService: IContextKeyService,
@IContextMenuService private _contextMenuService: IContextMenuService,
@IMessageService private _messageService: IMessageService
@IConfirmationService private _confirmationService: IConfirmationService,
@IContextViewService private _contextViewService: IContextViewService
) {
super(localize('connection', 'Connection'), TelemetryKeys.Connection, _partService, telemetryService, contextKeyService, { hasSpinner: true, hasErrors: true });
}
@@ -99,7 +101,7 @@ export class ConnectionDialogWidget extends Modal {
container.appendChild(connectionContainer.getHTMLElement());
this._bodyBuilder = new Builder(connectionContainer.getHTMLElement());
this._providerTypeSelectBox = new SelectBox(this.providerTypeOptions, this.selectedProviderType);
this._providerTypeSelectBox = new SelectBox(this.providerTypeOptions, this.selectedProviderType, this._contextViewService);
// Recent connection tab
let recentConnectionTab = $('.connection-recent-tab');
@@ -264,35 +266,15 @@ export class ConnectionDialogWidget extends Modal {
type: 'question'
};
// @SQLTODO
return new TPromise<boolean>((resolve, reject) => {
let confirmed: boolean = this._messageService.confirm(confirm);
if (confirmed) {
this._connectionManagementService.clearRecentConnectionsList();
this.open(false);
}
resolve(confirmed);
this._confirmationService.confirm(confirm).then((confirmed) => {
if (confirmed) {
this._connectionManagementService.clearRecentConnectionsList();
this.open(false);
}
resolve(confirmed);
});
});
//this._messageService.confirm(confirm).then(confirmation => {
// if (!confirmation.confirmed) {
// return TPromise.as(false);
// } else {
// this._connectionManagementService.clearRecentConnectionsList();
// this.open(false);
// return TPromise.as(true);
// }
// });
// return this._messageService.confirm(confirm).then(confirmation => {
// if (!confirmation.confirmed) {
// return TPromise.as(false);
// } else {
// this._connectionManagementService.clearRecentConnectionsList();
// this.open(false);
// return TPromise.as(true);
// }
// });
}
private createRecentConnectionList(): void {
@@ -97,14 +97,14 @@ export class ConnectionWidget {
} else {
authTypeOption.defaultValue = this.getAuthTypeDisplayName(Constants.sqlLogin);
}
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue);
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue, this._contextViewService);
}
this._providerName = providerName;
}
public createConnectionWidget(container: HTMLElement): void {
this._serverGroupOptions = [this.DefaultServerGroup];
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name);
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name, this._contextViewService);
this._previousGroupOption = this._serverGroupSelectBox.value;
this._builder = $().div({ class: 'connection-table' }, (modelTableContent) => {
modelTableContent.element('table', { class: 'connection-table-content' }, (tableContainer) => {
@@ -16,7 +16,6 @@ import { IConnectionManagementService } from 'sql/parts/connection/common/connec
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
import { IAction } from 'vs/base/common/actions';
import Event, { Emitter } from 'vs/base/common/event';
import { IMessageService } from 'vs/platform/message/common/message';
import mouse = require('vs/base/browser/mouseEvent');
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
@@ -27,7 +26,6 @@ export class RecentConnectionActionsProvider extends ContributableActionProvider
constructor(
@IInstantiationService private _instantiationService: IInstantiationService,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IMessageService private _messageService: IMessageService,
) {
super();
}
@@ -5,10 +5,8 @@
import * as types from 'vs/base/common/types';
import { generateUuid } from 'vs/base/common/uuid';
import { Registry } from 'vs/platform/registry/common/platform';
import { Severity } from 'vs/platform/message/common/message';
import { error } from 'sql/base/common/log';
import * as nls from 'vs/nls';
import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { Extensions, IInsightRegistry } from 'sql/platform/dashboard/common/insightRegistry';
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';
@@ -27,7 +27,6 @@ import { AngularDisposable } from 'sql/base/common/lifecycle';
import { Registry } from 'vs/platform/registry/common/platform';
import * as types from 'vs/base/common/types';
import { Severity } from 'vs/platform/message/common/message';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import * as nls from 'vs/nls';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
@@ -39,6 +38,7 @@ import * as objects from 'vs/base/common/objects';
import Event, { Emitter } from 'vs/base/common/event';
import { Action } from 'vs/base/common/actions';
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import Severity from 'vs/base/common/severity';
const dashboardRegistry = Registry.as<IDashboardRegistry>(DashboardExtensions.DashboardContributions);
@@ -97,7 +97,10 @@ export abstract class DashboardPage extends AngularDisposable {
protected init() {
this.dashboardService.dashboardContextKey.set(this.context);
if (!this.dashboardService.connectionManagementService.connectionInfo) {
this.dashboardService.messageService.show(Severity.Warning, nls.localize('missingConnectionInfo', 'No connection information could be found for this dashboard'));
this.dashboardService.notificationService.notify({
severity: Severity.Error,
message: nls.localize('missingConnectionInfo', 'No connection information could be found for this dashboard')
});
} else {
let tempWidgets = this.dashboardService.getSettings<Array<WidgetConfig>>([this.context, 'widgets'].join('.'));
this._widgetConfigLocation = 'default';
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { localize } from 'vs/nls';
import * as types from 'vs/base/common/types';
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { localize } from 'vs/nls';
import { join } from 'path';
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IExtensionPointUser } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IExtensionPointUser } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';
import { join } from 'path';
@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IExtensionPointUser } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';
@@ -7,7 +7,7 @@ import 'vs/css!./webviewContent';
import { Component, forwardRef, Input, OnInit, Inject, ChangeDetectorRef, ElementRef } from '@angular/core';
import Event, { Emitter } from 'vs/base/common/event';
import Webview from 'vs/workbench/parts/html/browser/webview';
import { Webview } from 'vs/workbench/parts/html/browser/webview';
import { Parts } from 'vs/workbench/services/part/common/partService';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { addDisposableListener, EventType } from 'vs/base/browser/dom';
@@ -80,7 +80,7 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
public setHtml(html: string): void {
this._html = html;
if (this._webview) {
this._webview.contents = [html];
this._webview.contents = html;
this._webview.layout();
}
}
@@ -102,21 +102,24 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
this._webview = new Webview(this._el.nativeElement,
this._dashboardService.partService.getContainer(Parts.EDITOR_PART),
this._dashboardService.themeService,
this._dashboardService.environmentService,
this._dashboardService.contextViewService,
undefined,
undefined,
{
allowScripts: true,
enableWrappedPostMessage: true,
hideFind: true
enableWrappedPostMessage: true
}
);
this._onMessageDisposable = this._webview.onMessage(e => {
this._onMessage.fire(e);
});
this._webview.style(this._dashboardService.themeService.getTheme());
if (this._html) {
this._webview.contents = [this._html];
this._webview.contents = this._html;
}
this._webview.layout();
}
@@ -36,7 +36,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IDisposable } from 'vs/base/common/lifecycle';
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { ConfigurationEditingService, IConfigurationValue } from 'vs/workbench/services/configuration/node/configurationEditingService';
import { IMessageService } from 'vs/platform/message/common/message';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IStorageService } from 'vs/platform/storage/common/storage';
import Event, { Emitter } from 'vs/base/common/event';
@@ -46,6 +45,8 @@ import { IPartService } from 'vs/workbench/services/part/common/partService';
import { deepClone } from 'vs/base/common/objects';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
const DASHBOARD_SETTINGS = 'dashboard';
@@ -131,7 +132,7 @@ export class DashboardServiceInterface extends AngularDisposable {
private _configService = this._bootstrapService.configurationService;
private _insightsDialogService = this._bootstrapService.insightsDialogService;
private _contextViewService = this._bootstrapService.contextViewService;
private _messageService = this._bootstrapService.messageService;
private _notificationService = this._bootstrapService.notificationService;
private _workspaceContextService = this._bootstrapService.workspaceContextService;
private _storageService = this._bootstrapService.storageService;
private _capabilitiesService = this._bootstrapService.capabilitiesService;
@@ -140,6 +141,7 @@ export class DashboardServiceInterface extends AngularDisposable {
private _dashboardWebviewService = this._bootstrapService.dashboardWebviewService;
private _partService = this._bootstrapService.partService;
private _angularEventingService = this._bootstrapService.angularEventingService;
private _environmentService = this._bootstrapService.environmentService;
/* Special Services */
private _metadataService: SingleConnectionMetadataService;
@@ -177,8 +179,8 @@ export class DashboardServiceInterface extends AngularDisposable {
super();
}
public get messageService(): IMessageService {
return this._messageService;
public get notificationService(): INotificationService {
return this._notificationService;
}
public get configurationEditingService(): ConfigurationEditingService {
@@ -229,6 +231,10 @@ export class DashboardServiceInterface extends AngularDisposable {
return this._queryManagementService;
}
public get environmentService(): IEnvironmentService {
return this._environmentService;
}
public get contextViewService(): IContextViewService {
return this._contextViewService;
}
@@ -329,11 +335,17 @@ export class DashboardServiceInterface extends AngularDisposable {
this._router.navigate(['database-dashboard']);
}
} else {
this.messageService.show(Severity.Error, nls.localize('dashboard.changeDatabaseFailure', "Failed to change database"));
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('dashboard.changeDatabaseFailure', "Failed to change database")
});
}
},
() => {
this.messageService.show(Severity.Error, nls.localize('dashboard.changeDatabaseFailure', "Failed to change database"));
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('dashboard.changeDatabaseFailure', "Failed to change database")
});
}
);
break;
@@ -9,7 +9,7 @@ import { Extensions as InsightExtensions, IInsightRegistry } from 'sql/platform/
import { IInsightsConfig } from './interfaces';
import { insightsContribution, insightsSchema } from 'sql/parts/dashboard/widgets/insights/insightsWidgetSchemas';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
const insightRegistry = Registry.as<IInsightRegistry>(InsightExtensions.InsightContribution);
@@ -127,8 +127,10 @@ export class TasksWidget extends DashboardWidget implements IDashboardWidget, On
let label = $('div').safeInnerHtml(types.isString(action.title) ? action.title : action.title.value);
let tile = $('div.task-tile').style('height', this._size + 'px').style('width', this._size + 'px');
let innerTile = $('div');
if (action.iconClass) {
let icon = $('span.icon').addClass(action.iconClass);
// @SQLTODO - iconPath shouldn't be used as a CSS class
if (action.iconPath && action.iconPath.dark) {
let icon = $('span.icon').addClass(action.iconPath.dark);
innerTile.append(icon);
}
innerTile.append(label);
@@ -5,7 +5,7 @@
import { Component, Inject, forwardRef, ChangeDetectorRef, OnInit, ViewChild, ElementRef } from '@angular/core';
import Webview from 'vs/workbench/parts/html/browser/webview';
import { Webview } from 'vs/workbench/parts/html/browser/webview';
import { Parts } from 'vs/workbench/services/part/common/partService';
import Event, { Emitter } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
@@ -58,7 +58,7 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
public setHtml(html: string): void {
this._html = html;
if (this._webview) {
this._webview.contents = [html];
this._webview.contents = html;
this._webview.layout();
}
}
@@ -96,15 +96,17 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
if (this._onMessageDisposable) {
this._onMessageDisposable.dispose();
}
this._webview = new Webview(this._el.nativeElement,
this._webview = new Webview(
this._el.nativeElement,
this._dashboardService.partService.getContainer(Parts.EDITOR_PART),
this._dashboardService.themeService,
this._dashboardService.environmentService,
this._dashboardService.contextViewService,
undefined,
undefined,
{
allowScripts: true,
enableWrappedPostMessage: true,
hideFind: true
enableWrappedPostMessage: true
}
);
this._onMessageDisposable = this._webview.onMessage(e => {
@@ -112,7 +114,7 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
});
this._webview.style(this._dashboardService.themeService.getTheme());
if (this._html) {
this._webview.contents = [this._html];
this._webview.contents = this._html;
}
this._webview.layout();
}
@@ -209,7 +209,7 @@ export class BackupComponent {
this.recoveryBox = new InputBox(this.recoveryModelElement.nativeElement, this._bootstrapService.contextViewService, { placeholder: this.recoveryModel });
// Set backup type
this.backupTypeSelectBox = new SelectBox([], '');
this.backupTypeSelectBox = new SelectBox([], '', this._bootstrapService.contextViewService);
this.backupTypeSelectBox.render(this.backupTypeElement.nativeElement);
// Set copy-only check box
@@ -264,13 +264,13 @@ export class BackupComponent {
this.removePathButton.title = localize('removeFile', 'Remove files');
// Set compression
this.compressionSelectBox = new SelectBox(this.compressionOptions, this.compressionOptions[0]);
this.compressionSelectBox = new SelectBox(this.compressionOptions, this.compressionOptions[0], this._bootstrapService.contextViewService);
this.compressionSelectBox.render(this.compressionElement.nativeElement);
// Set encryption
this.algorithmSelectBox = new SelectBox(this.encryptionAlgorithms, this.encryptionAlgorithms[0]);
this.algorithmSelectBox = new SelectBox(this.encryptionAlgorithms, this.encryptionAlgorithms[0], this._bootstrapService.contextViewService);
this.algorithmSelectBox.render(this.encryptionAlgorithmElement.nativeElement);
this.encryptorSelectBox = new SelectBox([], '');
this.encryptorSelectBox = new SelectBox([], '', this._bootstrapService.contextViewService);
this.encryptorSelectBox.render(this.encryptorElement.nativeElement);
// Set media
@@ -519,7 +519,7 @@ export class RestoreDialog extends Modal {
});
inputContainer.div({ class: 'dialog-input' }, (inputCellContainer) => {
selectBox = new SelectBox(options, selectedOption, inputCellContainer.getHTMLElement(), this._contextViewService);
selectBox = new SelectBox(options, selectedOption, this._contextViewService, inputCellContainer.getHTMLElement());
selectBox.render(inputCellContainer.getHTMLElement());
});
});
+13 -4
View File
@@ -6,13 +6,14 @@
import { TPromise } from 'vs/base/common/winjs.base';
import { EditorInput, EditorModel } from 'vs/workbench/common/editor';
import { IConnectionManagementService, IConnectableInput, INewConnectionParams } from 'sql/parts/connection/common/connectionManagement';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import Event, { Emitter } from 'vs/base/common/event';
import { EditSessionReadyParams } from 'sqlops';
import URI from 'vs/base/common/uri';
import nls = require('vs/nls');
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
/**
* Input for the EditDataEditor. This input is simply a wrapper around a QueryResultsInput for the QueryResultsEditor
@@ -35,7 +36,7 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
constructor(private _uri: URI, private _schemaName, private _tableName,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IQueryModelService private _queryModelService: IQueryModelService,
@IMessageService private _messageService: IMessageService
@INotificationService private notificationService: INotificationService
) {
super();
this._visible = false;
@@ -116,7 +117,11 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
} else {
this._refreshButtonEnabled = false;
this._stopButtonEnabled = false;
this._messageService.show(Severity.Error, result.message);
this.notificationService.notify({
severity: Severity.Error,
message: result.message
});
}
this._editorInitializing.fire(false);
this._updateTaskbar.fire(this);
@@ -128,7 +133,11 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
public onConnectReject(error?: string): void {
if (error) {
this._messageService.show(Severity.Error, nls.localize('connectionFailure', 'Edit Data Session Failed To Connect'));
this.notificationService.notify({
severity: Severity.Error,
message: nls.localize('connectionFailure', 'Edit Data Session Failed To Connect')
});
}
}
@@ -11,9 +11,11 @@ import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { EventEmitter } from 'sql/base/common/eventEmitter';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { EditDataEditor } from 'sql/parts/editData/editor/editDataEditor';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import nls = require('vs/nls');
import * as dom from 'vs/base/browser/dom';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { INotificationService, INotificationActions } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
const $ = dom.$;
/**
@@ -65,7 +67,7 @@ export class RefreshTableAction extends EditDataAction {
constructor(editor: EditDataEditor,
@IQueryModelService private _queryModelService: IQueryModelService,
@IConnectionManagementService _connectionManagementService: IConnectionManagementService,
@IMessageService private _messageService: IMessageService
@INotificationService private _notificationService: INotificationService,
) {
super(editor, RefreshTableAction.ID, RefreshTableAction.EnabledClass, _connectionManagementService);
this.label = nls.localize('editData.refresh', 'Refresh');
@@ -77,7 +79,10 @@ export class RefreshTableAction extends EditDataAction {
this._queryModelService.disposeEdit(input.uri).then((result) => {
this._queryModelService.initializeEdit(input.uri, input.schemaName, input.tableName, input.objectType, input.rowLimit);
}, error => {
this._messageService.show(Severity.Error, nls.localize('disposeEditFailure', 'Dispose Edit Failed With Error: ') + error);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('disposeEditFailure', 'Dispose Edit Failed With Error: ') + error
});
});
}
return TPromise.as(null);
@@ -147,12 +152,14 @@ export class ChangeMaxRowsActionItem extends EventEmitter implements IActionItem
private _options: string[];
private _currentOptionsIndex: number;
constructor(private _editor: EditDataEditor) {
constructor(
private _editor: EditDataEditor,
@IContextViewService contextViewService: IContextViewService) {
super();
this._options = ['200', '1000', '10000'];
this._currentOptionsIndex = 0;
this.toDispose = [];
this.selectBox = new SelectBox([], -1);
this.selectBox = new SelectBox([], -1, contextViewService);
this._registerListeners();
this._refreshOptions();
this.defaultRowCount = Number(this._options[this._currentOptionsIndex]);
@@ -96,7 +96,7 @@ export class FileBrowserDialog extends Modal {
let pathBuilder = DialogHelper.appendRow(tableContainer, pathLabel, 'file-input-label', 'file-input-box');
this._filePathInputBox = new InputBox(pathBuilder.getHTMLElement(), this._contextViewService);
this._fileFilterSelectBox = new SelectBox(['*'], '*');
this._fileFilterSelectBox = new SelectBox(['*'], '*', this._contextViewService);
let filterLabel = localize('fileFilter', 'Files of type');
let filterBuilder = DialogHelper.appendRow(tableContainer, filterLabel, 'file-input-label', 'file-input-box');
DialogHelper.appendInputSelectBox(filterBuilder, this._fileFilterSelectBox);
@@ -109,7 +109,7 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
this._initActionBar();
// Init chart type dropdown
this.chartTypesSelectBox = new SelectBox(insightRegistry.getAllIds(), this.getDefaultChartType());
this.chartTypesSelectBox = new SelectBox(insightRegistry.getAllIds(), this.getDefaultChartType(), this._bootstrapService.contextViewService);
this.chartTypesSelectBox.render(this.chartTypesElement.nativeElement);
this.chartTypesSelectBox.onDidSelect(selected => this.onChartChanged());
this._disposables.push(attachSelectBoxStyler(this.chartTypesSelectBox, this._bootstrapService.themeService));
@@ -129,7 +129,7 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
});
// Init legend dropdown
this.legendSelectBox = new SelectBox(this.legendOptions, this._chartConfig.legendPosition);
this.legendSelectBox = new SelectBox(this.legendOptions, this._chartConfig.legendPosition, this._bootstrapService.contextViewService);
this.legendSelectBox.render(this.legendElement.nativeElement);
this.legendSelectBox.onDidSelect(selected => this.onLegendChanged());
this._disposables.push(attachSelectBoxStyler(this.legendSelectBox, this._bootstrapService.themeService));
@@ -209,35 +209,37 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
}
public saveChart(): void {
let filePath = this.promptForFilepath();
let data = this._chartComponent.getCanvasData();
if (!data) {
this.showError(this.chartNotFoundError);
return;
}
if (filePath) {
let buffer = this.decodeBase64Image(data);
pfs.writeFile(filePath, buffer).then(undefined, (err) => {
if (err) {
this.showError(err.message);
} else {
let fileUri = URI.from({ scheme: PathUtilities.FILE_SCHEMA, path: filePath });
this._bootstrapService.windowsService.openExternal(fileUri.toString());
this._bootstrapService.messageService.show(Severity.Info, nls.localize('chartSaved', 'Saved Chart to path: {0}', filePath));
}
});
}
this.promptForFilepath().then(filePath => {
let data = this._chartComponent.getCanvasData();
if (!data) {
this.showError(this.chartNotFoundError);
return;
}
if (filePath) {
let buffer = this.decodeBase64Image(data);
pfs.writeFile(filePath, buffer).then(undefined, (err) => {
if (err) {
this.showError(err.message);
} else {
let fileUri = URI.from({ scheme: PathUtilities.FILE_SCHEMA, path: filePath });
this._bootstrapService.windowsService.openExternal(fileUri.toString());
this._bootstrapService.notificationService.notify({
severity: Severity.Error,
message: nls.localize('chartSaved', 'Saved Chart to path: {0}', filePath)
});
}
});
}
});
}
private promptForFilepath(): string {
private promptForFilepath(): Thenable<string> {
let filepathPlaceHolder = PathUtilities.resolveCurrentDirectory(this.getActiveUriString(), PathUtilities.getRootPath(this._bootstrapService.workspaceContextService));
filepathPlaceHolder = paths.join(filepathPlaceHolder, 'chart.png');
let filePath: string = this._bootstrapService.windowService.showSaveDialog({
return this._bootstrapService.windowService.showSaveDialog({
title: nls.localize('chartViewer.saveAsFileTitle', 'Choose Results File'),
defaultPath: paths.normalize(filepathPlaceHolder, true)
});
return filePath;
}
private decodeBase64Image(data: string): Buffer {
@@ -282,7 +284,10 @@ export class ChartViewerComponent implements OnInit, OnDestroy, IChartViewAction
}
private showError(errorMsg: string) {
this._bootstrapService.messageService.show(Severity.Error, errorMsg);
this._bootstrapService.notificationService.notify({
severity: Severity.Error,
message: errorMsg
});
}
private getGridItemConfig(): NgGridItemConfig {
@@ -6,8 +6,8 @@
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions';
import * as nls from 'vs/nls';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
export interface IChartViewActionContext {
copyChart(): void;
@@ -23,7 +23,7 @@ export class ChartViewActionBase extends Action {
id: string,
label: string,
enabledClass: string,
protected messageService: IMessageService
protected notificationService: INotificationService
) {
super(id, label);
this.enabled = true;
@@ -51,7 +51,10 @@ export class ChartViewActionBase extends Action {
protected doRun(context: IChartViewActionContext, runAction: Function): TPromise<boolean> {
if (!context) {
// TODO implement support for finding chart view in active window
this.messageService.show(Severity.Error, nls.localize('chartContextRequired', 'Chart View context is required to run this action'));
this.notificationService.notify({
severity: Severity.Error,
message: nls.localize('chartContextRequired', 'Chart View context is required to run this action')
});
return TPromise.as(false);
}
return new TPromise<boolean>((resolve, reject) => {
@@ -66,9 +69,9 @@ export class CreateInsightAction extends ChartViewActionBase {
public static ID = 'chartview.createInsight';
public static LABEL = nls.localize('createInsightLabel', "Create Insight");
constructor(@IMessageService messageService: IMessageService
constructor(@INotificationService notificationService: INotificationService
) {
super(CreateInsightAction.ID, CreateInsightAction.LABEL, 'createInsight', messageService);
super(CreateInsightAction.ID, CreateInsightAction.LABEL, 'createInsight', notificationService);
}
public run(context: IChartViewActionContext): TPromise<boolean> {
@@ -80,9 +83,9 @@ export class CopyAction extends ChartViewActionBase {
public static ID = 'chartview.copy';
public static LABEL = nls.localize('copyChartLabel', "Copy as image");
constructor(@IMessageService messageService: IMessageService
constructor(@INotificationService notificationService: INotificationService
) {
super(CopyAction.ID, CopyAction.LABEL, 'copyImage', messageService);
super(CopyAction.ID, CopyAction.LABEL, 'copyImage', notificationService);
}
public run(context: IChartViewActionContext): TPromise<boolean> {
@@ -94,9 +97,9 @@ export class SaveImageAction extends ChartViewActionBase {
public static ID = 'chartview.saveImage';
public static LABEL = nls.localize('saveImageLabel', "Save as image");
constructor(@IMessageService messageService: IMessageService
constructor(@INotificationService notificationService: INotificationService
) {
super(SaveImageAction.ID, SaveImageAction.LABEL, 'saveAsImage', messageService);
super(SaveImageAction.ID, SaveImageAction.LABEL, 'saveAsImage', notificationService);
}
public run(context: IChartViewActionContext): TPromise<boolean> {
@@ -17,9 +17,9 @@ import Severity from 'vs/base/common/severity';
import * as types from 'vs/base/common/types';
import * as pfs from 'vs/base/node/pfs';
import * as nls from 'vs/nls';
import { IMessageService } from 'vs/platform/message/common/message';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { INotificationService } from 'vs/platform/notification/common/notification';
export class InsightsDialogController {
private _queryRunner: QueryRunner;
@@ -30,7 +30,7 @@ export class InsightsDialogController {
constructor(
private _model: IInsightsDialogModel,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IErrorMessageService private _errorMessageService: IErrorMessageService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@@ -41,7 +41,10 @@ export class InsightsDialogController {
// execute string
if (typeof input === 'object') {
if (connectionProfile === undefined) {
this._messageService.show(Severity.Error, nls.localize("insightsInputError", "No Connection Profile was passed to insights flyout"));
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize("insightsInputError", "No Connection Profile was passed to insights flyout")
});
return Promise.resolve();
}
if (types.isStringArray(input.query)) {
@@ -88,14 +91,20 @@ export class InsightsDialogController {
}).then(() => resolve());
},
error => {
this._messageService.show(Severity.Error, nls.localize("insightsFileError", "There was an error reading the query file: ") + error);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize("insightsFileError", "There was an error reading the query file: ") + error
});
resolve();
}
);
});
} else {
error('Error reading details Query: ', input);
this._messageService.show(Severity.Error, nls.localize("insightsConfigError", "There was an error parsing the insight config; could not find query array/string or queryfile"));
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize("insightsConfigError", "There was an error parsing the insight config; could not find query array/string or queryfile")
});
return Promise.resolve();
}
}
@@ -12,7 +12,6 @@ import { attachListStyler } from 'vs/platform/theme/common/styler';
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { PanelComponent } from 'sql/base/browser/ui/panel/panel.component';
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
import { IJobManagementService } from '../common/interfaces';
@@ -23,6 +22,8 @@ import { JobHistoryController, JobHistoryDataSource,
import { JobStepsViewComponent } from 'sql/parts/jobManagement/views/jobStepsView.component';
import { JobStepsViewRow } from './jobStepsViewTree';
import { localize } from 'vs/nls';
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
export const DASHBOARD_SELECTOR: string = 'jobhistory-component';
@@ -50,7 +51,7 @@ export class JobHistoryComponent extends Disposable implements OnInit {
private _stepRows: JobStepsViewRow[] = [];
private _showSteps: boolean = false;
private _runStatus: string = undefined;
private _messageService: IMessageService;
private _notificationService: INotificationService;
constructor(
@Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService,
@@ -61,7 +62,7 @@ export class JobHistoryComponent extends Disposable implements OnInit {
) {
super();
this._jobManagementService = bootstrapService.jobManagementService;
this._messageService = bootstrapService.messageService;
this._notificationService = bootstrapService.notificationService;
}
ngOnInit() {
@@ -157,17 +158,26 @@ export class JobHistoryComponent extends Disposable implements OnInit {
switch (action) {
case ('run'):
var startMsg = localize('jobSuccessfullyStarted', 'The job was successfully started.');
this._messageService.show(Severity.Info, startMsg);
self._notificationService.notify({
severity: Severity.Info,
message: startMsg
});
break;
case ('stop'):
var stopMsg = localize('jobSuccessfullyStopped', 'The job was successfully stopped.');
this._messageService.show(Severity.Info, stopMsg);
self._notificationService.notify({
severity: Severity.Info,
message: stopMsg
});
break;
default:
break;
}
} else {
this._messageService.show(Severity.Error, result.errorMessage);
self._notificationService.notify({
severity: Severity.Error,
message: result.errorMessage
});
}
});
}
@@ -235,7 +235,11 @@ export class NewProfilerAction extends Task {
private _connectionProfile: ConnectionProfile;
constructor() {
super({ id: NewProfilerAction.ID, title: NewProfilerAction.LABEL, iconClass: NewProfilerAction.ICON });
super({
id: NewProfilerAction.ID,
title: NewProfilerAction.LABEL,
iconPath: { dark: NewProfilerAction.ICON, light: NewProfilerAction.ICON }
});
}
public runTask(accessor: ServicesAccessor, profile: IConnectionProfile): TPromise<void> {
@@ -25,6 +25,7 @@ import { attachListStyler } from 'vs/platform/theme/common/styler';
import Event, { Emitter } from 'vs/base/common/event';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
class EventItem {
@@ -314,7 +315,8 @@ export class ProfilerColumnEditorDialog extends Modal {
@IPartService _partService: IPartService,
@IThemeService private _themeService: IThemeService,
@ITelemetryService telemetryService: ITelemetryService,
@IContextKeyService contextKeyService: IContextKeyService
@IContextKeyService contextKeyService: IContextKeyService,
@IContextViewService private _contextViewService: IContextViewService
) {
super(nls.localize('profilerColumnDialog.profiler', 'Profiler'), TelemetryKeys.Profiler, _partService, telemetryService, contextKeyService);
}
@@ -329,7 +331,7 @@ export class ProfilerColumnEditorDialog extends Modal {
protected renderBody(container: HTMLElement): void {
let builder = new Builder(container);
builder.div({}, b => {
this._selectBox = new SelectBox(this._options, 0);
this._selectBox = new SelectBox(this._options, 0, this._contextViewService);
this._selectBox.render(b.getHTMLElement());
this._register(this._selectBox.onDidSelect(e => {
this._selectedValue = e.index;
@@ -28,11 +28,11 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati
import { ProfilerResourceEditor } from './profilerResourceEditor';
import { SplitView, View, Orientation, IViewOptions } from 'sql/base/browser/ui/splitview/splitview';
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IModel } from 'vs/editor/common/editorCommon';
import { ITextModel } from 'vs/editor/common/model';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
import URI from 'vs/base/common/uri';
import { UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { Schemas } from 'vs/base/common/network';
import * as nls from 'vs/nls';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IDisposable } from 'vs/base/common/lifecycle';
@@ -97,7 +97,7 @@ export interface IDetailData {
export class ProfilerEditor extends BaseEditor {
public static ID: string = 'workbench.editor.profiler';
private _editor: ProfilerResourceEditor;
private _editorModel: IModel;
private _editorModel: ITextModel;
private _editorInput: UntitledEditorInput;
private _splitView: SplitView;
private _container: HTMLElement;
@@ -189,7 +189,7 @@ export class ProfilerEditor extends BaseEditor {
this._autoscrollAction = this._instantiationService.createInstance(Actions.ProfilerAutoScroll, Actions.ProfilerAutoScroll.ID, Actions.ProfilerAutoScroll.LABEL);
this._sessionTemplates = this._profilerService.getSessionTemplates();
this._sessionTemplateSelector = new SelectBox(this._sessionTemplates.map(i => i.name), 'Standard');
this._sessionTemplateSelector = new SelectBox(this._sessionTemplates.map(i => i.name), 'Standard', this._contextViewService);
this._register(this._sessionTemplateSelector.onDidSelect(e => {
if (this.input) {
this.input.sessionTemplate = this._sessionTemplates.find(i => i.name === e.selected);
@@ -304,7 +304,7 @@ export class ProfilerEditor extends BaseEditor {
editorContainer.className = 'profiler-editor';
this._editor.create(new Builder(editorContainer));
this._editor.setVisible(true);
this._editorInput = this._instantiationService.createInstance(UntitledEditorInput, URI.from({ scheme: UNTITLED_SCHEMA }), false, 'sql', '', '');
this._editorInput = this._instantiationService.createInstance(UntitledEditorInput, URI.from({ scheme: Schemas.untitled }), false, 'sql', '', '');
this._editor.setInput(this._editorInput, undefined);
this._editorInput.resolve().then(model => this._editorModel = model.textEditorModel);
return editorContainer;
+8 -3
View File
@@ -11,7 +11,6 @@ import { IEditorCloseEvent } from 'vs/workbench/common/editor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { IQuickOpenService, IPickOpenEntry } from 'vs/platform/quickOpen/common/quickOpen';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Action } from 'vs/base/common/actions';
import errors = require('vs/base/common/errors');
@@ -23,6 +22,8 @@ import { IConnectionManagementService } from 'sql/parts/connection/common/connec
import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
import { DidChangeLanguageFlavorParams } from 'sqlops';
import Severity from 'vs/base/common/severity';
import { INotificationService } from 'vs/platform/notification/common/notification';
export interface ISqlProviderEntry extends IPickOpenEntry {
providerId: string;
@@ -173,7 +174,7 @@ export class ChangeFlavorAction extends Action {
actionLabel: string,
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
@IQuickOpenService private _quickOpenService: IQuickOpenService,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService
) {
super(actionId, actionLabel);
@@ -213,7 +214,11 @@ export class ChangeFlavorAction extends Action {
}
private _showMessage(sev: Severity, message: string): TPromise<any> {
this._messageService.show(sev, message);
this._notificationService.notify({
severity: sev,
message: message
});
return TPromise.as(undefined);
}
}
+1 -1
View File
@@ -136,7 +136,7 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
public resolve(refresh?: boolean): TPromise<EditorModel> { return this._sql.resolve(); }
public save(): TPromise<boolean> { return this._sql.save(); }
public isDirty(): boolean { return this._sql.isDirty(); }
public confirmSave(): ConfirmResult { return this._sql.confirmSave(); }
public confirmSave(): TPromise<ConfirmResult> { return this._sql.confirmSave(); }
public getResource(): URI { return this._sql.getResource(); }
public getEncoding(): string { return this._sql.getEncoding(); }
public suggestFileName(): string { return this._sql.suggestFileName(); }
+39 -21
View File
@@ -13,7 +13,6 @@ import { ISaveRequest, SaveFormat } from 'sql/parts/grid/common/interfaces';
import * as PathUtilities from 'sql/common/pathUtilities';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IOutputService, IOutputChannel, IOutputChannelRegistry, Extensions as OutputExtensions } from 'vs/workbench/parts/output/common/output';
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -21,13 +20,16 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
import { Registry } from 'vs/platform/registry/common/platform';
import URI from 'vs/base/common/uri';
import { IUntitledEditorService, UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { Schemas } from 'vs/base/common/network';
import * as paths from 'vs/base/common/paths';
import * as nls from 'vs/nls';
import * as pretty from 'pretty-data';
import { ISlickRange } from 'angular2-slickgrid';
import * as path from 'path';
import Severity from 'vs/base/common/severity';
import { INotificationService } from 'vs/platform/notification/common/notification';
let prevSavePath: string;
@@ -43,7 +45,6 @@ export class ResultSerializer {
constructor(
@IInstantiationService private _instantiationService: IInstantiationService,
@IMessageService private _messageService: IMessageService,
@IOutputService private _outputService: IOutputService,
@IQueryManagementService private _queryManagementService: IQueryManagementService,
@IWorkspaceConfigurationService private _workspaceConfigurationService: IWorkspaceConfigurationService,
@@ -51,7 +52,8 @@ export class ResultSerializer {
@IWorkspaceContextService private _contextService: IWorkspaceContextService,
@IWindowsService private _windowsService: IWindowsService,
@IWindowService private _windowService: IWindowService,
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService,
@INotificationService private _notificationService: INotificationService
) { }
/**
@@ -62,11 +64,12 @@ export class ResultSerializer {
this._uri = uri;
// prompt for filepath
let filePath = self.promptForFilepath(saveRequest);
if (filePath) {
return self.sendRequestToService(filePath, saveRequest.batchIndex, saveRequest.resultSetNumber, saveRequest.format, saveRequest.selection ? saveRequest.selection[0] : undefined);
}
return Promise.resolve(undefined);
return self.promptForFilepath(saveRequest).then(filePath => {
if (filePath) {
return self.sendRequestToService(filePath, saveRequest.batchIndex, saveRequest.resultSetNumber, saveRequest.format, saveRequest.selection ? saveRequest.selection[0] : undefined);
}
return Promise.resolve(undefined);
});
}
/**
@@ -103,7 +106,7 @@ export class ResultSerializer {
private getUntitledFileUri(columnName: string): URI {
let fileName = columnName;
let uri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: fileName });
let uri: URI = URI.from({ scheme: Schemas.untitled, path: fileName });
// If the current filename is taken, try another up to a max number
if (this._untitledEditorService.exists(uri)) {
@@ -111,7 +114,7 @@ export class ResultSerializer {
while (i < ResultSerializer.MAX_FILENAMES
&& this._untitledEditorService.exists(uri)) {
fileName = [columnName, i.toString()].join('-');
uri = URI.from({ scheme: UNTITLED_SCHEMA, path: fileName });
uri = URI.from({ scheme: Schemas.untitled, path: fileName });
i++;
}
if (this._untitledEditorService.exists(uri)) {
@@ -140,16 +143,16 @@ export class ResultSerializer {
this.outputChannel.append(message);
}
private promptForFilepath(saveRequest: ISaveRequest): string {
private promptForFilepath(saveRequest: ISaveRequest): Thenable<string> {
let filepathPlaceHolder = (prevSavePath) ? prevSavePath : PathUtilities.resolveCurrentDirectory(this._uri, this.rootPath);
filepathPlaceHolder = path.join(filepathPlaceHolder, this.getResultsDefaultFilename(saveRequest));
let filePath: string = this._windowService.showSaveDialog({
return this._windowService.showSaveDialog({
title: nls.localize('resultsSerializer.saveAsFileTitle', 'Choose Results File'),
defaultPath: paths.normalize(filepathPlaceHolder, true)
}).then(filePath => {
prevSavePath = filePath;
return Promise.resolve(filePath);
});
prevSavePath = filePath;
return filePath;
}
private getResultsDefaultFilename(saveRequest: ISaveRequest): string {
@@ -249,10 +252,16 @@ export class ResultSerializer {
// send message to the sqlserverclient for converting results to the requested format and saving to filepath
return this._queryManagementService.saveResults(saveResultsParams).then(result => {
if (result.messages) {
this._messageService.show(Severity.Error, LocalizedConstants.msgSaveFailed + result.messages);
this._notificationService.notify({
severity: Severity.Error,
message: LocalizedConstants.msgSaveFailed + result.messages
});
this.logToOutputChannel(LocalizedConstants.msgSaveFailed + result.messages);
} else {
this._messageService.show(Severity.Info, LocalizedConstants.msgSaveSucceeded + this._filePath);
this._notificationService.notify({
severity: Severity.Info,
message: LocalizedConstants.msgSaveSucceeded + this._filePath
});
this.logToOutputChannel(LocalizedConstants.msgSaveSucceeded + filePath);
this.openSavedFile(this._filePath, format);
}
@@ -260,7 +269,10 @@ export class ResultSerializer {
// Telemetry.sendTelemetryEvent('SavedResults', { 'type': format });
}, error => {
this._messageService.show(Severity.Error, LocalizedConstants.msgSaveFailed + error);
this._notificationService.notify({
severity: Severity.Error,
message: LocalizedConstants.msgSaveFailed + error
});
this.logToOutputChannel(LocalizedConstants.msgSaveFailed + error);
});
}
@@ -280,7 +292,10 @@ export class ResultSerializer {
this._editorService.openEditor({ resource: uri }).then((result) => {
}, (error: any) => {
this._messageService.show(Severity.Error, error);
this._notificationService.notify({
severity: Severity.Error,
message: error
});
});
}
}
@@ -296,7 +311,10 @@ export class ResultSerializer {
(success) => {
},
(error: any) => {
this._messageService.show(Severity.Error, error);
this._notificationService.notify({
severity: Severity.Error,
message: error
});
}
);
}
+12 -6
View File
@@ -11,7 +11,6 @@ import { EventEmitter } from 'sql/base/common/eventEmitter';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { TPromise } from 'vs/base/common/winjs.base';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ISelectionData } from 'sqlops';
@@ -24,6 +23,8 @@ import {
} from 'sql/parts/connection/common/connectionManagement';
import { QueryEditor } from 'sql/parts/query/editor/queryEditor';
import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
/**
* Action class that query-based Actions will extend. This base class automatically handles activating and
@@ -436,7 +437,7 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem
private _editor: QueryEditor,
private _action: ListDatabasesAction,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IContextViewService contextViewProvider: IContextViewService,
@IThemeService themeService: IThemeService
) {
@@ -514,14 +515,19 @@ export class ListDatabasesActionItem extends EventEmitter implements IActionItem
result => {
if (!result) {
this.resetDatabaseName();
this._messageService.show(Severity.Error, nls.localize('changeDatabase.failed', "Failed to change database"));
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('changeDatabase.failed', "Failed to change database")
});
}
},
error => {
this.resetDatabaseName();
this._messageService.show(Severity.Error, nls.localize('changeDatabase.failedWithError', "Failed to change database {0}", error));
}
);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('changeDatabase.failedWithError', "Failed to change database {0}", error)
});
});
}
private getCurrentDatabaseName() {
@@ -21,11 +21,12 @@ import * as nls from 'vs/nls';
import * as statusbar from 'vs/workbench/browser/parts/statusbar/statusbar';
import * as platform from 'vs/platform/registry/common/platform';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import Event, { Emitter } from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import * as strings from 'vs/base/common/strings';
import * as types from 'vs/base/common/types';
import { INotificationService } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
const selectionSnippetMaxLen = 100;
@@ -76,7 +77,7 @@ export class QueryModelService implements IQueryModelService {
// CONSTRUCTOR /////////////////////////////////////////////////////////
constructor(
@IInstantiationService private _instantiationService: IInstantiationService,
@IMessageService private _messageService: IMessageService
@INotificationService private _notificationService: INotificationService
) {
this._queryInfoMap = new Map<string, QueryInfo>();
this._onRunQueryStart = new Emitter<string>();
@@ -179,7 +180,10 @@ export class QueryModelService implements IQueryModelService {
}
public showCommitError(error: string): void {
this._messageService.show(Severity.Error, nls.localize('commitEditFailed', 'Commit row failed: ') + error);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('commitEditFailed', 'Commit row failed: ') + error
});
}
public isRunningQuery(uri: string): boolean {
@@ -330,7 +334,10 @@ export class QueryModelService implements IQueryModelService {
queryRunner.cancelQuery().then(success => undefined, error => {
// On error, show error message and notify that the query is complete so that buttons and other status indicators
// can be correct
this._messageService.show(Severity.Error, strings.format(LocalizedConstants.msgCancelQueryFailed, error));
this._notificationService.notify({
severity: Severity.Error,
message: strings.format(LocalizedConstants.msgCancelQueryFailed, error)
});
this._fireQueryEvent(queryRunner.uri, 'complete', 0);
});
@@ -427,7 +434,10 @@ export class QueryModelService implements IQueryModelService {
let queryRunner = this._getQueryRunner(ownerUri);
if (queryRunner) {
return queryRunner.updateCell(ownerUri, rowId, columnId, newValue).then((result) => result, error => {
this._messageService.show(Severity.Error, nls.localize('updateCellFailed', 'Update cell failed: ') + error.message);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('updateCellFailed', 'Update cell failed: ') + error.message
});
return Promise.reject(error);
});
}
@@ -439,7 +449,10 @@ export class QueryModelService implements IQueryModelService {
let queryRunner = this._getQueryRunner(ownerUri);
if (queryRunner) {
return queryRunner.commitEdit(ownerUri).then(() => { }, error => {
this._messageService.show(Severity.Error, nls.localize('commitEditFailed', 'Commit row failed: ') + error.message);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('commitEditFailed', 'Commit row failed: ') + error.message
});
return Promise.reject(error);
});
}
+18 -7
View File
@@ -13,7 +13,6 @@ import { IQueryManagementService } from 'sql/parts/query/common/queryManagement'
import { ISlickRange } from 'angular2-slickgrid';
import * as Utils from 'sql/parts/connection/common/utils';
import { IMessageService } from 'vs/platform/message/common/message';
import Severity from 'vs/base/common/severity';
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
import * as nls from 'vs/nls';
@@ -21,6 +20,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
import * as types from 'vs/base/common/types';
import { EventEmitter } from 'sql/base/common/eventEmitter';
import { IDisposable } from 'vs/base/common/lifecycle';
import { INotificationService } from 'vs/platform/notification/common/notification';
export interface IEditSessionReadyEvent {
ownerUri: string;
@@ -66,7 +66,7 @@ export default class QueryRunner {
public uri: string,
public title: string,
@IQueryManagementService private _queryManagementService: IQueryManagementService,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IWorkspaceConfigurationService private _workspaceConfigurationService: IWorkspaceConfigurationService,
@IClipboardService private _clipboardService: IClipboardService
) { }
@@ -288,7 +288,10 @@ export default class QueryRunner {
self._queryManagementService.getQueryRows(rowData).then(result => {
resolve(result);
}, error => {
self._messageService.show(Severity.Error, nls.localize('query.gettingRowsFailedError', 'Something went wrong getting more rows: {0}', error));
self._notificationService.notify({
severity: Severity.Error,
message: nls.localize('query.gettingRowsFailedError', 'Something went wrong getting more rows: {0}', error)
});
reject(error);
});
});
@@ -312,8 +315,10 @@ export default class QueryRunner {
// TODO issue #228 add statusview callbacks here
this._isExecuting = false;
this._messageService.show(Severity.Error, nls.localize('query.initEditExecutionFailed', 'Init Edit Execution failed: ') + error);
this._notificationService.notify({
severity: Severity.Error,
message: nls.localize('query.initEditExecutionFailed', 'Init Edit Execution failed: ') + error
});
});
}
@@ -334,13 +339,19 @@ export default class QueryRunner {
self._queryManagementService.getEditRows(rowData).then(result => {
if (!result.hasOwnProperty('rowCount')) {
let error = `Nothing returned from subset query`;
self._messageService.show(Severity.Error, error);
self._notificationService.notify({
severity: Severity.Error,
message: error
});
reject(error);
}
resolve(result);
}, error => {
let errorMessage = nls.localize('query.moreRowsFailedError', 'Something went wrong getting more rows:');
self._messageService.show(Severity.Error, `${errorMessage} ${error}`);
self._notificationService.notify({
severity: Severity.Error,
message: `${errorMessage} ${error}`
});
reject(error);
});
});
@@ -14,20 +14,21 @@ import { sqlModeId, untitledFilePrefix, getSupportedInputResource } from 'sql/pa
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
import { IMode } from 'vs/editor/common/modes';
import { IModel } from 'vs/editor/common/editorCommon';
import { ITextModel } from 'vs/editor/common/model';
import { IEditor, IEditorInput, Position } from 'vs/platform/editor/common/editor';
import { CodeEditor } from 'vs/editor/browser/codeEditor';
import { IEditorGroup } from 'vs/workbench/common/editor';
import { IUntitledEditorService, UNTITLED_SCHEMA } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
import { IMessageService } from 'vs/platform/message/common/message';
import Severity from 'vs/base/common/severity';
import nls = require('vs/nls');
import URI from 'vs/base/common/uri';
import paths = require('vs/base/common/paths');
import { isLinux } from 'vs/base/common/platform';
import { Schemas } from 'vs/base/common/network';
import { INotificationService } from 'vs/platform/notification/common/notification';
const fs = require('fs');
@@ -52,20 +53,20 @@ export class QueryEditorService implements IQueryEditorService {
private static editorService: IWorkbenchEditorService;
private static instantiationService: IInstantiationService;
private static editorGroupService: IEditorGroupService;
private static messageService: IMessageService;
private static notificationService: INotificationService;
constructor(
@IUntitledEditorService private _untitledEditorService: IUntitledEditorService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
@IEditorGroupService private _editorGroupService: IEditorGroupService,
@IMessageService private _messageService: IMessageService,
@INotificationService private _notificationService: INotificationService,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
) {
QueryEditorService.editorService = _editorService;
QueryEditorService.instantiationService = _instantiationService;
QueryEditorService.editorGroupService = _editorGroupService;
QueryEditorService.messageService = _messageService;
QueryEditorService.notificationService = _notificationService;
}
////// Public functions
@@ -78,7 +79,7 @@ export class QueryEditorService implements IQueryEditorService {
try {
// Create file path and file URI
let filePath = this.createUntitledSqlFilePath();
let docUri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: filePath });
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
// Create a sql document pane with accoutrements
const fileInput = this._untitledEditorService.createOrGet(docUri, 'sql');
@@ -126,7 +127,7 @@ export class QueryEditorService implements IQueryEditorService {
// Create file path and file URI
let objectName = schemaName ? schemaName + '.' + tableName : tableName;
let filePath = this.createEditDataFileName(objectName);
let docUri: URI = URI.from({ scheme: UNTITLED_SCHEMA, path: filePath });
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
// Create an EditDataInput for editing
let editDataInput: EditDataInput = this._instantiationService.createInstance(EditDataInput, docUri, schemaName, tableName);
@@ -192,7 +193,7 @@ export class QueryEditorService implements IQueryEditorService {
* In all other cases (when SQL is involved in the language change and the editor is not dirty),
* returns a promise that will resolve when the old editor has been replaced by a new editor.
*/
public static sqlLanguageModeCheck(model: IModel, mode: IMode, editor: IEditor): Promise<IModel> {
public static sqlLanguageModeCheck(model: ITextModel, mode: IMode, editor: IEditor): Promise<ITextModel> {
if (!model || !mode || !editor) {
return Promise.resolve(undefined);
}
@@ -211,16 +212,22 @@ export class QueryEditorService implements IQueryEditorService {
}
let uri: URI = QueryEditorService._getEditorChangeUri(editor.input, changingToSql);
if(uri.scheme === UNTITLED_SCHEMA && editor.input instanceof QueryInput)
if(uri.scheme === Schemas.untitled && editor.input instanceof QueryInput)
{
QueryEditorService.messageService.show(Severity.Error, QueryEditorService.CHANGE_UNSUPPORTED_ERROR_MESSAGE);
QueryEditorService.notificationService.notify({
severity: Severity.Error,
message: QueryEditorService.CHANGE_UNSUPPORTED_ERROR_MESSAGE
});
return Promise.resolve(undefined);
}
// Return undefined to notify the calling funciton to not perform the language change
// TODO change this - tracked by issue #727
if (editor.input.isDirty()) {
QueryEditorService.messageService.show(Severity.Error, QueryEditorService.CHANGE_ERROR_MESSAGE);
QueryEditorService.notificationService.notify({
severity: Severity.Error,
message: QueryEditorService.CHANGE_ERROR_MESSAGE
});
return Promise.resolve(undefined);
}
@@ -232,7 +239,7 @@ export class QueryEditorService implements IQueryEditorService {
options.pinned = group.isPinned(index);
// Return a promise that will resovle when the old editor has been replaced by a new editor
return new Promise<IModel>((resolve, reject) => {
return new Promise<ITextModel>((resolve, reject) => {
let newEditorInput = QueryEditorService._getNewEditorInput(changingToSql, editor.input, uri);
// Override queryEditorCheck to not open this file in a QueryEditor
@@ -344,7 +351,7 @@ export class QueryEditorService implements IQueryEditorService {
/**
* Handle all cleanup actions that need to wait until the editor is fully open.
*/
private static _onEditorOpened(editor: IEditor, uri: string, position: Position, isPinned: boolean): IModel {
private static _onEditorOpened(editor: IEditor, uri: string, position: Position, isPinned: boolean): ITextModel {
// Reset the editor pin state
// TODO: change this so it happens automatically in openEditor in sqlLanguageModeCheck. Performing this here
@@ -148,18 +148,18 @@ export class ServerGroupDialog extends Modal {
this._colorCheckBoxesMap[this._selectedColorOption].checkbox.focus();
} else if (this.isFocusOnColors()) {
this._addServerButton.enabled ? this._addServerButton.focus() : this._closeButton.focus();
} else if (document.activeElement === this._addServerButton.getElement()) {
} else if (document.activeElement === this._addServerButton.element) {
this._closeButton.focus();
}
else if (document.activeElement === this._closeButton.getElement()) {
else if (document.activeElement === this._closeButton.element) {
this._groupNameInputBox.focus();
}
}
private focusPrevious(): void {
if (document.activeElement === this._closeButton.getElement()) {
if (document.activeElement === this._closeButton.element) {
this._addServerButton.enabled ? this._addServerButton.focus() : this._colorCheckBoxesMap[this._selectedColorOption].checkbox.focus();
} else if (document.activeElement === this._addServerButton.getElement()) {
} else if (document.activeElement === this._addServerButton.element) {
this._colorCheckBoxesMap[this._selectedColorOption].checkbox.focus();
} else if (this.isFocusOnColors()) {
this._groupDescriptionInputBox.focus();
@@ -17,7 +17,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { attachInputBoxStyler } from 'vs/platform/theme/common/styler';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService } from 'vs/platform/message/common/message';
import { isPromiseCanceledError } from 'vs/base/common/errors';
import Severity from 'vs/base/common/severity';
import { IConnectionsViewlet, IConnectionManagementService, VIEWLET_ID } from 'sql/parts/connection/common/connectionManagement';
@@ -27,6 +26,8 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { ClearSearchAction, AddServerAction, AddServerGroupAction, ActiveConnectionsFilterAction } from 'sql/parts/registeredServer/viewlet/connectionTreeAction';
import { warn } from 'sql/base/common/log';
import { IObjectExplorerService } from 'sql/parts/registeredServer/common/objectExplorerService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { INotificationService } from 'vs/platform/notification/common/notification';
export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
@@ -49,10 +50,12 @@ export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
@IConnectionManagementService private connectionManagementService: IConnectionManagementService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IViewletService private viewletService: IViewletService,
@IMessageService private messageService: IMessageService,
@IObjectExplorerService private objectExplorerService: IObjectExplorerService
@INotificationService private _notificationService: INotificationService,
@IObjectExplorerService private objectExplorerService: IObjectExplorerService,
@IPartService partService: IPartService
) {
super(VIEWLET_ID, telemetryService, _themeService);
super(VIEWLET_ID, partService, telemetryService, _themeService);
this._searchDelayer = new ThrottledDelayer(500);
this._clearSearchAction = this._instantiationService.createInstance(ClearSearchAction, ClearSearchAction.ID, ClearSearchAction.LABEL, this);
@@ -71,7 +74,10 @@ export class ConnectionViewlet extends Viewlet implements IConnectionsViewlet {
if (isPromiseCanceledError(err)) {
return;
}
this.messageService.show(Severity.Error, err);
this._notificationService.notify({
severity: Severity.Error,
message: err
});
}
public create(parent: Builder): TPromise<void> {
@@ -10,10 +10,10 @@ import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import Event, { Emitter } from 'vs/base/common/event';
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { IChoiceService } from 'vs/platform/message/common/message';
import { localize } from 'vs/nls';
import Severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base';
import { IChoiceService } from 'vs/platform/dialogs/common/dialogs';
export const SERVICE_ID = 'taskHistoryService';
export const ITaskService = createDecorator<ITaskService>(SERVICE_ID);
@@ -14,12 +14,13 @@ import { toggleClass } from 'vs/base/browser/dom';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService } from 'vs/platform/message/common/message';
import { isPromiseCanceledError } from 'vs/base/common/errors';
import Severity from 'vs/base/common/severity';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { TaskHistoryView } from 'sql/parts/taskHistory/viewlet/taskHistoryView';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { INotificationService } from 'vs/platform/notification/common/notification';
export const VIEWLET_ID = 'workbench.view.taskHistory';
@@ -35,16 +36,20 @@ export class TaskHistoryViewlet extends Viewlet {
@IConnectionManagementService private connectionManagementService: IConnectionManagementService,
@IInstantiationService private _instantiationService: IInstantiationService,
@IViewletService private viewletService: IViewletService,
@IMessageService private messageService: IMessageService
@INotificationService private _notificationService: INotificationService,
@IPartService partService: IPartService
) {
super(VIEWLET_ID, telemetryService, themeService);
super(VIEWLET_ID, partService, telemetryService, themeService);
}
private onError(err: any): void {
if (isPromiseCanceledError(err)) {
return;
}
this.messageService.show(Severity.Error, err);
this._notificationService.notify({
severity: Severity.Error,
message: err
});
}
public create(parent: Builder): TPromise<void> {
@@ -8,6 +8,7 @@
import { IClipboardService } from 'sql/platform/clipboard/common/clipboardService';
import { IClipboardService as vsIClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { clipboard, nativeImage } from 'electron';
import URI from 'vs/base/common/uri';
export class ClipboardService implements IClipboardService {
_serviceBrand: any;
@@ -47,4 +48,25 @@ export class ClipboardService implements IClipboardService {
writeFindText(text: string): void {
this._vsClipboardService.writeFindText(text);
}
/**
* Writes files to the system clipboard.
*/
writeFiles(files: URI[]): void {
this._vsClipboardService.writeFiles(files);
}
/**
* Reads files from the system clipboard.
*/
readFiles(): URI[] {
return this._vsClipboardService.readFiles();
}
/**
* Find out if files are copied to the clipboard.
*/
hasFiles(): boolean {
return this._vsClipboardService.hasFiles();
}
}
@@ -8,7 +8,7 @@ import { IConfigurationRegistry, Extensions as ConfigurationExtension } from 'vs
import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema';
import * as nls from 'vs/nls';
import { deepClone } from 'vs/base/common/objects';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { ProviderProperties } from 'sql/parts/dashboard/widgets/properties/propertiesWidget.component';
import { DATABASE_DASHBOARD_TABS } from 'sql/parts/dashboard/pages/databaseDashboardPage.contribution';
+5 -4
View File
@@ -22,20 +22,21 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands';
export interface ITaskOptions {
id: string;
title: string;
iconClass: string;
iconPath: { dark: string; light: string; };
description?: ITaskHandlerDescription;
}
export abstract class Task {
public readonly id: string;
public readonly title: string;
public readonly iconClass: string;
public readonly iconPathDark: string;
public readonly iconPath: { dark: string; light: string; };
private readonly _description: ITaskHandlerDescription;
constructor(opts: ITaskOptions) {
this.id = opts.id;
this.title = opts.title;
this.iconClass = opts.iconClass;
this.iconPath = opts.iconPath;
this._description = opts.description;
}
@@ -49,7 +50,7 @@ export abstract class Task {
private toCommandAction(): ICommandAction {
return {
iconClass: this.iconClass,
iconPath: this.iconPath,
id: this.id,
title: this.title
};
@@ -33,7 +33,6 @@ import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/work
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IMessageService } from 'vs/platform/message/common/message';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IAccountManagementService } from 'sql/services/accountManagement/interfaces';
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
@@ -42,6 +41,8 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { ConfigurationEditingService } from 'vs/workbench/services/configuration/node/configurationEditingService';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
export const BOOTSTRAP_SERVICE_ID = 'bootstrapService';
export const IBootstrapService = createDecorator<IBootstrapService>(BOOTSTRAP_SERVICE_ID);
@@ -78,7 +79,7 @@ export interface IBootstrapService {
insightsDialogService: IInsightsDialogService;
contextViewService: IContextViewService;
restoreDialogService: IRestoreDialogController;
messageService: IMessageService;
notificationService: INotificationService;
workspaceContextService: IWorkspaceContextService;
accountManagementService: IAccountManagementService;
windowsService: IWindowsService;
@@ -94,6 +95,7 @@ export interface IBootstrapService {
commandService: ICommandService;
dashboardWebviewService: IDashboardWebviewService;
jobManagementService: IJobManagementService;
environmentService: IEnvironmentService;
/*
* Bootstraps the Angular module described. Components that need singleton services should inject the
@@ -37,7 +37,6 @@ import { IEditorInput } from 'vs/platform/editor/common/editor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from './bootstrapService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IMessageService } from 'vs/platform/message/common/message';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IAccountManagementService } from 'sql/services/accountManagement/interfaces';
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
@@ -46,6 +45,8 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { ConfigurationEditingService } from 'vs/workbench/services/configuration/node/configurationEditingService';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
export class BootstrapService implements IBootstrapService {
@@ -88,7 +89,7 @@ export class BootstrapService implements IBootstrapService {
@IConfigurationService public configurationService: IConfigurationService,
@IInsightsDialogService public insightsDialogService: IInsightsDialogService,
@IContextViewService public contextViewService: IContextViewService,
@IMessageService public messageService: IMessageService,
@INotificationService public notificationService: INotificationService,
@IWorkspaceContextService public workspaceContextService: IWorkspaceContextService,
@IAccountManagementService public accountManagementService: IAccountManagementService,
@IWindowsService public windowsService: IWindowsService,
@@ -102,7 +103,8 @@ export class BootstrapService implements IBootstrapService {
@ICapabilitiesService public capabilitiesService: ICapabilitiesService,
@ICommandService public commandService: ICommandService,
@IDashboardWebviewService public dashboardWebviewService: IDashboardWebviewService,
@IJobManagementService public jobManagementService: IJobManagementService
@IJobManagementService public jobManagementService: IJobManagementService,
@IEnvironmentService public environmentService: IEnvironmentService
) {
this.configurationEditorService = this.instantiationService.createInstance(ConfigurationEditingService);
this._bootstrapParameterMap = new Map<string, BootstrapParams>();
@@ -1,7 +1,7 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
@@ -17,7 +17,7 @@ export class MainThreadDashboard implements MainThreadDashboardShape {
context: IExtHostContext,
@IDashboardService private _dashboardService: IDashboardService
) {
this._proxy = context.get(SqlExtHostContext.ExtHostDashboard);
this._proxy = context.getProxy(SqlExtHostContext.ExtHostDashboard);
_dashboardService.onDidChangeToDashboard(e => {
this._proxy.$onDidChangeToDashboard(e);
});
@@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { WebViewDialog } from 'sql/base/browser/ui/modal/webViewDialog';
@@ -22,7 +22,7 @@ export class MainThreadModalDialog implements MainThreadModalDialogShape {
@IWorkbenchEditorService private readonly _editorService: IWorkbenchEditorService,
@IInstantiationService private readonly _instantiationService: IInstantiationService
) {
this._proxy = context.get(SqlExtHostContext.ExtHostModalDialogs);
this._proxy = context.getProxy(SqlExtHostContext.ExtHostModalDialogs);
}
dispose(): void {
@@ -32,7 +32,7 @@ export class MainThreadTasks implements MainThreadTasksShape {
constructor(
extHostContext: IExtHostContext
) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostTasks);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostTasks);
}
dispose() {
@@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
@@ -7,22 +7,22 @@
import * as sqlops from 'sqlops';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { Disposable } from 'vs/workbench/api/node/extHostTypes';
import {
ExtHostAccountManagementShape,
MainThreadAccountManagementShape,
SqlMainContext,
} from 'sql/workbench/api/node/sqlExtHost.protocol';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
export class ExtHostAccountManagement extends ExtHostAccountManagementShape {
private _handlePool: number = 0;
private _proxy: MainThreadAccountManagementShape;
private _providers: { [handle: number]: AccountProviderWithMetadata } = {};
constructor(threadService: IThreadService) {
constructor(mainContext: IMainContext) {
super();
this._proxy = threadService.get(SqlMainContext.MainThreadAccountManagement);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadAccountManagement);
}
// PUBLIC METHODS //////////////////////////////////////////////////////
@@ -4,8 +4,8 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { ExtHostConnectionManagementShape, SqlMainContext, MainThreadConnectionManagementShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import * as sqlops from 'sqlops';
export class ExtHostConnectionManagement extends ExtHostConnectionManagementShape {
@@ -13,10 +13,10 @@ export class ExtHostConnectionManagement extends ExtHostConnectionManagementShap
private _proxy: MainThreadConnectionManagementShape;
constructor(
threadService: IThreadService
mainContext: IMainContext
) {
super();
this._proxy = threadService.get(SqlMainContext.MainThreadConnectionManagement);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadConnectionManagement);
}
public $getActiveConnections(): Thenable<sqlops.connection.Connection[]> {
@@ -5,7 +5,7 @@
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import { SqlMainContext, MainThreadCredentialManagementShape, ExtHostCredentialManagementShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import * as vscode from 'vscode';
import * as sqlops from 'sqlops';
@@ -41,12 +41,12 @@ export class ExtHostCredentialManagement extends ExtHostCredentialManagementShap
private _registrationPromise: Promise<void>;
private _registrationPromiseResolve;
constructor(threadService: IThreadService) {
constructor(mainContext: IMainContext) {
super();
let self = this;
this._proxy = threadService.get(SqlMainContext.MainThreadCredentialManagement);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadCredentialManagement);
// Create a promise to resolve when a credential provider has been registered.
// HACK: this gives us a deferred promise
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import Event, { Emitter } from 'vs/base/common/event';
import * as sqlops from 'sqlops';
@@ -20,8 +20,8 @@ export class ExtHostDashboard implements ExtHostDashboardShape {
private _proxy: MainThreadDashboardShape;
constructor(threadService: IThreadService) {
this._proxy = threadService.get(SqlMainContext.MainThreadDashboard);
constructor(mainContext: IMainContext) {
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadDashboard);
}
$onDidOpenDashboard(dashboard: sqlops.DashboardDocument) {
@@ -67,7 +67,7 @@ export class ExtHostDashboardWebviews implements ExtHostDashboardWebviewsShape {
constructor(
mainContext: IMainContext
) {
this._proxy = mainContext.get(SqlMainContext.MainThreadDashboardWebview);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadDashboardWebview);
}
$onMessage(handle: number, message: any): void {
@@ -5,7 +5,7 @@
'use strict';
import Event, { Emitter } from 'vs/base/common/event';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import { SqlMainContext, MainThreadDataProtocolShape, ExtHostDataProtocolShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import * as vscode from 'vscode';
import * as sqlops from 'sqlops';
@@ -23,10 +23,10 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
private _adapter = new Map<number, sqlops.DataProvider>();
constructor(
threadService: IThreadService
mainContext: IMainContext
) {
super();
this._proxy = threadService.get(SqlMainContext.MainThreadDataProtocol);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadDataProtocol);
}
private _createDisposable(handle: number): Disposable {
@@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
@@ -92,7 +92,7 @@ export class ExtHostModalDialogs implements ExtHostModalDialogsShape {
constructor(
mainContext: IMainContext
) {
this._proxy = mainContext.get(SqlMainContext.MainThreadModalDialog);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadModalDialog);
}
createDialog(
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import { ExtHostObjectExplorerShape, SqlMainContext, MainThreadObjectExplorerShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import * as sqlops from 'sqlops';
import * as vscode from 'vscode';
@@ -14,9 +14,9 @@ export class ExtHostObjectExplorer implements ExtHostObjectExplorerShape {
private _proxy: MainThreadObjectExplorerShape;
constructor(
threadService: IThreadService
mainContext: IMainContext
) {
this._proxy = threadService.get(SqlMainContext.MainThreadObjectExplorer);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadObjectExplorer);
}
public $getNode(connectionId: string, nodePath?: string): Thenable<sqlops.objectexplorer.ObjectExplorerNode> {
@@ -7,7 +7,7 @@
import * as sqlops from 'sqlops';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import { Disposable } from 'vs/workbench/api/node/extHostTypes';
import {
ExtHostResourceProviderShape,
@@ -20,9 +20,9 @@ export class ExtHostResourceProvider extends ExtHostResourceProviderShape {
private _proxy: MainThreadResourceProviderShape;
private _providers: { [handle: number]: ResourceProviderWithMetadata } = {};
constructor(threadService: IThreadService) {
constructor(mainContext: IMainContext) {
super();
this._proxy = threadService.get(SqlMainContext.MainThreadResourceProvider);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadResourceProvider);
}
// PUBLIC METHODS //////////////////////////////////////////////////////
@@ -5,7 +5,7 @@
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IMainContext } from 'vs/workbench/api/node/extHost.protocol';
import { SqlMainContext, MainThreadSerializationProviderShape, ExtHostSerializationProviderShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import * as vscode from 'vscode';
import * as sqlops from 'sqlops';
@@ -53,10 +53,10 @@ export class ExtHostSerializationProvider extends ExtHostSerializationProviderSh
}
constructor(
threadService: IThreadService
mainContext: IMainContext
) {
super();
this._proxy = threadService.get(SqlMainContext.MainThreadSerializationProvider);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadSerializationProvider);
}
public $registerSerializationProvider(provider: sqlops.SerializationProvider): vscode.Disposable {
+1 -1
View File
@@ -29,7 +29,7 @@ export class ExtHostTasks implements ExtHostTasksShape {
mainContext: IMainContext,
private logService: ILogService
) {
this._proxy = mainContext.get(SqlMainContext.MainThreadTasks);
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadTasks);
}
registerTask(id: string, callback: sqlops.tasks.ITaskHandler, thisArg?: any, description?: ITaskHandlerDescription): extHostTypes.Disposable {
@@ -29,7 +29,7 @@ export class MainThreadAccountManagement implements MainThreadAccountManagementS
) {
this._providerMetadata = {};
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostAccountManagement);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostAccountManagement);
}
this._toDispose = [];
}
@@ -28,7 +28,7 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
@IWorkbenchEditorService private _workbenchEditorService: IWorkbenchEditorService
) {
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostConnectionManagement);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostConnectionManagement);
}
this._toDispose = [];
}
@@ -29,7 +29,7 @@ export class MainThreadCredentialManagement implements MainThreadCredentialManag
@ICredentialsService private credentialService: ICredentialsService
) {
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostCredentialManagement);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostCredentialManagement);
}
}
@@ -22,7 +22,7 @@ export class MainThreadDashboardWebview implements MainThreadDashboardWebviewSha
context: IExtHostContext,
@IDashboardWebviewService webviewService: IDashboardWebviewService
) {
this._proxy = context.get(SqlExtHostContext.ExtHostDashboardWebviews);
this._proxy = context.getProxy(SqlExtHostContext.ExtHostDashboardWebviews);
webviewService.onRegisteredWebview(e => {
if (this.knownWidgets.includes(e.id)) {
let handle = MainThreadDashboardWebview._handlePool++;
@@ -27,7 +27,6 @@ import { ISerializationService } from 'sql/services/serialization/serializationS
import { IFileBrowserService } from 'sql/parts/fileBrowser/common/interfaces';
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
import { IMessageService } from 'vs/platform/message/common/message';
import severity from 'vs/base/common/severity';
/**
@@ -57,11 +56,10 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
@ITaskService private _taskService: ITaskService,
@IProfilerService private _profilerService: IProfilerService,
@ISerializationService private _serializationService: ISerializationService,
@IFileBrowserService private _fileBrowserService: IFileBrowserService,
@IMessageService private _messageService: IMessageService
@IFileBrowserService private _fileBrowserService: IFileBrowserService
) {
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostDataProtocol);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostDataProtocol);
}
if (this._connectionManagementService) {
this._connectionManagementService.onLanguageFlavorChanged(e => this._proxy.$languageFlavorChanged(e), this, this._toDispose);
@@ -29,7 +29,7 @@ export class MainThreadObjectExplorer implements MainThreadObjectExplorerShape {
@IWorkbenchEditorService private _workbenchEditorService: IWorkbenchEditorService
) {
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostObjectExplorer);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostObjectExplorer);
}
this._toDispose = [];
}
@@ -30,7 +30,7 @@ export class MainThreadResourceProvider implements MainThreadResourceProviderSha
) {
this._providerMetadata = {};
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostResourceProvider);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostResourceProvider);
}
this._toDispose = [];
}
@@ -30,7 +30,7 @@ export class MainThreadSerializationProvider implements MainThreadSerializationP
) {
if (extHostContext) {
this._proxy = extHostContext.get(SqlExtHostContext.ExtHostSerializationProvider);
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostSerializationProvider);
}
}
@@ -7,9 +7,9 @@
import * as extHostApi from 'vs/workbench/api/node/extHost.api.impl';
import { TrieMap } from 'sql/base/common/map';
import { TPromise } from 'vs/base/common/winjs.base';
import { IInitData } from 'vs/workbench/api/node/extHost.protocol';
import { IInitData, IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionService';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
import { realpath } from 'fs';
import * as extHostTypes from 'vs/workbench/api/node/extHostTypes';
@@ -21,17 +21,16 @@ import { ExtHostCredentialManagement } from 'sql/workbench/api/node/extHostCrede
import { ExtHostDataProtocol } from 'sql/workbench/api/node/extHostDataProtocol';
import { ExtHostSerializationProvider } from 'sql/workbench/api/node/extHostSerializationProvider';
import { ExtHostResourceProvider } from 'sql/workbench/api/node/extHostResourceProvider';
import { ExtHostThreadService } from 'vs/workbench/services/thread/node/extHostThreadService';
import * as sqlExtHostTypes from 'sql/workbench/api/common/sqlExtHostTypes';
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
import { ExtHostConfiguration } from 'vs/workbench/api/node/extHostConfiguration';
import { ExtHostModalDialogs } from 'sql/workbench/api/node/extHostModalDialog';
import { ExtHostTasks } from 'sql/workbench/api/node/extHostTasks';
import { ILogService } from 'vs/platform/log/common/log';
import { ExtHostDashboardWebviews } from 'sql/workbench/api/node/extHostDashboardWebview';
import { ExtHostConnectionManagement } from 'sql/workbench/api/node/extHostConnectionManagement';
import { ExtHostDashboard } from 'sql/workbench/api/node/extHostDashboard';
import { ExtHostObjectExplorer } from 'sql/workbench/api/node/extHostObjectExplorer';
import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService';
export interface ISqlExtensionApiFactory {
vsCodeFactory(extension: IExtensionDescription): typeof vscode;
@@ -43,26 +42,26 @@ export interface ISqlExtensionApiFactory {
*/
export function createApiFactory(
initData: IInitData,
threadService: ExtHostThreadService,
rpcProtocol: IExtHostContext,
extHostWorkspace: ExtHostWorkspace,
extHostConfiguration: ExtHostConfiguration,
extensionService: ExtHostExtensionService,
logService: ILogService
logService: ExtHostLogService
): ISqlExtensionApiFactory {
let vsCodeFactory = extHostApi.createApiFactory(initData, threadService, extHostWorkspace, extHostConfiguration, extensionService, logService);
let vsCodeFactory = extHostApi.createApiFactory(initData, rpcProtocol, extHostWorkspace, extHostConfiguration, extensionService, logService);
// Addressable instances
const extHostAccountManagement = threadService.set(SqlExtHostContext.ExtHostAccountManagement, new ExtHostAccountManagement(threadService));
const extHostConnectionManagement = threadService.set(SqlExtHostContext.ExtHostConnectionManagement, new ExtHostConnectionManagement(threadService));
const extHostCredentialManagement = threadService.set(SqlExtHostContext.ExtHostCredentialManagement, new ExtHostCredentialManagement(threadService));
const extHostDataProvider = threadService.set(SqlExtHostContext.ExtHostDataProtocol, new ExtHostDataProtocol(threadService));
const extHostObjectExplorer = threadService.set(SqlExtHostContext.ExtHostObjectExplorer, new ExtHostObjectExplorer(threadService));
const extHostSerializationProvider = threadService.set(SqlExtHostContext.ExtHostSerializationProvider, new ExtHostSerializationProvider(threadService));
const extHostResourceProvider = threadService.set(SqlExtHostContext.ExtHostResourceProvider, new ExtHostResourceProvider(threadService));
const extHostModalDialogs = threadService.set(SqlExtHostContext.ExtHostModalDialogs, new ExtHostModalDialogs(threadService));
const extHostTasks = threadService.set(SqlExtHostContext.ExtHostTasks, new ExtHostTasks(threadService, logService));
const extHostWebviewWidgets = threadService.set(SqlExtHostContext.ExtHostDashboardWebviews, new ExtHostDashboardWebviews(threadService));
const extHostDashboard = threadService.set(SqlExtHostContext.ExtHostDashboard, new ExtHostDashboard(threadService));
const extHostAccountManagement = rpcProtocol.set(SqlExtHostContext.ExtHostAccountManagement, new ExtHostAccountManagement(rpcProtocol));
const extHostConnectionManagement = rpcProtocol.set(SqlExtHostContext.ExtHostConnectionManagement, new ExtHostConnectionManagement(rpcProtocol));
const extHostCredentialManagement = rpcProtocol.set(SqlExtHostContext.ExtHostCredentialManagement, new ExtHostCredentialManagement(rpcProtocol));
const extHostDataProvider = rpcProtocol.set(SqlExtHostContext.ExtHostDataProtocol, new ExtHostDataProtocol(rpcProtocol));
const extHostObjectExplorer = rpcProtocol.set(SqlExtHostContext.ExtHostObjectExplorer, new ExtHostObjectExplorer(rpcProtocol));
const extHostSerializationProvider = rpcProtocol.set(SqlExtHostContext.ExtHostSerializationProvider, new ExtHostSerializationProvider(rpcProtocol));
const extHostResourceProvider = rpcProtocol.set(SqlExtHostContext.ExtHostResourceProvider, new ExtHostResourceProvider(rpcProtocol));
const extHostModalDialogs = rpcProtocol.set(SqlExtHostContext.ExtHostModalDialogs, new ExtHostModalDialogs(rpcProtocol));
const extHostTasks = rpcProtocol.set(SqlExtHostContext.ExtHostTasks, new ExtHostTasks(rpcProtocol, logService));
const extHostWebviewWidgets = rpcProtocol.set(SqlExtHostContext.ExtHostDashboardWebviews, new ExtHostDashboardWebviews(rpcProtocol));
const extHostDashboard = rpcProtocol.set(SqlExtHostContext.ExtHostDashboard, new ExtHostDashboard(rpcProtocol));
return {
vsCodeFactory: vsCodeFactory,
@@ -7,8 +7,8 @@
import {
createMainContextProxyIdentifier as createMainId,
createExtHostContextProxyIdentifier as createExtId,
ProxyIdentifier
} from 'vs/workbench/services/thread/common/threadService';
ProxyIdentifier, IRPCProtocol } from 'vs/workbench/services/extensions/node/proxyIdentifier';
import { TPromise } from 'vs/base/common/winjs.base';
import { IDisposable } from 'vs/base/common/lifecycle';
+20 -4
View File
@@ -48,7 +48,11 @@ export class NewQueryAction extends Task {
public static ICON = 'new-query';
constructor() {
super({ id: NewQueryAction.ID, title: NewQueryAction.LABEL, iconClass: NewQueryAction.ICON });
super({
id: NewQueryAction.ID,
title: NewQueryAction.LABEL,
iconPath: { dark: NewQueryAction.ICON, light: NewQueryAction.ICON }
});
}
public runTask(accessor: ServicesAccessor, profile: IConnectionProfile): TPromise<void> {
@@ -285,7 +289,11 @@ export class BackupAction extends Task {
public static readonly ICON = Constants.BackupFeatureName;
constructor() {
super({ id: BackupAction.ID, title: BackupAction.LABEL, iconClass: BackupAction.ICON });
super({
id: BackupAction.ID,
title: BackupAction.LABEL,
iconPath: { dark: BackupAction.ICON, light: BackupAction.ICON }
});
}
runTask(accessor: ServicesAccessor, profile: IConnectionProfile): TPromise<void> {
@@ -311,7 +319,11 @@ export class RestoreAction extends Task {
public static readonly ICON = Constants.RestoreFeatureName;
constructor() {
super({ id: RestoreAction.ID, title: RestoreAction.LABEL, iconClass: RestoreAction.ICON });
super({
id: RestoreAction.ID,
title: RestoreAction.LABEL,
iconPath: { dark: RestoreAction.ICON, light: RestoreAction.ICON }
});
}
runTask(accessor: ServicesAccessor, profile: IConnectionProfile): TPromise<void> {
@@ -406,7 +418,11 @@ export class ConfigureDashboardAction extends Task {
private static readonly configHelpUri = 'https://aka.ms/sqldashboardconfig';
constructor() {
super({ id: ConfigureDashboardAction.ID, title: ConfigureDashboardAction.LABEL, iconClass: ConfigureDashboardAction.ICON });
super({
id: ConfigureDashboardAction.ID,
title: ConfigureDashboardAction.LABEL,
iconPath: { dark: ConfigureDashboardAction.ICON, light: ConfigureDashboardAction.ICON }
});
}
runTask(accessor: ServicesAccessor): TPromise<void> {
@@ -75,7 +75,7 @@ export class ErrorMessageDialog extends Modal {
let copyButtonLabel = localize('copyDetails', 'Copy details');
this._copyButton = this.addFooterButton(copyButtonLabel, () => this._clipboardService.writeText(this._messageDetails), 'left');
this._copyButton.icon = 'icon scriptToClipboard';
this._copyButton.getElement().title = copyButtonLabel;
this._copyButton.element.title = copyButtonLabel;
this._register(attachButtonStyler(this._copyButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND }));
}
@@ -144,9 +144,9 @@ export class ErrorMessageDialog extends Modal {
this.title = headerTitle;
this._messageDetails = messageDetails;
if (this._messageDetails) {
this._copyButton.getElement().style.visibility = 'visible';
this._copyButton.element.style.visibility = 'visible';
} else {
this._copyButton.getElement().style.visibility = 'hidden';
this._copyButton.element.style.visibility = 'hidden';
}
this.resetActions();
if (actions && actions.length > 0) {
@@ -154,7 +154,7 @@ export class ErrorMessageDialog extends Modal {
this._actions.push(actions[i]);
let button = this._actionButtons[i];
button.label = actions[i].label;
button.getElement().style.visibility = 'visible';
button.element.style.visibility = 'visible';
}
this._okButton.label = this._closeLabel;
} else {
@@ -169,7 +169,7 @@ export class ErrorMessageDialog extends Modal {
private resetActions(): void {
this._actions = [];
for(let actionButton of this._actionButtons) {
actionButton.getElement().style.visibility = 'hidden';
actionButton.element.style.visibility = 'hidden';
}
}
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { localize } from 'vs/nls';
import Event, { Emitter } from 'vs/base/common/event';
+12 -7
View File
@@ -8,7 +8,6 @@
import nls = require('vs/nls');
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions';
import { IMessageService, CloseAction, Severity } from 'vs/platform/message/common/message';
import pkg from 'vs/platform/node/package';
import product from 'vs/platform/node/product';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -19,6 +18,8 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import URI from 'vs/base/common/uri';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { AbstractShowReleaseNotesAction, loadReleaseNotes } from 'vs/workbench/parts/update/electron-browser/update';
import { INotification, INotificationService, INotificationActions } from 'vs/platform/notification/common/notification';
import Severity from 'vs/base/common/severity';
export class OpenGettingStartedInBrowserAction extends Action {
@@ -57,7 +58,7 @@ export class ProductContribution implements IWorkbenchContribution {
constructor(
@IStorageService storageService: IStorageService,
@IInstantiationService instantiationService: IInstantiationService,
@IMessageService messageService: IMessageService,
@INotificationService notificationService: INotificationService,
@IWorkbenchEditorService editorService: IWorkbenchEditorService
) {
const lastVersion = storageService.get(ProductContribution.KEY, StorageScope.GLOBAL, '');
@@ -67,12 +68,16 @@ export class ProductContribution implements IWorkbenchContribution {
instantiationService.invokeFunction(loadReleaseNotes, pkg.version).then(
text => editorService.openEditor(instantiationService.createInstance(ReleaseNotesInput, pkg.version, text), { pinned: true }),
() => {
messageService.show(Severity.Info, {
message: nls.localize('read the release notes', "Welcome to {0} March Public Preview! Would you like to view the Getting Started Guide?", product.nameLong, pkg.version),
actions: [
instantiationService.createInstance(OpenGettingStartedInBrowserAction),
CloseAction
const actions: INotificationActions = {
primary: [
instantiationService.createInstance(OpenGettingStartedInBrowserAction)
]
};
notificationService.notify({
severity: Severity.Info,
message: nls.localize('read the release notes', "Welcome to {0} March Public Preview! Would you like to view the Getting Started Guide?", product.nameLong, pkg.version),
actions
});
});
}
@@ -10,7 +10,7 @@ import * as sqlops from 'sqlops';
import * as TypeMoq from 'typemoq';
import { AddAccountAction, RemoveAccountAction } from 'sql/parts/accountManagement/common/accountActions';
import { AccountManagementTestService } from 'sqltest/stubs/accountManagementStubs';
import { MessageServiceStub } from 'sqltest/stubs/messageServiceStub';
// import { MessageServiceStub } from 'sqltest/stubs/messageServiceStub';
import { ErrorMessageServiceStub } from 'sqltest/stubs/errorMessageServiceStub';
let testAccount = <sqlops.Account>{
@@ -6,8 +6,6 @@
'use strict';
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
import { IMessageService } from 'vs/platform/message/common/message';
import { TestMessageService, TestEditorGroupService } from 'vs/workbench/test/workbenchTestServices';
import { EditorInput } from 'vs/workbench/common/editor';
import { IEditorDescriptor } from 'vs/workbench/browser/editor';
import { TPromise } from 'vs/base/common/winjs.base';
@@ -32,12 +30,14 @@ import * as TypeMoq from 'typemoq';
import * as assert from 'assert';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { INotification, INotificationService } from 'vs/platform/notification/common/notification';
import { TestNotificationService } from 'vs/workbench/test/workbenchTestServices';
suite('SQL QueryEditor Tests', () => {
let queryModelService: QueryModelService;
let instantiationService: TypeMoq.Mock<InstantiationService>;
let themeService: TestThemeService = new TestThemeService();
let messageService: TypeMoq.Mock<IMessageService>;
let notificationService: TypeMoq.Mock<INotificationService>;
let editorDescriptorService: TypeMoq.Mock<EditorDescriptorService>;
let connectionManagementService: TypeMoq.Mock<ConnectionManagementService>;
let memento: TypeMoq.Mock<Memento>;
@@ -124,7 +124,7 @@ suite('SQL QueryEditor Tests', () => {
queryInput2 = new QueryInput('second', 'second', fileInput2, queryResultsInput2, undefined, undefined, undefined, undefined);
// Mock IMessageService
messageService = TypeMoq.Mock.ofType(TestMessageService, TypeMoq.MockBehavior.Loose);
notificationService = TypeMoq.Mock.ofType(TestNotificationService, TypeMoq.MockBehavior.Loose);
// Mock ConnectionManagementService
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
@@ -134,7 +134,7 @@ suite('SQL QueryEditor Tests', () => {
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAny())).returns(() => false);
// Create a QueryModelService
queryModelService = new QueryModelService(instantiationService.object, messageService.object);
queryModelService = new QueryModelService(instantiationService.object, notificationService.object);
});
test('createEditor creates only the taskbar', (done) => {
+5 -8
View File
@@ -5,11 +5,12 @@
'use strict';
/*
import Severity from 'vs/base/common/severity';
import { IConfirmation, IMessageService, IMessageWithAction, IConfirmationResult } from 'vs/platform/message/common/message';
import { TPromise } from 'vs/base/common/winjs.base';
export class MessageServiceStub implements IMessageService{
export class MessageServiceStub implements IMessageService {
_serviceBrand: any;
show(sev: Severity, message: string): () => void;
@@ -29,17 +30,13 @@ export class MessageServiceStub implements IMessageService{
return true;
}
/**
* Ask the user for confirmation.
*/
confirmSync(confirmation: IConfirmation): boolean {
return undefined;
}
/**
* Ask the user for confirmation with a checkbox.
*/
confirmWithCheckbox(confirmation: IConfirmation): TPromise<IConfirmationResult> {
return undefined;
}
}
}
*/
@@ -10,6 +10,7 @@ import { IEditorService, IEditor, IEditorInput, IEditorOptions, ITextEditorOptio
import { TPromise } from 'vs/base/common/winjs.base';
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { EditorInput, EditorOptions, IFileEditorInput, TextEditorOptions, Extensions, SideBySideEditorInput } from 'vs/workbench/common/editor';
import { ICloseEditorsFilter } from 'vs/workbench/browser/parts/editor/editorPart';
export class WorkbenchEditorTestService implements IWorkbenchEditorService {
_serviceBrand: ServiceIdentifier<any>;
@@ -87,7 +88,7 @@ export class WorkbenchEditorTestService implements IWorkbenchEditorService {
* will not be closed. The direction can be used in that case to control if all other editors should get closed,
* or towards a specific direction.
*/
closeEditors(position: Position, filter?: { except?: IEditorInput, direction?: Direction, unmodifiedOnly?: boolean }): TPromise<void> {
closeEditors(p1?: any, p2?: any, p3?: any): TPromise<void> {
return undefined;
}
@@ -10,34 +10,34 @@ import * as sqlops from 'sqlops';
import * as TypeMoq from 'typemoq';
import { AccountProviderStub, AccountManagementTestService } from 'sqltest/stubs/accountManagementStubs';
import { ExtHostAccountManagement } from 'sql/workbench/api/node/extHostAccountManagement';
import { TestThreadService } from 'vs/workbench/test/electron-browser/api/testThreadService';
import { TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCProtocol';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IRPCProtocol } from 'vs/workbench/services/extensions/node/proxyIdentifier';
import { SqlMainContext } from 'sql/workbench/api/node/sqlExtHost.protocol';
import { MainThreadAccountManagement } from 'sql/workbench/api/node/mainThreadAccountManagement';
import { IAccountManagementService } from 'sql/services/accountManagement/interfaces';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
const IThreadService = createDecorator<IThreadService>('threadService');
const IRPCProtocol = createDecorator<IRPCProtocol>('rpcProtocol');
// SUITE STATE /////////////////////////////////////////////////////////////
let instantiationService: TestInstantiationService;
let mockAccountMetadata: sqlops.AccountProviderMetadata;
let mockAccount: sqlops.Account;
let threadService: TestThreadService;
let threadService: TestRPCProtocol;
// TESTS ///////////////////////////////////////////////////////////////////
suite('ExtHostAccountManagement', () => {
suiteSetup(() => {
threadService = new TestThreadService();
threadService = new TestRPCProtocol();
const accountMgmtStub = new AccountManagementTestService();
instantiationService = new TestInstantiationService();
instantiationService.stub(IThreadService, threadService);
instantiationService.stub(IRPCProtocol, threadService);
instantiationService.stub(IAccountManagementService, accountMgmtStub);
const accountMgmtService = instantiationService.createInstance(MainThreadAccountManagement);
threadService.setTestInstance(SqlMainContext.MainThreadAccountManagement, accountMgmtService);
threadService.set(SqlMainContext.MainThreadAccountManagement, accountMgmtService);
mockAccountMetadata = {
args: {},
@@ -6,36 +6,36 @@
'use strict';
import * as assert from 'assert';
import { TestThreadService } from 'vs/workbench/test/electron-browser/api/testThreadService';
import { TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCProtocol';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { ExtHostCredentialManagement } from 'sql/workbench/api/node/extHostCredentialManagement';
import { SqlMainContext } from 'sql/workbench/api/node/sqlExtHost.protocol';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IRPCProtocol } from 'vs/workbench/services/extensions/node/proxyIdentifier';
import { MainThreadCredentialManagement } from 'sql/workbench/api/node/mainThreadCredentialManagement';
import { CredentialsTestProvider, CredentialsTestService } from 'sqltest/stubs/credentialsTestStubs';
import { ICredentialsService } from 'sql/services/credentials/credentialsService';
import { Credential, CredentialProvider } from 'sqlops';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
const IThreadService = createDecorator<IThreadService>('threadService');
const IRPCProtocol = createDecorator<IRPCProtocol>('rpcProtocol');
// SUITE STATE /////////////////////////////////////////////////////////////
let credentialServiceStub: CredentialsTestService;
let instantiationService: TestInstantiationService;
let threadService: TestThreadService;
let threadService: TestRPCProtocol;
// TESTS ///////////////////////////////////////////////////////////////////
suite('ExtHostCredentialManagement', () => {
suiteSetup(() => {
threadService = new TestThreadService();
threadService = new TestRPCProtocol();
credentialServiceStub = new CredentialsTestService();
instantiationService = new TestInstantiationService();
instantiationService.stub(IThreadService, threadService);
instantiationService.stub(IRPCProtocol, threadService);
instantiationService.stub(ICredentialsService, credentialServiceStub);
const credentialService = instantiationService.createInstance(MainThreadCredentialManagement);
threadService.setTestInstance(SqlMainContext.MainThreadCredentialManagement, credentialService);
threadService.set(SqlMainContext.MainThreadCredentialManagement, credentialService);
});
test('Construct ExtHostCredentialManagement', () => {
@@ -10,12 +10,12 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
import { setUnexpectedErrorHandler, errorHandler } from 'vs/base/common/errors';
import URI from 'vs/base/common/uri';
import * as EditorCommon from 'vs/editor/common/editorCommon';
import { Model as EditorModel } from 'vs/editor/common/model/model';
import { TestThreadService } from 'vs/workbench/test/electron-browser/api/testThreadService';
import { TextModel as EditorModel } from 'vs/editor/common/model/textModel';
import { TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCProtocol';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IMarkerService } from 'vs/platform/markers/common/markers';
import { MarkerService } from 'vs/platform/markers/common/markerService';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { IRPCProtocol } from 'vs/workbench/services/extensions/node/proxyIdentifier';
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
import { MainThreadCommands } from 'vs/workbench/api/electron-browser/mainThreadCommands';
import { IHeapService } from 'vs/workbench/api/electron-browser/mainThreadHeapService';
@@ -31,9 +31,9 @@ import * as sqlops from 'sqlops';
import { ExtHostDataProtocol } from 'sql/workbench/api/node/extHostDataProtocol';
import { SqlExtHostContext } from 'sql/workbench/api/node/sqlExtHost.protocol';
const IThreadService = createDecorator<IThreadService>('threadService');
const IRPCProtocol = createDecorator<IRPCProtocol>('rpcProtocol');
const model: EditorCommon.IModel = EditorModel.createFromString(
const model = EditorModel.createFromString(
[
'This is the first line',
'This is the second line',
@@ -45,7 +45,7 @@ const model: EditorCommon.IModel = EditorModel.createFromString(
let extHost: ExtHostDataProtocol;
let disposables: vscode.Disposable[] = [];
let threadService: TestThreadService;
let threadService: TestRPCProtocol;
let originalErrorHandler: (e: any) => any;
suite('ExtHostDataProtocol', function () {
+1
View File
@@ -11,6 +11,7 @@
"declaration": true,
"noImplicitReturns": true,
"baseUrl": ".",
"outDir": "../out",
"typeRoots": [
"typings"
]
+1 -1
View File
@@ -1,5 +1,5 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"$schema": "https://schemastore.azurewebsites.net/schemas/json/tsconfig.json",
"compilerOptions": {
"noEmit": true,
"module": "amd",
+3 -3
View File
@@ -6,13 +6,13 @@
/// <reference path='./node.d.ts'/>
declare module 'iconv-lite' {
export function decode(buffer: NodeBuffer, encoding: string, options?: any): string;
export function decode(buffer: NodeBuffer, encoding: string): string;
export function encode(content: string, encoding: string, options?: any): NodeBuffer;
export function encode(content: string | NodeBuffer, encoding: string, options?: { addBOM?: boolean }): NodeBuffer;
export function encodingExists(encoding: string): boolean;
export function decodeStream(encoding: string): NodeJS.ReadWriteStream;
export function encodeStream(encoding: string): NodeJS.ReadWriteStream;
export function encodeStream(encoding: string, options?: { addBOM?: boolean }): NodeJS.ReadWriteStream;
}
+10
View File
@@ -0,0 +1,10 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'native-is-elevated' {
function isElevated(): boolean;
export = isElevated;
}
+1
View File
@@ -1720,6 +1720,7 @@ declare module "child_process" {
uid?: number;
gid?: number;
shell?: boolean | string;
windowsVerbatimArguments?: boolean;
}
export function spawn(command: string, args?: string[], options?: SpawnOptions): ChildProcess;

Some files were not shown because too many files have changed in this diff Show More