Construct a new document manager.
Private
_activatePrivate
_autosavePrivate
_autosavePrivate
_contextsPrivate
_dialogsPrivate
_isPrivate
_isPrivate
_lastPrivate
_openerPrivate
_renamePrivate
_setPrivate
_statePrivate
_whenPrivate
_widgetReadonly
registryThe registry used by the manager.
Readonly
servicesThe service manager used by the manager.
Protected
translatorWhether to autosave documents.
Whether to autosave documents.
Determines the time interval for autosave in seconds.
Determines the time interval for autosave in seconds.
Whether to ask confirmation to close a tab or not.
Whether to ask confirmation to close a tab or not.
Get whether the document manager has been disposed.
Defines max acceptable difference, in milliseconds, between last modified timestamps on disk and client
Defines max acceptable difference, in milliseconds, between last modified timestamps on disk and client.
Whether to ask the user to rename untitled file on first manual save.
Whether to ask the user to rename untitled file on first manual save.
Signal triggered when an attribute changes.
Private
_contextsGet the contexts for a given path.
There may be more than one context for a given path if the path is open with multiple model factories (for example, a notebook can be open with a notebook model factory and a text model factory).
Private
_createCreate a context from a path and a model factory.
Optional
kernelPreference: IKernelPreferencePrivate
_createCreates a new document, or loads one from disk, depending on the which
argument.
If which==='create'
, then it creates a new document. If which==='open'
,
then it loads the document from disk.
The two cases differ in how the document context is handled, but the creation of the widget and launching of the kernel are identical.
Optional
kernel: Partial<Kernel.IModel>Optional
options: IOpenOptionsPrivate
_findPrivate
_onHandle an activateRequested signal from the widget manager.
Private
_onProtected
_onPrivate
_widgetGet the widget factory for a given widget name.
Clone a widget.
The source widget.
A new widget or undefined
.
Uses the same widget factory and context as the source, or returns
undefined
if the source widget is not managed by this manager.
Get the document context for a widget.
The widget of interest.
The context associated with the widget, or undefined
if no such
context exists.
Delete a file.
The full path to the file to be deleted.
A promise which resolves when the file is deleted.
If there is a running session associated with the file and no other sessions are using the kernel, the session will be shut down.
See if a widget already exists for the given path and widget name.
The file path to use.
The name of the widget factory to use. 'default' will use the default widget.
The found widget, or undefined
.
This can be used to find an existing widget instead of opening a new widget.
Open a file and return the widget used to view it.
The file path to open.
The name of the widget factory to use. 'default' will use the default widget.
Optional
kernel: Partial<Kernel.IModel>An optional kernel name/id to override the default.
Optional
options: IOpenOptionsThe created widget, or undefined
.
This function will return undefined
if a valid widget factory
cannot be found.
Open a file and return the widget used to view it. Reveals an already existing editor.
The file path to open.
The name of the widget factory to use. 'default' will use the default widget.
Optional
kernel: Partial<Kernel.IModel>An optional kernel name/id to override the default.
Optional
options: IOpenOptionsThe created widget, or undefined
.
This function will return undefined
if a valid widget factory
cannot be found.
Rename a file or directory.
The full path to the original file.
The full path to the new file.
A promise containing the new file contents model. The promise will reject if the newPath already exists. Use [[overwrite]] to overwrite a file.
The document manager.
Notes
The document manager is used to register model and widget creators, and the file browser uses the document manager to create widgets. The document manager maintains a context for each path and model type that is open, and a list of widgets for each context. The document manager is in control of the proper closing and disposal of the widgets and contexts.