Browse Source

Revert part of 7a5bd00ce3df55b85c747d02a00e87c49e3288b4 dealing with factoryNames.

factoryName is explicitly a property of our specific implementation we are using (i.e., Private.IContext), so it is okay to use.
Jason Grout 7 years ago
parent
commit
11ffaafa47
1 changed files with 5 additions and 13 deletions
  1. 5 13
      packages/docmanager/src/manager.ts

+ 5 - 13
packages/docmanager/src/manager.ts

@@ -388,9 +388,7 @@ class DocumentManager implements IDisposable {
    */
    */
   private _findContext(path: string, factoryName: string): Private.IContext | undefined {
   private _findContext(path: string, factoryName: string): Private.IContext | undefined {
     return find(this._contexts, context => {
     return find(this._contexts, context => {
-      // TODO: should the model factoryName just be exposed on a context object?
-      let contextFactoryName = Private.factoryNameProperty.get(context);
-      return contextFactoryName === factoryName && context.path === path;
+      return context.factoryName === factoryName && context.path === path;
     });
     });
   }
   }
 
 
@@ -438,7 +436,6 @@ class DocumentManager implements IDisposable {
         handler.start();
         handler.start();
       }
       }
     });
     });
-    Private.factoryNameProperty.set(context, factory.name);
     context.disposed.connect(this._onContextDisposed, this);
     context.disposed.connect(this._onContextDisposed, this);
     this._contexts.push(context);
     this._contexts.push(context);
     return context;
     return context;
@@ -592,17 +589,12 @@ namespace Private {
     create: () => undefined
     create: () => undefined
   });
   });
 
 
-  /**
-   * An attached property for the factory name used for a context.
-   */
-  export
-  const factoryNameProperty = new AttachedProperty<DocumentRegistry.Context, string | undefined>({
-    name: 'factoryName',
-    create: () => undefined
-  });
-
   /**
   /**
    * A type alias for a standard context.
    * A type alias for a standard context.
+   *
+   * #### Notes
+   * We define this as an interface of a specific implementation so that we can
+   * use the implementation-specific functions.
    */
    */
   export
   export
   interface IContext extends Context<DocumentRegistry.IModel> { /* no op */ }
   interface IContext extends Context<DocumentRegistry.IModel> { /* no op */ }