-
Notifications
You must be signed in to change notification settings - Fork 1k
The Document View Model
MonoDevelop 8.1 implements a new architecture for displaying views in the shell. The main changes of this architecture compared to the old one are:
- Introduction of a Model/View/Controller pattern. By having the data in a Model it will be possible to easily support displaying and editing a file in more than one view, even in different documents.
- Extensibility at document and controller level, so that add-ins can plug into file operations and provide custom commands.
- Proper support of split and tabbed views. Extensions can provide visual designers and previews, and the shell decides the best way to present them.
A model is the data being shown in a view. DocumentModel
is the base class for models that can be edited in a view. FileModel
is a base class for file-based models. TextFileModel
is the base class for models stored in text files. TextBufferFileModel
is a model that stores data in a TextBuffer. DocumentModelRegistry
is a service that can be used to share and get shared models.
The new DocumentController and related classes replace ViewContent and BaseView content. A document controller is a class that implements the logic for loading, displaying and interacting with the contents of a document. The FileDocumentController class is a controller base class specialized in showing the content of files.
DocumentController supports extensions using the DocumentControllerClass. Extensions can hook into controller operations and provide custom UI.
Document controllers can provide views using the DocumentView class and derived classes. Unlike the old ViewContent class, which created a Control, the DocumentController class creates a DocumentView. A DocumentView is a component of the shell that can show the content provided by a document controller. The DocumentViewContent subclass can show a Control, and the DocumentViewContainer can show a set of views using tabs or splits.
SdiWorkspaceWindow has changed to support the new DocumentView model. However, all the interaction between DocumentView and the shell implementation is now done through interfaces so that porting to a native toolkit will be easier in the future, and also makes the code easier to unit test.
There are several GtkShellDocumentView* classes that implement the functionality of DocumentView and related classes.
All old ViewContent implementations have been migrated to use DocumentModel and DocumentView.
Document handling logic has been moved from Workbench to a new DocumentManager class.
The Document class is not a subclass of DocumentContext anymore. It has a DocumentContext property instead. All logic in charge of parsing documents has been moved to the new RoslynDocumentExtension class, a document controller extension that is created only when the document is parseable.
Bulding and Running
Writing Add-ins
MonoDevelop API
MonoDevelop Design and Architecure
- The Project Model
- Error and Exception Handling
- The Command System
- The Service Model
- The Document/View Model
MonoDevelop Coding Guides