提交 1e2e8fb3 编写于 作者: B Benjamin Pasero

grid - drop editor group label

上级 01bf9616
......@@ -139,7 +139,7 @@ export abstract class BaseEditorPicker extends QuickOpenHandler {
let lastGroup: IEditorGroup;
entries.forEach(e => {
if (!lastGroup || lastGroup !== e.group) {
e.setGroupLabel(nls.localize('groupLabel', "Group: {0}", e.group.label));
e.setGroupLabel(nls.localize('groupLabel', "Group: {0}", e.group.id));
e.setShowBorder(!!lastGroup);
lastGroup = e.group;
}
......
......@@ -126,11 +126,9 @@ export class NextEditorGroupView extends Themable implements INextEditorGroupVie
} else if (isSerializedEditorGroup(from)) {
this._group = this._register(instantiationService.createInstance(EditorGroup, from));
} else {
this._group = this._register(instantiationService.createInstance(EditorGroup, ''));
this._group = this._register(instantiationService.createInstance(EditorGroup, void 0));
}
this._group.label = `Group <${this._group.id}>`; // TODO@grid find a way to have a proper label
this.disposedEditorsWorker = this._register(new RunOnceWorker(editors => this.handleDisposedEditors(editors), 0));
this.create();
......
......@@ -786,9 +786,7 @@ export interface IEditorStacksModel {
}
export interface IEditorGroup {
id: GroupIdentifier;
label: string;
count: number;
activeEditor: IEditorInput;
previewEditor: IEditorInput;
......
......@@ -39,7 +39,6 @@ export interface ISerializedEditorInput {
export interface ISerializedEditorGroup {
id: number;
label: string;
editors: ISerializedEditorInput[];
mru: number[];
preview: number;
......@@ -87,7 +86,6 @@ export class EditorGroup extends Disposable implements IEditorGroup {
//#endregion
private _id: GroupIdentifier;
private _label: string;
private editors: EditorInput[] = [];
private mru: EditorInput[] = [];
......@@ -99,7 +97,7 @@ export class EditorGroup extends Disposable implements IEditorGroup {
private editorOpenPositioning: 'left' | 'right' | 'first' | 'last';
constructor(
labelOrSerializedGroup: string | ISerializedEditorGroup,
labelOrSerializedGroup: ISerializedEditorGroup,
@IInstantiationService private instantiationService: IInstantiationService,
@IConfigurationService private configurationService: IConfigurationService
) {
......@@ -109,7 +107,6 @@ export class EditorGroup extends Disposable implements IEditorGroup {
this.deserialize(labelOrSerializedGroup);
} else {
this._id = EditorGroup.IDS++;
this._label = labelOrSerializedGroup;
}
this.onConfigurationUpdated();
......@@ -128,14 +125,6 @@ export class EditorGroup extends Disposable implements IEditorGroup {
return this._id;
}
get label(): string {
return this._label;
}
set label(label: string) {
this._label = label;
}
get count(): number {
return this.editors.length;
}
......@@ -604,7 +593,7 @@ export class EditorGroup extends Disposable implements IEditorGroup {
}
clone(): EditorGroup {
const group = this.instantiationService.createInstance(EditorGroup, '');
const group = this.instantiationService.createInstance(EditorGroup, void 0);
group.editors = this.editors.slice(0);
group.mru = this.mru.slice(0);
group.mapResourceToEditorCount = this.mapResourceToEditorCount.clone();
......@@ -643,7 +632,6 @@ export class EditorGroup extends Disposable implements IEditorGroup {
return {
id: this.id,
label: this.label,
editors: serializedEditors,
mru: serializableMru,
preview: serializablePreviewIndex,
......@@ -661,7 +649,6 @@ export class EditorGroup extends Disposable implements IEditorGroup {
this._id = EditorGroup.IDS++; // backwards compatibility
}
this._label = data.label;
this.editors = data.editors.map(e => {
const factory = registry.getEditorInputFactory(e.id);
if (factory) {
......@@ -858,10 +845,7 @@ export class EditorStacksModel implements IEditorStacksModel {
renameGroup(group: EditorGroup, label: string): void {
this.ensureLoaded();
if (group.label !== label) {
group.label = label;
this.fireEvent(this._onGroupRenamed, group, false);
}
this.fireEvent(this._onGroupRenamed, group, false);
}
closeGroup(group: EditorGroup): void {
......@@ -1166,10 +1150,6 @@ export class EditorStacksModel implements IEditorStacksModel {
return 6; // Invalid preview editor
}
if (serialized.groups.some(g => !g.label)) {
return 7; // Group without label
}
return 0;
}
......@@ -1259,14 +1239,6 @@ export class EditorStacksModel implements IEditorStacksModel {
}
this.groups.forEach(g => {
let label = `Group: ${g.label}`;
if (this._activeGroup === g) {
label = `${label} [active]`;
}
lines.push(label);
g.getEditors().forEach(e => {
let label = `\t${e.getName()}`;
......
......@@ -506,7 +506,7 @@ class EditorGroupRenderer implements IRenderer<IEditorGroup, IEditorGroupTemplat
renderElement(editorGroup: IEditorGroup, index: number, templateData: IEditorGroupTemplateData): void {
templateData.editorGroup = editorGroup;
templateData.name.textContent = editorGroup.label;
templateData.name.textContent = `Group <${editorGroup.id}>`;
templateData.actionBar.context = { groupId: editorGroup.id };
}
......
......@@ -293,19 +293,6 @@ suite('Editor Stacks Model', () => {
assert.equal(events.moved.length, 2);
});
test('Groups - Move Groups', function () {
const model = create();
const events = modelListener(model);
model.openGroup('first');
const group2 = model.openGroup('second');
model.renameGroup(group2, 'renamed');
assert.equal(group2.label, 'renamed');
assert.equal(group2, events.renamed[0]);
});
test('Groups - Position of Group', function () {
const model = create();
......@@ -1222,7 +1209,6 @@ suite('Editor Stacks Model', () => {
assert.equal(group.count, 1);
assert.equal(group.activeEditor.matches(input1), true);
assert.equal(group.previewEditor.matches(input1), true);
assert.equal(group.label, 'group');
assert.equal(group.isActive(input1), true);
lifecycle.fireShutdown();
......@@ -1237,7 +1223,6 @@ suite('Editor Stacks Model', () => {
assert.equal(group.count, 1);
assert.equal(group.activeEditor.matches(input1), true);
assert.equal(group.previewEditor.matches(input1), true);
assert.equal(group.label, 'group');
assert.equal(group.isActive(input1), true);
});
......@@ -1286,8 +1271,6 @@ suite('Editor Stacks Model', () => {
assert.equal(group2.activeEditor.matches(g2_input1), true);
assert.equal(group1.previewEditor.matches(g1_input2), true);
assert.equal(group2.previewEditor.matches(g2_input2), true);
assert.equal(group1.label, 'group1');
assert.equal(group2.label, 'group2');
assert.equal(group1.getEditors(true)[0].matches(g1_input2), true);
assert.equal(group1.getEditors(true)[1].matches(g1_input1), true);
......@@ -1312,8 +1295,6 @@ suite('Editor Stacks Model', () => {
assert.equal(group2.activeEditor.matches(g2_input1), true);
assert.equal(group1.previewEditor.matches(g1_input2), true);
assert.equal(group2.previewEditor.matches(g2_input2), true);
assert.equal(group1.label, 'group1');
assert.equal(group2.label, 'group2');
assert.equal(group1.getEditors(true)[0].matches(g1_input2), true);
assert.equal(group1.getEditors(true)[1].matches(g1_input1), true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册