Skip to content

Commit

Permalink
update on did change
Browse files Browse the repository at this point in the history
Signed-off-by: Colin Grant <[email protected]>
  • Loading branch information
colin-grant-work committed Jan 20, 2021
1 parent 47be972 commit 8f8170a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/core/src/browser/view-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica
commandId: this.globalHideCommandId,
label: 'Hide'
}),
this.toolbarRegistry.onDidChange(() => this.updateTitle()),
this.onDidChangeTrackableWidgetsEmitter
]);
if (this.options.progressLocationId) {
Expand Down Expand Up @@ -886,15 +887,22 @@ export class ViewContainerPart extends BaseWidget {
const toolbar = this.toolbarFactory();
toolbar.addClass('theia-view-container-part-title');
this.toHideToolbar.push(toolbar);
this.toHideToolbar.push(this.toolbarRegistry.onDidChange(() => this.updateToolbar()));

Widget.attach(toolbar, this.header);
this.toHideToolbar.push(Disposable.create(() => Widget.detach(toolbar)));

this.toolbar = toolbar;
this.toHideToolbar.push(Disposable.create(() => this.toolbar = undefined));

const items = this.toolbarRegistry.visibleItems(this.wrapped);
toolbar.updateItems(items, this.wrapped);
this.updateToolbar();
}

protected updateToolbar(): void {
if (this.toolbar) {
const items = this.toolbarRegistry.visibleItems(this.wrapped);
this.toolbar.updateItems(items, this.wrapped);
}
}

get toolbarHidden(): boolean {
Expand Down

0 comments on commit 8f8170a

Please sign in to comment.