diff --git a/src/vs/workbench/parts/explorers/browser/treeExplorerViewlet.ts b/src/vs/workbench/parts/explorers/browser/treeExplorerViewlet.ts index 3de0661bb45eb173c0e1bb2666f22ed85764f385..fe4567953db6c1623b4c2474c64081cedc4fb785 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 2d0ad9f561968e6cded7b7ddc4a1cf21063bf91b..21c4af7ebcf56c8f14777fa896a03a27c937ce44 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]; }