Editor integration
- How is the editor launched? Through FileEditor (see diagram)
- How does the editor obtain the content to be editted? Using the
files service, _EditorFilePersistance provides an api, the filePath given should be used to open/save the file, FileResolver may be used to determine other paths, like the checkpoint path.
- How does the editor drive autosave? Whenever there is a modification to the file, the code editor uses a 3 second delay so saves are not done "every keystroke".
- Code pointers? (eventually we'll have a clean packaging story; how can folks get started now?) The file resolver has a test case located here https://www.projectzero.org/svn/zero/trunk/DEVTOOLS/zero.ide.ui/public/zero/ide/util/test.html which demonstrated how to find paths of various files given the initial filePath.
Editor classes
The following class diagram shows the relationship between the editors.
- Editor Relationships:
Editor interface
Editor fields
- filePath - filePath is initialized with full URL to file being edited.
- meta - meta first is initialized with an empty object, data put in this object will then be persisted for the session so next time the editor for the same file is opened the data you had put in meta will still be there.
The basic editor inteface contains these methods:
- startup() builds and renders the widget contents
- setFilePath(newPath) used when a file is renamed, changes the filename for auto-saving and changes the title of the editor
- refresh() redraws the UI on a resize or other event that needs the contents redrawn
- focus() called when we should focus, ie the tab is selected containing the editor
- blur() called when we should blur, ie the tab is changed
- destroy() called when the editor should go away
Editor behaviors
- Only one editor is open at a time, editors should save state between edits (like undo history and cursor position) in the meta object.
- Editors are handed the filePath to open the file and should handle opening it, the _EditorFilePersistance provides open function
- Editors should not have open or save buttons/dialogs, file new and navigation is handled by the framework
- Editors should auto-save content, the _EditorFilePersitance provides a save function. (that checks for mod conflict)
- Editors should have a checkpoint and restore function, use _EditorFilePersistance for open/save and FileResolver to determine the checkpoint file URL.