From 884bc1b3c294d85205261dfc1324612f94e18087 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 6 Dec 2016 18:41:33 +0100 Subject: [PATCH] fixes #16667 --- .../explorers/browser/treeExplorerViewlet.ts | 31 ++++++++++++++----- .../browser/views/treeExplorerView.ts | 1 + 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/parts/explorers/browser/treeExplorerViewlet.ts b/src/vs/workbench/parts/explorers/browser/treeExplorerViewlet.ts index 3de0661bb45..fe4567953db 100644 --- a/src/vs/workbench/parts/explorers/browser/treeExplorerViewlet.ts +++ b/src/vs/workbench/parts/explorers/browser/treeExplorerViewlet.ts @@ -32,7 +32,9 @@ export class TreeExplorerViewlet extends Viewlet { this.viewletState = new TreeExplorerViewletState(); this.viewletId = viewletId; - this.treeNodeProviderId = this.getTreeProviderName(viewletId); + + const tokens = viewletId.split('.'); + this.treeNodeProviderId = tokens[tokens.length - 1]; } public getId(): string { @@ -63,19 +65,34 @@ export class TreeExplorerViewlet extends Viewlet { } private addTreeView(): void { - // Hide header (root node) by default - const headerSize = 0; + const headerSize = 0; // Hide header (root node) by default this.view = this.instantiationService.createInstance(TreeExplorerView, this.viewletState, this.treeNodeProviderId, this.getActionRunner(), headerSize); this.view.render(this.viewletContainer.getHTMLElement(), Orientation.VERTICAL); } - private getTreeProviderName(viewletId: string): string { - const tokens = viewletId.split('.'); - return tokens[tokens.length - 1]; + public focus(): void { + super.focus(); + + if (this.view) { + this.view.focusBody(); + } + } + + public shutdown(): void { + if (this.view) { + this.view.shutdown(); + } + + super.shutdown(); } public dispose(): void { - this.view = null; + if (this.view) { + this.view = null; + this.view.dispose(); + } + + super.dispose(); } } diff --git a/src/vs/workbench/parts/explorers/browser/views/treeExplorerView.ts b/src/vs/workbench/parts/explorers/browser/views/treeExplorerView.ts index 2d0ad9f5619..21c4af7ebcf 100644 --- a/src/vs/workbench/parts/explorers/browser/views/treeExplorerView.ts +++ b/src/vs/workbench/parts/explorers/browser/views/treeExplorerView.ts @@ -72,6 +72,7 @@ export class TreeExplorerView extends CollapsibleViewletView { public getActions(): IAction[] { const refresh = this.instantiationService.createInstance(RefreshViewExplorerAction, this); + return [refresh]; } -- GitLab