提交 aa566631 编写于 作者: B Benjamin Pasero

Talking about Group Left is confusing if there is only one group (fixes #7044)

上级 346834b1
......@@ -134,15 +134,17 @@ export abstract class BaseEditorPicker extends QuickOpenHandler {
});
}
// Grouping
let lastGroup: IEditorGroup;
entries.forEach(e => {
if (!lastGroup || lastGroup !== e.group) {
e.setGroupLabel(nls.localize('groupLabel', "Group: {0}", e.group.label));
e.setShowBorder(!!lastGroup);
lastGroup = e.group;
}
});
// Grouping (for more than one group)
if (stacks.groups.length > 1) {
let lastGroup: IEditorGroup;
entries.forEach(e => {
if (!lastGroup || lastGroup !== e.group) {
e.setGroupLabel(nls.localize('groupLabel', "Group: {0}", e.group.label));
e.setShowBorder(!!lastGroup);
lastGroup = e.group;
}
});
}
return TPromise.as(new QuickOpenModel(entries));
}
......
......@@ -35,7 +35,7 @@ import {QuickOpenAction} from 'vs/workbench/browser/quickopen';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {ShowEditorsInLeftGroupAction, ShowEditorsInCenterGroupAction, ShowEditorsInRightGroupAction, CloseEditorsInGroupAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, CloseEditorAction} from 'vs/workbench/browser/parts/editor/editorActions';
import {ShowEditorsInLeftGroupAction, ShowAllEditorsAction, ShowEditorsInCenterGroupAction, ShowEditorsInRightGroupAction, CloseEditorsInGroupAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, CloseEditorAction} from 'vs/workbench/browser/parts/editor/editorActions';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
export enum Rochade {
......@@ -129,6 +129,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
private moveGroupRightActions: MoveGroupRightAction[];
private closeEditorsInGroupActions: CloseEditorsInGroupAction[];
private splitEditorAction: SplitEditorAction;
private showAllEditorsAction: ShowAllEditorsAction;
private leftSash: Sash;
private startLeftContainerWidth: number;
......@@ -194,6 +195,9 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
// Close
this.closeEditorActions = POSITIONS.map((position) => this.instantiationService.createInstance(CloseEditorAction, CloseEditorAction.ID, nls.localize('close', "Close")));
// Show All Editors
this.showAllEditorsAction = this.instantiationService.createInstance(ShowAllEditorsAction, ShowAllEditorsAction.ID, nls.localize('showEditors', "Show Editors"));
// Show Editors of Group
this.showEditorsOfGroup = POSITIONS.map((position) => {
switch (position) {
......@@ -1198,13 +1202,13 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
// Overflow
const isOverflowing = state.editorCount > 1;
const showEditorAction = this.showEditorsOfGroup[state.position];
const actions = [this.showEditorsOfGroup[state.position], this.showAllEditorsAction];
if (!isOverflowing) {
showEditorAction.class = 'show-group-editors-overflowing-action-hidden';
showEditorAction.enabled = false;
actions.forEach(a => a.class = 'show-group-editors-overflowing-action-hidden');
actions.forEach(a => a.enabled = false);
} else {
showEditorAction.class = 'show-group-editors-action';
showEditorAction.enabled = true;
actions.forEach(a => a.class = 'show-group-editors-action');
actions.forEach(a => a.enabled = true);
}
}
}
......@@ -1293,9 +1297,16 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
actionPosition = Position.RIGHT; // with 2 groups, CENTER === RIGHT
}
this.showEditorsOfGroup[actionPosition].class = 'show-group-editors-action';
this.showEditorsOfGroup[actionPosition].enabled = true;
primaryActions.unshift(this.showEditorsOfGroup[actionPosition]);
let overflowAction: Action;
if (groupCount === 1) {
overflowAction = this.showAllEditorsAction;
} else {
overflowAction = this.showEditorsOfGroup[actionPosition];
}
overflowAction.class = 'show-group-editors-action';
overflowAction.enabled = true;
primaryActions.unshift(overflowAction);
}
// Secondary Actions
......@@ -1730,7 +1741,7 @@ export class SideBySideEditorControl implements ISideBySideEditorControl, IVerti
});
// Actions
[this.splitEditorAction, ...this.closeEditorActions, ...this.moveGroupLeftActions, ...this.moveGroupRightActions, ...this.closeEditorsInGroupActions].forEach((action) => {
[this.splitEditorAction, this.showAllEditorsAction, ...this.showEditorsOfGroup, ...this.closeEditorActions, ...this.moveGroupLeftActions, ...this.moveGroupRightActions, ...this.closeEditorsInGroupActions].forEach((action) => {
action.dispose();
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册