diff --git a/src/vs/workbench/api/node/mainThreadExplorerView.ts b/src/vs/workbench/api/node/mainThreadExplorerView.ts index 4ffaa3977c2..8028c7069ec 100644 --- a/src/vs/workbench/api/node/mainThreadExplorerView.ts +++ b/src/vs/workbench/api/node/mainThreadExplorerView.ts @@ -73,9 +73,11 @@ class TreeExplorerNodeProvider implements IExplorerViewDataProvider { return node.contextKey; } - executeCommand(node: ITreeNode): TPromise { - return this._proxy.$getInternalCommand(this.id, node).then(command => { - return this.commandService.executeCommand(command.id, ...command.arguments); + select(node: ITreeNode): void { + this._proxy.$getInternalCommand(this.id, node).then(command => { + if (command) { + this.commandService.executeCommand(command.id, ...command.arguments); + } }); } } diff --git a/src/vs/workbench/parts/explorers/browser/explorerView.ts b/src/vs/workbench/parts/explorers/browser/explorerView.ts index 7e11e5fca63..7b7d6f375d2 100644 --- a/src/vs/workbench/parts/explorers/browser/explorerView.ts +++ b/src/vs/workbench/parts/explorers/browser/explorerView.ts @@ -135,7 +135,12 @@ class TreeExplorerView extends CollapsibleViewletView { this.toDispose.push(attachListStyler(tree, this.themeService)); this.toDispose.push(this.listService.register(tree, [this.viewFocusContext])); - + tree.addListener('selection', (event: any) => { + const selection = tree.getSelection()[0]; + if (selection) { + this.dataProvider.select(selection); + } + }); return tree; } diff --git a/src/vs/workbench/parts/explorers/common/explorer.ts b/src/vs/workbench/parts/explorers/common/explorer.ts index b6a1731fb9b..338b63463de 100644 --- a/src/vs/workbench/parts/explorers/common/explorer.ts +++ b/src/vs/workbench/parts/explorers/common/explorer.ts @@ -33,4 +33,5 @@ export interface IExplorerViewDataProvider { getLabel(element: T): string; getContextKey(element: T): string; hasChildren(element: T): boolean; + select(element: T): void; }