Fix up data explorer contributed actions on OE nodes (#11685)

* Fix up data explorer contributed actions on OE nodes

* sql carbon edit

* add Database node
This commit is contained in:
Charles Gagnon
2020-08-11 10:25:38 -07:00
committed by GitHub
parent 86fcd05eff
commit aecb0efbc0
7 changed files with 52 additions and 45 deletions

View File

@@ -7,15 +7,39 @@ import { IMainContext } from 'vs/workbench/api/common/extHost.protocol';
import { ExtHostObjectExplorerShape, SqlMainContext, MainThreadObjectExplorerShape } from 'sql/workbench/api/common/sqlExtHost.protocol';
import * as azdata from 'azdata';
import * as vscode from 'vscode';
import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
import { TreeViewItemHandleArg, NodeType } from 'sql/workbench/common/views';
export class ExtHostObjectExplorer implements ExtHostObjectExplorerShape {
private _proxy: MainThreadObjectExplorerShape;
constructor(
mainContext: IMainContext
mainContext: IMainContext,
commands: ExtHostCommands
) {
this._proxy = mainContext.getProxy(SqlMainContext.MainThreadObjectExplorer);
function isDataExplorerTreeViewItemHandleArg(arg: any): boolean {
return arg?.$treeItem?.payload;
}
function convertDataExplorerArgument(arg: TreeViewItemHandleArg): any {
return <azdata.ObjectExplorerContext>{
connectionProfile: arg.$treeItem.payload,
isConnectionNode: arg.$treeItem?.type === NodeType.Server || arg.$treeItem?.type === NodeType.Database,
nodeInfo: arg.$treeItem.nodeInfo
};
}
commands.registerArgumentProcessor({
processArgument: arg => {
if (isDataExplorerTreeViewItemHandleArg(arg)) {
return convertDataExplorerArgument(arg);
}
return arg;
}
});
}
public $getNode(connectionId: string, nodePath?: string): Thenable<azdata.objectexplorer.ObjectExplorerNode> {