mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 17:22:29 -05:00
* working on formatting * fixed basic lint errors; starting moving things to their appropriate location * formatting * update tslint to match the version of vscode we have * remove unused code * work in progress fixing layering * formatting * moved connection management service to platform * formatting * add missing file * moving more servies * formatting * moving more services * formatting * wip * moving more services * formatting * revert back tslint rules * move css file * add missing svgs
66 lines
2.2 KiB
TypeScript
66 lines
2.2 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 { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
|
|
import { TaskRegistry, ITaskHandlerDescription } from 'sql/platform/tasks/common/tasks';
|
|
import { IDisposable } from 'vs/base/common/lifecycle';
|
|
import { TPromise } from 'vs/base/common/winjs.base';
|
|
import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
|
|
|
|
import {
|
|
ExtHostAccountManagementShape,
|
|
MainThreadAccountManagementShape,
|
|
SqlExtHostContext,
|
|
SqlMainContext,
|
|
ExtHostTasksShape,
|
|
MainThreadTasksShape
|
|
} from 'sql/workbench/api/node/sqlExtHost.protocol';
|
|
|
|
import { IConnectionProfile } from 'sqlops';
|
|
|
|
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
|
|
|
@extHostNamedCustomer(SqlMainContext.MainThreadTasks)
|
|
export class MainThreadTasks implements MainThreadTasksShape {
|
|
|
|
private readonly _disposables = new Map<string, IDisposable>();
|
|
private readonly _generateCommandsDocumentationRegistration: IDisposable;
|
|
private readonly _proxy: ExtHostTasksShape;
|
|
|
|
constructor(
|
|
extHostContext: IExtHostContext
|
|
) {
|
|
this._proxy = extHostContext.getProxy(SqlExtHostContext.ExtHostTasks);
|
|
}
|
|
|
|
dispose() {
|
|
this._disposables.forEach(value => value.dispose());
|
|
this._disposables.clear();
|
|
|
|
this._generateCommandsDocumentationRegistration.dispose();
|
|
}
|
|
|
|
$registerTask(id: string): TPromise<any> {
|
|
this._disposables.set(
|
|
id,
|
|
TaskRegistry.registerTask(id, (accessor, profile: IConnectionProfile, ...args) => {
|
|
if (profile instanceof ConnectionProfile) {
|
|
profile = profile.toIConnectionProfile();
|
|
}
|
|
this._proxy.$executeContributedTask(id, profile, ...args);
|
|
})
|
|
);
|
|
return undefined;
|
|
}
|
|
|
|
$unregisterTask(id: string): TPromise<any> {
|
|
if (this._disposables.has(id)) {
|
|
this._disposables.get(id).dispose();
|
|
this._disposables.delete(id);
|
|
}
|
|
return undefined;
|
|
}
|
|
}
|