Skip to content

Commit

Permalink
Fix #48634
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Apr 25, 2018
1 parent 81766b6 commit 50f81f0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/parts/views/customView.ts
Expand Up @@ -339,7 +339,7 @@ class TreeDataSource implements IDataSource {

public getChildren(tree: ITree, node: ITreeItem): TPromise<any[]> {
if (this.treeView.dataProvider) {
return this.location ? this.treeView.dataProvider.getChildren(node) : this.progressService.withProgress({ location: this.location }, () => this.treeView.dataProvider.getChildren(node));
return this.location ? this.progressService.withProgress({ location: this.location }, () => this.treeView.dataProvider.getChildren(node)) : this.treeView.dataProvider.getChildren(node);
}
return TPromise.as([]);
}
Expand Down
19 changes: 18 additions & 1 deletion src/vs/workbench/browser/parts/views/panelViewlet.ts
Expand Up @@ -46,6 +46,9 @@ export abstract class ViewletPanel extends Panel {
private _onDidFocus = new Emitter<void>();
readonly onDidFocus: Event<void> = this._onDidFocus.event;

private _onDidChangeTitleArea = new Emitter<void>();
readonly onDidChangeTitleArea: Event<void> = this._onDidChangeTitleArea.event;

protected actionRunner: IActionRunner;
protected toolbar: ToolBar;
private headerContainer: HTMLElement;
Expand Down Expand Up @@ -103,6 +106,7 @@ export abstract class ViewletPanel extends Panel {
protected updateActions(): void {
this.toolbar.setActions(prepareActions(this.getActions()), prepareActions(this.getSecondaryActions()))();
this.toolbar.context = this.getActionsContext();
this._onDidChangeTitleArea.fire();
}

protected updateActionsVisibility(): void {
Expand Down Expand Up @@ -221,6 +225,14 @@ export class PanelViewlet extends Viewlet {
return [];
}

getActionItem(action: IAction): IActionItem {
if (this.isSingleView()) {
return this.panelItems[0].panel.getActionItem(action);
}

return super.getActionItem(action);
}

focus(): void {
super.focus();

Expand Down Expand Up @@ -263,6 +275,11 @@ export class PanelViewlet extends Viewlet {
private addPanel(panel: ViewletPanel, size: number, index = this.panelItems.length - 1): void {
const disposables: IDisposable[] = [];
const onDidFocus = panel.onDidFocus(() => this.lastFocusedPanel = panel, null, disposables);
const onDidChangeTitleArea = panel.onDidChangeTitleArea(() => {
if (this.isSingleView()) {
this.updateTitleArea();
}
}, null, disposables);
const onDidChange = panel.onDidChange(() => {
if (panel === this.lastFocusedPanel && !panel.isExpanded()) {
this.lastFocusedPanel = undefined;
Expand All @@ -275,7 +292,7 @@ export class PanelViewlet extends Viewlet {
headerHighContrastBorder: index === 0 ? null : contrastBorder,
dropBackground: SIDE_BAR_DRAG_AND_DROP_BACKGROUND
}, panel);
const disposable = combinedDisposable([onDidFocus, panelStyler, onDidChange]);
const disposable = combinedDisposable([onDidFocus, onDidChangeTitleArea, panelStyler, onDidChange]);
const panelItem: IViewletPanelItem = { panel, disposable };

this.panelItems.splice(index, 0, panelItem);
Expand Down

0 comments on commit 50f81f0

Please sign in to comment.