From 596f09f7544ed1769f8c721e47ebd4378f208ecd Mon Sep 17 00:00:00 2001 From: Anthony Dresser Date: Fri, 6 Apr 2018 15:53:45 -0700 Subject: [PATCH] add custom action for explorer actions (#1059) --- .../dashboard/widgets/explorer/explorerTree.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/sql/parts/dashboard/widgets/explorer/explorerTree.ts b/src/sql/parts/dashboard/widgets/explorer/explorerTree.ts index 28b46c74ce..03144175bf 100644 --- a/src/sql/parts/dashboard/widgets/explorer/explorerTree.ts +++ b/src/sql/parts/dashboard/widgets/explorer/explorerTree.ts @@ -28,6 +28,7 @@ import { IAction } from 'vs/base/common/actions'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { generateUuid } from 'vs/base/common/uuid'; import { $ } from 'vs/base/browser/dom'; +import { ExecuteCommandAction } from 'vs/platform/actions/common/actions'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; export class ObjectMetadataWrapper implements ObjectMetadata { @@ -385,14 +386,14 @@ function GetExplorerActions(element: TreeResource, instantiationService: IInstan actions.push(instantiationService.createInstance(ScriptAlterAction, ScriptAlterAction.ID, ScriptAlterAction.LABEL)); } } else { - actions.push(instantiationService.createInstance(OEAction, NewQueryAction.ID, NewQueryAction.LABEL)); + actions.push(instantiationService.createInstance(CustomExecuteCommandAction, NewQueryAction.ID, NewQueryAction.LABEL)); - let action: IAction = instantiationService.createInstance(OEAction, RestoreAction.ID, RestoreAction.LABEL); + let action: IAction = instantiationService.createInstance(CustomExecuteCommandAction, RestoreAction.ID, RestoreAction.LABEL); if (capabilitiesService.isFeatureAvailable(action, info)) { actions.push(action); } - action = instantiationService.createInstance(OEAction, BackupAction.ID, BackupAction.LABEL); + action = instantiationService.createInstance(CustomExecuteCommandAction, BackupAction.ID, BackupAction.LABEL); if (capabilitiesService.isFeatureAvailable(action, info)) { actions.push(action); } @@ -405,3 +406,9 @@ function GetExplorerActions(element: TreeResource, instantiationService: IInstan return TPromise.as(actions); } + +class CustomExecuteCommandAction extends ExecuteCommandAction { + run(context: ManageActionContext): TPromise { + return super.run(context.profile); + } +}