mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 01:25:36 -05:00
Add datavirtualization extension (#21594)
* initial * cleanup * Add typings ref * fix compile * remove unused * add missing * another unused * Use newer vscodetestcover * newer dataprotocol * format * cleanup ignores * fix out path * fix entry point * more cleanup * Move into src folder * Handle service client log messages * remove unused
This commit is contained in:
28
extensions/datavirtualization/src/hdfsCommands.ts
Normal file
28
extensions/datavirtualization/src/hdfsCommands.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
import { ICommandViewContext, ICommandObjectExplorerContext } from './command';
|
||||
import * as constants from './constants';
|
||||
import * as LocalizedConstants from './localizedConstants';
|
||||
import { AppContext } from './appContext';
|
||||
import { TreeNode } from './treeNodes';
|
||||
import { MssqlExtensionApi } from './typings/mssqlapis';
|
||||
|
||||
|
||||
export async function getNodeFromMssqlProvider<T extends TreeNode>(context: ICommandViewContext | ICommandObjectExplorerContext, appContext: AppContext): Promise<T> {
|
||||
let node: T = undefined;
|
||||
if (context && context.type === constants.ViewType && context.node) {
|
||||
node = context.node as T;
|
||||
} else if (context && context.type === constants.ObjectExplorerService) {
|
||||
let extensionApi: MssqlExtensionApi = vscode.extensions.getExtension('Microsoft.mssql').exports;
|
||||
let mssqlObjectExplorerBrowser = extensionApi.getMssqlObjectExplorerBrowser();
|
||||
node = <T><any>await mssqlObjectExplorerBrowser.getNode(context.explorerContext);
|
||||
} else {
|
||||
throw new Error(LocalizedConstants.msgMissingNodeContext);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
Reference in New Issue
Block a user