mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-08 17:24:01 -05:00
This reverts commit d15a3fcc98.
This commit is contained in:
@@ -23,9 +23,7 @@ import { coalesce } from 'vs/base/common/arrays';
|
||||
|
||||
export const ActiveEditorContext = new RawContextKey<string | null>('activeEditor', null);
|
||||
export const EditorsVisibleContext = new RawContextKey<boolean>('editorIsOpen', false);
|
||||
export const EditorPinnedContext = new RawContextKey<boolean>('editorPinned', false);
|
||||
export const EditorGroupActiveEditorDirtyContext = new RawContextKey<boolean>('groupActiveEditorDirty', false);
|
||||
export const EditorGroupEditorsCountContext = new RawContextKey<number>('groupEditorsCount', 0);
|
||||
export const NoEditorsVisibleContext: ContextKeyExpr = EditorsVisibleContext.toNegated();
|
||||
export const TextCompareEditorVisibleContext = new RawContextKey<boolean>('textCompareEditorVisible', false);
|
||||
export const TextCompareEditorActiveContext = new RawContextKey<boolean>('textCompareEditorActive', false);
|
||||
@@ -33,7 +31,6 @@ export const ActiveEditorGroupEmptyContext = new RawContextKey<boolean>('activeE
|
||||
export const MultipleEditorGroupsContext = new RawContextKey<boolean>('multipleEditorGroups', false);
|
||||
export const SingleEditorGroupsContext = MultipleEditorGroupsContext.toNegated();
|
||||
export const InEditorZenModeContext = new RawContextKey<boolean>('inZenMode', false);
|
||||
export const IsCenteredLayoutContext = new RawContextKey<boolean>('isCenteredLayout', false);
|
||||
export const SplitEditorsVertically = new RawContextKey<boolean>('splitEditorsVertically', false);
|
||||
|
||||
/**
|
||||
@@ -178,7 +175,7 @@ export interface IEditorInputFactoryRegistry {
|
||||
*
|
||||
* @param editorInputId the identifier of the editor input
|
||||
*/
|
||||
getEditorInputFactory(editorInputId: string): IEditorInputFactory | undefined;
|
||||
getEditorInputFactory(editorInputId: string): IEditorInputFactory;
|
||||
|
||||
/**
|
||||
* Starts the registry by providing the required services.
|
||||
@@ -1061,22 +1058,23 @@ export interface IEditorMemento<T> {
|
||||
class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
|
||||
private instantiationService: IInstantiationService;
|
||||
private fileInputFactory: IFileInputFactory;
|
||||
private readonly editorInputFactoryConstructors: Map<string, IConstructorSignature0<IEditorInputFactory>> = new Map();
|
||||
private readonly editorInputFactoryInstances: Map<string, IEditorInputFactory> = new Map();
|
||||
private editorInputFactoryConstructors: { [editorInputId: string]: IConstructorSignature0<IEditorInputFactory> } = Object.create(null);
|
||||
private readonly editorInputFactoryInstances: { [editorInputId: string]: IEditorInputFactory } = Object.create(null);
|
||||
|
||||
start(accessor: ServicesAccessor): void {
|
||||
this.instantiationService = accessor.get(IInstantiationService);
|
||||
|
||||
this.editorInputFactoryConstructors.forEach((ctor, key) => {
|
||||
this.createEditorInputFactory(key, ctor);
|
||||
});
|
||||
for (let key in this.editorInputFactoryConstructors) {
|
||||
const element = this.editorInputFactoryConstructors[key];
|
||||
this.createEditorInputFactory(key, element);
|
||||
}
|
||||
|
||||
this.editorInputFactoryConstructors.clear();
|
||||
this.editorInputFactoryConstructors = Object.create(null);
|
||||
}
|
||||
|
||||
private createEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>): void {
|
||||
const instance = this.instantiationService.createInstance(ctor);
|
||||
this.editorInputFactoryInstances.set(editorInputId, instance);
|
||||
this.editorInputFactoryInstances[editorInputId] = instance;
|
||||
}
|
||||
|
||||
registerFileInputFactory(factory: IFileInputFactory): void {
|
||||
@@ -1089,14 +1087,14 @@ class EditorInputFactoryRegistry implements IEditorInputFactoryRegistry {
|
||||
|
||||
registerEditorInputFactory(editorInputId: string, ctor: IConstructorSignature0<IEditorInputFactory>): void {
|
||||
if (!this.instantiationService) {
|
||||
this.editorInputFactoryConstructors.set(editorInputId, ctor);
|
||||
this.editorInputFactoryConstructors[editorInputId] = ctor;
|
||||
} else {
|
||||
this.createEditorInputFactory(editorInputId, ctor);
|
||||
}
|
||||
}
|
||||
|
||||
getEditorInputFactory(editorInputId: string): IEditorInputFactory | undefined {
|
||||
return this.editorInputFactoryInstances.get(editorInputId);
|
||||
getEditorInputFactory(editorInputId: string): IEditorInputFactory {
|
||||
return this.editorInputFactoryInstances[editorInputId];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user