提交 51c98a8e 编写于 作者: B Benjamin Pasero

💄

上级 eb9ed47e
......@@ -35,7 +35,7 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
import { IMessageService, IMessageWithAction, Severity } from 'vs/platform/message/common/message';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { EditorStacksModel, EditorGroup, EditorIdentifier, GroupEvent } from 'vs/workbench/common/editor/editorStacksModel';
import { EditorStacksModel, EditorGroup, EditorIdentifier, EditorCloseEvent } from 'vs/workbench/common/editor/editorStacksModel';
import Event, { Emitter } from 'vs/base/common/event';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IThemeService } from 'vs/platform/theme/common/themeService';
......@@ -234,7 +234,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
this.telemetryService.publicLog('editorOpened', identifier.editor.getTelemetryDescriptor());
}
private onEditorClosed(event: GroupEvent): void {
private onEditorClosed(event: EditorCloseEvent): void {
this.telemetryService.publicLog('editorClosed', event.editor.getTelemetryDescriptor());
}
......
......@@ -845,8 +845,8 @@ export interface IEditorStacksModel {
onModelChanged: Event<IStacksModelChangeEvent>;
onWillCloseEditor: Event<IEditorIdentifier>;
onEditorClosed: Event<IGroupEvent>;
onWillCloseEditor: Event<IEditorCloseEvent>;
onEditorClosed: Event<IEditorCloseEvent>;
groups: IEditorGroup[];
activeGroup: IEditorGroup;
......@@ -895,8 +895,7 @@ export interface IEditorContext extends IEditorIdentifier {
event?: any;
}
export interface IGroupEvent {
editor: IEditorInput;
export interface IEditorCloseEvent extends IEditorIdentifier {
pinned: boolean;
index: number;
}
......
......@@ -6,7 +6,7 @@
'use strict';
import Event, { Emitter, once } from 'vs/base/common/event';
import { IEditorRegistry, Extensions, EditorInput, toResource, IEditorStacksModel, IEditorGroup, IEditorIdentifier, IGroupEvent, GroupIdentifier, IStacksModelChangeEvent, IWorkbenchEditorConfiguration, EditorOpenPositioning, SideBySideEditorInput } from 'vs/workbench/common/editor';
import { IEditorRegistry, Extensions, EditorInput, toResource, IEditorStacksModel, IEditorGroup, IEditorIdentifier, IEditorCloseEvent, GroupIdentifier, IStacksModelChangeEvent, IWorkbenchEditorConfiguration, EditorOpenPositioning, SideBySideEditorInput } from 'vs/workbench/common/editor';
import URI from 'vs/base/common/uri';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
......@@ -17,7 +17,7 @@ import { Registry } from 'vs/platform/platform';
import { Position, Direction } from 'vs/platform/editor/common/editor';
import { ResourceMap } from 'vs/base/common/map';
export interface GroupEvent extends IGroupEvent {
export interface EditorCloseEvent extends IEditorCloseEvent {
editor: EditorInput;
}
......@@ -63,7 +63,7 @@ export class EditorGroup implements IEditorGroup {
private _onEditorActivated: Emitter<EditorInput>;
private _onEditorOpened: Emitter<EditorInput>;
private _onEditorClosed: Emitter<GroupEvent>;
private _onEditorClosed: Emitter<EditorCloseEvent>;
private _onEditorDisposed: Emitter<EditorInput>;
private _onEditorDirty: Emitter<EditorInput>;
private _onEditorLabelChange: Emitter<EditorInput>;
......@@ -88,7 +88,7 @@ export class EditorGroup implements IEditorGroup {
this._onEditorActivated = new Emitter<EditorInput>();
this._onEditorOpened = new Emitter<EditorInput>();
this._onEditorClosed = new Emitter<GroupEvent>();
this._onEditorClosed = new Emitter<EditorCloseEvent>();
this._onEditorDisposed = new Emitter<EditorInput>();
this._onEditorDirty = new Emitter<EditorInput>();
this._onEditorLabelChange = new Emitter<EditorInput>();
......@@ -143,7 +143,7 @@ export class EditorGroup implements IEditorGroup {
return this._onEditorOpened.event;
}
public get onEditorClosed(): Event<GroupEvent> {
public get onEditorClosed(): Event<EditorCloseEvent> {
return this._onEditorClosed.event;
}
......@@ -376,7 +376,7 @@ export class EditorGroup implements IEditorGroup {
this.splice(index, true);
// Event
this.fireEvent(this._onEditorClosed, { editor, pinned, index }, true);
this.fireEvent(this._onEditorClosed, { editor, pinned, index, group: this }, true);
}
public closeEditors(except: EditorInput, direction?: Direction): void {
......@@ -507,7 +507,7 @@ export class EditorGroup implements IEditorGroup {
return !this.matches(this.preview, editor);
}
private fireEvent(emitter: Emitter<EditorInput | GroupEvent>, arg2: EditorInput | GroupEvent, isStructuralChange: boolean): void {
private fireEvent(emitter: Emitter<EditorInput | EditorCloseEvent>, arg2: EditorInput | EditorCloseEvent, isStructuralChange: boolean): void {
emitter.fire(arg2);
if (isStructuralChange) {
......@@ -699,12 +699,15 @@ export class EditorStacksModel implements IEditorStacksModel {
private _onGroupActivated: Emitter<EditorGroup>;
private _onGroupDeactivated: Emitter<EditorGroup>;
private _onGroupRenamed: Emitter<EditorGroup>;
private _onEditorDisposed: Emitter<EditorIdentifier>;
private _onEditorDirty: Emitter<EditorIdentifier>;
private _onEditorLabelChange: Emitter<EditorIdentifier>;
private _onEditorOpened: Emitter<EditorIdentifier>;
private _onWillCloseEditor: Emitter<EditorIdentifier>;
private _onEditorClosed: Emitter<GroupEvent>;
private _onWillCloseEditor: Emitter<EditorCloseEvent>;
private _onEditorClosed: Emitter<EditorCloseEvent>;
private _onModelChanged: Emitter<IStacksModelChangeEvent>;
constructor(
......@@ -729,8 +732,8 @@ export class EditorStacksModel implements IEditorStacksModel {
this._onEditorDirty = new Emitter<EditorIdentifier>();
this._onEditorLabelChange = new Emitter<EditorIdentifier>();
this._onEditorOpened = new Emitter<EditorIdentifier>();
this._onWillCloseEditor = new Emitter<EditorIdentifier>();
this._onEditorClosed = new Emitter<GroupEvent>();
this._onWillCloseEditor = new Emitter<EditorCloseEvent>();
this._onEditorClosed = new Emitter<EditorCloseEvent>();
this.toDispose.push(this._onGroupOpened, this._onGroupClosed, this._onGroupActivated, this._onGroupDeactivated, this._onGroupMoved, this._onGroupRenamed, this._onModelChanged, this._onEditorDisposed, this._onEditorDirty, this._onEditorLabelChange, this._onEditorClosed, this._onWillCloseEditor);
......@@ -785,11 +788,11 @@ export class EditorStacksModel implements IEditorStacksModel {
return this._onEditorOpened.event;
}
public get onWillCloseEditor(): Event<EditorIdentifier> {
public get onWillCloseEditor(): Event<EditorCloseEvent> {
return this._onWillCloseEditor.event;
}
public get onEditorClosed(): Event<GroupEvent> {
public get onEditorClosed(): Event<EditorCloseEvent> {
return this._onEditorClosed.event;
}
......@@ -1161,7 +1164,7 @@ export class EditorStacksModel implements IEditorStacksModel {
unbind.push(group.onEditorStateChanged(editor => this._onModelChanged.fire({ group, editor })));
unbind.push(group.onEditorOpened(editor => this._onEditorOpened.fire({ editor, group })));
unbind.push(group.onEditorClosed(event => {
this._onWillCloseEditor.fire({ editor: event.editor, group });
this._onWillCloseEditor.fire(event);
this.handleOnEditorClosed(event);
this._onEditorClosed.fire(event);
}));
......@@ -1177,7 +1180,7 @@ export class EditorStacksModel implements IEditorStacksModel {
return group;
}
private handleOnEditorClosed(event: GroupEvent): void {
private handleOnEditorClosed(event: EditorCloseEvent): void {
const editor = event.editor;
const editorsToClose = [editor];
......
......@@ -14,7 +14,7 @@ import { Action } from 'vs/base/common/actions';
import { VIEWLET_ID, TEXT_FILE_EDITOR_ID } from 'vs/workbench/parts/files/common/files';
import { ITextFileEditorModel, ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
import { EditorOptions, TextEditorOptions, IEditorIdentifier } from 'vs/workbench/common/editor';
import { EditorOptions, TextEditorOptions, IEditorCloseEvent } from 'vs/workbench/common/editor';
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
import { ExplorerViewlet } from 'vs/workbench/parts/files/browser/explorerViewlet';
......@@ -70,7 +70,7 @@ export class TextFileEditor extends BaseTextEditor {
}
}
private onWillCloseEditor(e: IEditorIdentifier): void {
private onWillCloseEditor(e: IEditorCloseEvent): void {
if (e.editor === this.input && this.position === this.editorGroupService.getStacksModel().positionOfGroup(e.group)) {
this.doSaveTextEditorViewState(this.input);
}
......
......@@ -11,7 +11,7 @@ import objects = require('vs/base/common/objects');
import URI from 'vs/base/common/uri';
import { IEditor } from 'vs/editor/common/editorCommon';
import { IEditor as IBaseEditor, IEditorInput, ITextEditorOptions, IResourceInput } from 'vs/platform/editor/common/editor';
import { EditorInput, IGroupEvent, IEditorRegistry, Extensions, toResource, IEditorGroup } from 'vs/workbench/common/editor';
import { EditorInput, IEditorCloseEvent, IEditorRegistry, Extensions, toResource, IEditorGroup } from 'vs/workbench/common/editor';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { FileChangesEvent, IFileService, FileChangeType } from 'vs/platform/files/common/files';
......@@ -214,7 +214,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic
}
}
private onEditorClosed(event: IGroupEvent): void {
private onEditorClosed(event: IEditorCloseEvent): void {
// Track closing of pinned editor to support to reopen closed editors
if (event.pinned) {
......
......@@ -6,8 +6,8 @@
'use strict';
import * as assert from 'assert';
import { EditorStacksModel, EditorGroup, GroupEvent } from 'vs/workbench/common/editor/editorStacksModel';
import { EditorInput, IFileEditorInput, IEditorIdentifier, IEditorGroup, IStacksModelChangeEvent, IEditorRegistry, Extensions as EditorExtensions, IEditorInputFactory, IGroupEvent } from 'vs/workbench/common/editor';
import { EditorStacksModel, EditorGroup, EditorCloseEvent } from 'vs/workbench/common/editor/editorStacksModel';
import { EditorInput, IFileEditorInput, IEditorIdentifier, IEditorGroup, IStacksModelChangeEvent, IEditorRegistry, Extensions as EditorExtensions, IEditorInputFactory, IEditorCloseEvent } from 'vs/workbench/common/editor';
import URI from 'vs/base/common/uri';
import { TestStorageService, TestLifecycleService, TestContextService } from 'vs/workbench/test/workbenchTestServices';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
......@@ -47,14 +47,14 @@ interface ModelEvents {
renamed: IEditorGroup[];
disposed: IEditorIdentifier[];
changed: IStacksModelChangeEvent[];
editorClosed: IGroupEvent[];
editorWillClose: IEditorIdentifier[];
editorClosed: IEditorCloseEvent[];
editorWillClose: IEditorCloseEvent[];
}
interface GroupEvents {
opened: EditorInput[];
activated: EditorInput[];
closed: GroupEvent[];
closed: EditorCloseEvent[];
pinned: EditorInput[];
unpinned: EditorInput[];
moved: EditorInput[];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册