Files
azuredatastudio/extensions/datavirtualization/src/hdfsCommands.ts
Charles Gagnon ec838947b0 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
2023-01-17 09:57:21 -08:00

29 lines
1.4 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* 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;
}