Only pass selection in custom tree view if action is in selection

Fixes #79981
This commit is contained in:
Alex Ross 2019-08-29 11:15:53 +02:00
parent ec3296d548
commit 028ffd81b1

View file

@ -855,8 +855,18 @@ class MultipleSelectionActionRunner extends ActionRunner {
runAction(action: IAction, context: TreeViewItemHandleArg): Promise<any> {
const selection = this.getSelectedResources();
let selectionHandleArgs: TreeViewItemHandleArg[] | undefined = undefined;
let actionInSelected: boolean = false;
if (selection.length > 1) {
selectionHandleArgs = selection.map(selected => { return { $treeViewId: context.$treeViewId, $treeItemHandle: selected.handle }; });
selectionHandleArgs = selection.map(selected => {
if (selected.handle === context.$treeItemHandle) {
actionInSelected = true;
}
return { $treeViewId: context.$treeViewId, $treeItemHandle: selected.handle };
});
}
if (!actionInSelected) {
selectionHandleArgs = undefined;
}
return action.run(...[context, selectionHandleArgs]);