Refresh master with initial release/0.24 snapshot (#332)

* Initial port of release/0.24 source code

* Fix additional headers

* Fix a typo in launch.json
This commit is contained in:
Karl Burtram
2017-12-15 15:38:57 -08:00
committed by GitHub
parent 271b3a0b82
commit 6ad0df0e3e
7118 changed files with 107999 additions and 56466 deletions

View File

@@ -12,6 +12,8 @@ import * as nls from 'vs/nls';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
export class GlobalNewProfilerAction extends Action {
public static ID = 'explorer.newProfiler';
@@ -20,13 +22,31 @@ export class GlobalNewProfilerAction extends Action {
constructor(
id: string, label: string,
@IWorkbenchEditorService private _editorService: IWorkbenchEditorService,
@IInstantiationService private _instantiationService: IInstantiationService
@IInstantiationService private _instantiationService: IInstantiationService,
@IConnectionManagementService private _connectionService: IConnectionManagementService
) {
super(id, label);
}
run(context?: any): TPromise<boolean> {
let profilerInput = this._instantiationService.createInstance(ProfilerInput, context ? context.connectionProfile : undefined);
// TODO: for test-only, grab the first MSSQL active connection for the profiler session
// TODO: when finishing the feature the connection should come from the launch context
let connectionProfile: IConnectionProfile;
if (context && context.connectionProfile) {
connectionProfile = context.connectionProfile;
} else {
let activeConnections = this._connectionService.getActiveConnections();
if (activeConnections) {
for (let i = 0; i < activeConnections.length; ++i) {
if (activeConnections[i].providerName === 'MSSQL') {
connectionProfile = activeConnections[i];
break;
}
}
}
}
let profilerInput = this._instantiationService.createInstance(ProfilerInput, connectionProfile);
return this._editorService.openEditor(profilerInput, { pinned: true }, false).then(() => TPromise.as(true));
}
}