In This Article

Document Swapping

Documents can be attached to zero or more SyntaxEditor controls at any given time, and alternate IEditorDocument instances can be swapped into a SyntaxEditor.

UI and Text Separation

The SyntaxEditor product has been specifically designed such that the text/parsing framework functions completely independently from the user interface layer.

The SyntaxEditor control is the root object of the product's user interface layer. It contains multiple editor views in which text can be edited.

The IEditorDocument interface provides the requirements for a document that can be edited within a SyntaxEditor control. Editor documents are the root of the text/parsing framework hierarchy and specify an ISyntaxLanguage that is used to parse the code in the document.

Swapping Document Instances

The SyntaxEditor control is always editing a single IEditorDocument instance at a time. The Document property gets and sets which IEditorDocument is currently being edited.

A second IEditorDocument could be opened and swapped in place of the SyntaxEditor's current document, by setting the Document property to the new document instance. When this occurs, the SyntaxEditor control detaches from the old document, attaches to the new document, and updates its views to display the text in the new document.

So effectively you could have an application that has a single SyntaxEditor control instance, but a lot of IEditorDocument instances that are loaded in memory. When the end user wishes to edit a particular document, you would swap that document into the editor. This saves on overall memory since multiple editor control instances are not required.