diff --git a/src/vs/workbench/browser/parts/editor/titleControl.ts b/src/vs/workbench/browser/parts/editor/titleControl.ts index f33b9f18c438de665f945609c7b505ca6d75adab..ac093418efe25b36efda88926de5be714d5eb465 100644 --- a/src/vs/workbench/browser/parts/editor/titleControl.ts +++ b/src/vs/workbench/browser/parts/editor/titleControl.ts @@ -89,7 +89,37 @@ export abstract class TitleControl { this.initActions(); } + private updateActionEnablement(): void { + if (!this.context) { + return; + } + + const group = this.context; + const groupCount = this.stacks.groups.length; + + // Move group + switch (this.stacks.positionOfGroup(group)) { + case Position.LEFT: + this.moveGroupLeftAction.enabled = false; + this.moveGroupRightAction.enabled = this.stacks.groups.length > 1; + break; + + case Position.CENTER: + this.moveGroupRightAction.enabled = this.stacks.groups.length > 2; + break; + + case Position.RIGHT: + this.moveGroupRightAction.enabled = false; + break; + } + + // Split editor + this.splitEditorAction.enabled = groupCount < 3; + } + private onSchedule(): void { + this.updateActionEnablement(); + if (this.refreshScheduled) { this.doRefresh(); } else { @@ -294,22 +324,6 @@ export abstract class TitleControl { primary.push(this.splitEditorAction); } - // Make sure enablement is good - switch (this.stacks.positionOfGroup(group)) { - case Position.LEFT: - this.moveGroupLeftAction.enabled = false; - this.moveGroupRightAction.enabled = this.stacks.groups.length > 1; - break; - - case Position.CENTER: - this.moveGroupRightAction.enabled = this.stacks.groups.length > 2; - break; - - case Position.RIGHT: - this.moveGroupRightAction.enabled = false; - break; - } - // Return actions const secondary = [ this.moveGroupLeftAction,