mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 17:22:20 -05:00
* 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
65 lines
2.7 KiB
TypeScript
65 lines
2.7 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
'use strict';
|
|
|
|
import * as sqlops from 'sqlops';
|
|
import { TPromise } from 'vs/base/common/winjs.base';
|
|
import { IResourceProviderService } from 'sql/parts/accountManagement/common/interfaces';
|
|
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
|
import {
|
|
ExtHostResourceProviderShape,
|
|
MainThreadResourceProviderShape,
|
|
SqlExtHostContext,
|
|
SqlMainContext
|
|
} from 'sql/workbench/api/node/sqlExtHost.protocol';
|
|
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
|
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
|
|
|
|
|
@extHostNamedCustomer(SqlMainContext.MainThreadResourceProvider)
|
|
export class MainThreadResourceProvider implements MainThreadResourceProviderShape {
|
|
private _providerMetadata: { [handle: number]: sqlops.AccountProviderMetadata };
|
|
private _proxy: ExtHostResourceProviderShape;
|
|
private _toDispose: IDisposable[];
|
|
|
|
constructor(
|
|
extHostContext: IExtHostContext,
|
|
@IResourceProviderService private _resourceProviderService: IResourceProviderService
|
|
) {
|
|
this._providerMetadata = {};
|
|
if (extHostContext) {
|
|
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostResourceProvider);
|
|
}
|
|
this._toDispose = [];
|
|
}
|
|
|
|
public $registerResourceProvider(providerMetadata: sqlops.ResourceProviderMetadata, handle: number): Thenable<any> {
|
|
let self = this;
|
|
|
|
// Create the account provider that interfaces with the extension via the proxy and register it
|
|
let resourceProvider: sqlops.ResourceProvider = {
|
|
createFirewallRule(account: sqlops.Account, firewallruleInfo: sqlops.FirewallRuleInfo): Thenable<sqlops.CreateFirewallRuleResponse> {
|
|
return self._proxy.$createFirewallRule(handle, account, firewallruleInfo);
|
|
},
|
|
handleFirewallRule(errorCode: number, errorMessage: string, connectionTypeId: string): Thenable<sqlops.HandleFirewallRuleResponse> {
|
|
return self._proxy.$handleFirewallRule(handle, errorCode, errorMessage, connectionTypeId);
|
|
}
|
|
};
|
|
this._resourceProviderService.registerProvider(providerMetadata.id, resourceProvider);
|
|
this._providerMetadata[handle] = providerMetadata;
|
|
|
|
return TPromise.as(null);
|
|
}
|
|
|
|
public $unregisterResourceProvider(handle: number): Thenable<any> {
|
|
this._resourceProviderService.unregisterProvider(this._providerMetadata[handle].id);
|
|
return TPromise.as(null);
|
|
}
|
|
|
|
public dispose(): void {
|
|
this._toDispose = dispose(this._toDispose);
|
|
}
|
|
}
|