Skip to content

Commit

Permalink
Revert "Fox microsoft#39340"
Browse files Browse the repository at this point in the history
This reverts commit 101f7a0.
  • Loading branch information
afonsobspinto committed Dec 5, 2017
1 parent 101f7a0 commit 96b8263
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
32 changes: 10 additions & 22 deletions src/vs/workbench/browser/parts/views/treeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class TreeView extends TreeViewsViewletPanel {
private treeInputPromise: TPromise<void>;

private dataProviderElementChangeListener: IDisposable;
private elementsToRefresh: ITreeItem[] = [];

constructor(
options: IViewletViewOptions,
Expand Down Expand Up @@ -114,6 +113,10 @@ export class TreeView extends TreeViewsViewletPanel {
return createActionItem(action, this.keybindingService, this.messageService);
}

public setVisible(visible: boolean): TPromise<void> {
return super.setVisible(visible);
}

private setInput(): TPromise<void> {
if (this.tree) {
if (!this.treeInputPromise) {
Expand Down Expand Up @@ -169,30 +172,15 @@ export class TreeView extends TreeViewsViewletPanel {
}
}

protected updateTreeVisibility(tree: WorkbenchTree, isVisible: boolean): void {
super.updateTreeVisibility(tree, isVisible);
if (isVisible && this.elementsToRefresh.length) {
this.doRefresh(this.elementsToRefresh);
this.elementsToRefresh = [];
}
}

private refresh(elements: ITreeItem[]): void {
if (!elements) {
if (elements) {
for (const element of elements) {
this.tree.refresh(element);
}
} else {
const root: ITreeItem = this.tree.getInput();
root.children = null; // reset children
elements = [root];
}
if (this.isVisible() && this.isExpanded()) {
this.doRefresh(elements);
} else {
this.elementsToRefresh.push(...elements);
}
}

private doRefresh(elements: ITreeItem[]): void {
for (const element of elements) {
this.tree.refresh(element);
this.tree.refresh(root);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/parts/views/viewsViewlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export abstract class TreeViewsViewletPanel extends ViewsViewletPanel {
super.dispose();
}

protected updateTreeVisibility(tree: WorkbenchTree, isVisible: boolean): void {
private updateTreeVisibility(tree: WorkbenchTree, isVisible: boolean): void {
if (!tree) {
return;
}
Expand Down

0 comments on commit 96b8263

Please sign in to comment.