Skip to content

Commit

Permalink
title control: add and use updateEditorLabels()
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Apr 17, 2019
1 parent ca2204b commit 0ca6026
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,13 @@ export class NoTabsTitleControl extends TitleControl {
this.redraw();
}

updateEditorLabel(editor?: IEditorInput): void {
if (!editor) {
editor = withNullAsUndefined(this.group.activeEditor);
}
if (editor) {
this.ifEditorIsActive(editor, () => this.redraw());
updateEditorLabel(editor: IEditorInput): void {
this.ifEditorIsActive(editor, () => this.redraw());
}

updateEditorLabels(): void {
if (this.group.activeEditor) {
this.updateEditorLabel(this.group.activeEditor); // we only have the active one to update
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,12 @@ export class TabsTitleControl extends TitleControl {

updateEditorLabel(editor: IEditorInput): void {

// Update all labels to account for changes to tab labels
this.updateEditorLabels();
}

updateEditorLabels(): void {

// A change to a label requires to recompute all labels
this.computeTabLabels();

Expand Down
6 changes: 4 additions & 2 deletions src/vs/workbench/browser/parts/editor/titleControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export abstract class TitleControl extends Themable {

private registerListeners(): void {
this._register(this.extensionService.onDidRegisterExtensions(() => this.updateEditorActionsToolbar()));
this._register(this.labelService.onDidChangeFormatters(() => this.updateEditorLabel()));
this._register(this.labelService.onDidChangeFormatters(() => this.updateEditorLabels()));
}

protected abstract create(parent: HTMLElement): void;
Expand Down Expand Up @@ -342,7 +342,9 @@ export abstract class TitleControl extends Themable {

abstract setActive(isActive: boolean): void;

abstract updateEditorLabel(editor?: IEditorInput): void;
abstract updateEditorLabel(editor: IEditorInput): void;

abstract updateEditorLabels(): void;

abstract updateEditorDirty(editor: IEditorInput): void;

Expand Down

0 comments on commit 0ca6026

Please sign in to comment.