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

don't use setter injection (part of #5504)

上级 0718b12c
......@@ -34,7 +34,6 @@ export class ActivitybarPart extends Part implements IActivityService {
private globalToolBar: ToolBar;
private activityActionItems: { [actionId: string]: IActionItem; };
private viewletIdToActions: { [viewletId: string]: ActivityAction; };
private instantiationService: IInstantiationService;
constructor(
id: string,
......@@ -43,7 +42,8 @@ export class ActivitybarPart extends Part implements IActivityService {
@ITelemetryService private telemetryService: ITelemetryService,
@IEventService private eventService: IEventService,
@IContextMenuService private contextMenuService: IContextMenuService,
@IKeybindingService private keybindingService: IKeybindingService
@IKeybindingService private keybindingService: IKeybindingService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(id);
......@@ -53,10 +53,6 @@ export class ActivitybarPart extends Part implements IActivityService {
this.registerListeners();
}
public setInstantiationService(service: IInstantiationService): void {
this.instantiationService = service;
}
private registerListeners(): void {
// Activate viewlet action on opening of a viewlet
......
......@@ -38,8 +38,6 @@ import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
export abstract class CompositePart<T extends Composite> extends Part {
protected instantiationService: IInstantiationService;
private activeCompositeListeners: { (): void; }[];
private instantiatedCompositeListeners: { (): void; }[];
private mapCompositeToCompositeContainer: { [compositeId: string]: Builder; };
......@@ -64,6 +62,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
private contextMenuService: IContextMenuService,
protected partService: IPartService,
private keybindingService: IKeybindingService,
protected instantiationService: IInstantiationService,
private registry: CompositeRegistry<T>,
private activeCompositeSettingsKey: string,
private nameForTelemetry: string,
......@@ -83,10 +82,6 @@ export abstract class CompositePart<T extends Composite> extends Part {
this.compositeLoaderPromises = {};
}
public setInstantiationService(service: IInstantiationService): void {
this.instantiationService = service;
}
protected openComposite(id: string, focus?: boolean): TPromise<Composite> {
// Check if composite already visible and just focus in that case
if (this.activeComposite && this.activeComposite.getId() === id) {
......
......@@ -64,7 +64,6 @@ interface IEditorState {
* editor for the given input to show the contents. The editor part supports up to 3 side-by-side editors.
*/
export class EditorPart extends Part implements IEditorPart {
private instantiationService: IInstantiationService;
private dimension: Dimension;
private sideBySideControl: SideBySideEditorControl;
private memento: any;
......@@ -90,7 +89,8 @@ export class EditorPart extends Part implements IEditorPart {
@IEventService private eventService: IEventService,
@ITelemetryService private telemetryService: ITelemetryService,
@IStorageService private storageService: IStorageService,
@IPartService private partService: IPartService
@IPartService private partService: IPartService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(id);
......@@ -120,10 +120,6 @@ export class EditorPart extends Part implements IEditorPart {
this.pendingEditorInputCloseTimeout = null;
}
public setInstantiationService(service: IInstantiationService): void {
this.instantiationService = service;
}
private createPositionArray(multiArray: boolean): any[] {
let array: any[] = [];
......
......@@ -26,6 +26,7 @@ import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {IKeyboardEvent} from 'vs/base/browser/keyboardEvent';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
export class PanelPart extends CompositePart<Panel> implements IPanelService {
......@@ -42,7 +43,8 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
@ITelemetryService telemetryService: ITelemetryService,
@IContextMenuService contextMenuService: IContextMenuService,
@IPartService partService: IPartService,
@IKeybindingService keybindingService: IKeybindingService
@IKeybindingService keybindingService: IKeybindingService,
@IInstantiationService instantiationService: IInstantiationService
) {
super(
messageService,
......@@ -52,6 +54,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
contextMenuService,
partService,
keybindingService,
instantiationService,
(<PanelRegistry>Registry.as(PanelExtensions.Panels)),
PanelPart.activePanelSettingsKey,
'panel',
......
......@@ -69,7 +69,6 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
private _onShow: Emitter<void>;
private _onHide: Emitter<void>;
private instantiationService: IInstantiationService;
private quickOpenWidget: QuickOpenWidget;
private pickOpenWidget: QuickOpenWidget;
private layoutDimensions: Dimension;
......@@ -94,7 +93,8 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
@IMessageService private messageService: IMessageService,
@ITelemetryService private telemetryService: ITelemetryService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IKeybindingService keybindingService: IKeybindingService
@IKeybindingService keybindingService: IKeybindingService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(ID);
......@@ -117,10 +117,6 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
return this._onHide.event;
}
public setInstantiationService(service: IInstantiationService): void {
this.instantiationService = service;
}
public getEditorHistoryModel(): EditorHistoryModel {
return this.editorHistoryModel;
}
......
......@@ -23,6 +23,7 @@ import {IMessageService} from 'vs/platform/message/common/message';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
export class SidebarPart extends CompositePart<Viewlet> implements IViewletService {
......@@ -40,7 +41,8 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
@ITelemetryService telemetryService: ITelemetryService,
@IContextMenuService contextMenuService: IContextMenuService,
@IPartService partService: IPartService,
@IKeybindingService keybindingService: IKeybindingService
@IKeybindingService keybindingService: IKeybindingService,
@IInstantiationService instantiationService: IInstantiationService
) {
super(
messageService,
......@@ -50,6 +52,7 @@ export class SidebarPart extends CompositePart<Viewlet> implements IViewletServi
contextMenuService,
partService,
keybindingService,
instantiationService,
(<ViewletRegistry>Registry.as(ViewletExtensions.Viewlets)),
SidebarPart.activeViewletSettingsKey,
'sideBar',
......
......@@ -36,20 +36,15 @@ export class StatusbarPart extends Part implements IStatusbarService {
private toDispose: IDisposable[];
private statusItemsContainer: Builder;
private instantiationService: IInstantiationService;
constructor(
id: string
id: string,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(id);
this.toDispose = [];
}
public setInstantiationService(service: IInstantiationService): void {
this.instantiationService = service;
}
public addEntry(entry: IStatusbarEntry, alignment: StatusbarAlignment, priority: number = 0): IDisposable {
// Render entry in status bar
......
......@@ -340,7 +340,7 @@ export class Workbench implements IPartService {
serviceCollection.set(IQuickOpenService, this.quickOpen);
// Status bar
this.statusbarPart = new StatusbarPart(Identifiers.STATUSBAR_PART);
this.statusbarPart = this.instantiationService.createInstance(StatusbarPart, Identifiers.STATUSBAR_PART);
this.toDispose.push(this.statusbarPart);
this.toShutdown.push(this.statusbarPart);
serviceCollection.set(IStatusbarService, this.statusbarPart);
......@@ -361,12 +361,6 @@ export class Workbench implements IPartService {
if (this.messageService instanceof WorkbenchMessageService) {
(<WorkbenchMessageService>this.messageService).setWorkbenchServices(this.quickOpen, this.statusbarPart);
}
this.quickOpen.setInstantiationService(this.instantiationService);
this.statusbarPart.setInstantiationService(this.instantiationService);
this.activitybarPart.setInstantiationService(this.instantiationService);
this.sidebarPart.setInstantiationService(this.instantiationService);
this.panelPart.setInstantiationService(this.instantiationService);
this.editorPart.setInstantiationService(this.instantiationService);
(<UntitledEditorService>this.untitledEditorService).setInstantiationService(this.instantiationService);
this.editorService.setInstantiationService(this.instantiationService);
......
......@@ -5,7 +5,7 @@
'use strict';
import {Registry, BaseRegistry} from 'vs/platform/platform';
import {IInstantiationService, IConstructorSignature0} from 'vs/platform/instantiation/common/instantiation';
import {IConstructorSignature0} from 'vs/platform/instantiation/common/instantiation';
// --- Workbench Contribution Registry
......@@ -38,8 +38,6 @@ export interface IWorkbenchContributionsRegistry {
* Returns all workbench contributions that are known to the platform.
*/
getWorkbenchContributions(): IWorkbenchContribution[];
setInstantiationService(service: IInstantiationService): void;
}
class WorkbenchContributionsRegistry extends BaseRegistry<IWorkbenchContribution> implements IWorkbenchContributionsRegistry {
......
......@@ -218,7 +218,8 @@ suite('Workbench QuickOpen', () => {
null,
null,
contextService,
new MockKeybindingService()
new MockKeybindingService(),
null
);
controller.create();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册