A document provider maps between domain elements and documents. A document provider has the following responsibilities:
- create an annotation model of a domain model element
- create and manage a textual representation, i.e., a document, of a domain model element
- create and save the content of domain model elements based on given documents
- update the documents this document provider manages for domain model elements to changes directly applied to those domain model elements
- notify all element state listeners about changes directly applied to domain model elements this document provider manages a document for, i.e. the document provider must know which changes of a domain model element are to be interpreted as element moves, deletes, etc.
Text editors use document providers to bridge the gap between their input elements and the documents they work on. A single document provider may be shared between multiple editors; the methods take the editors' input elements as a parameter.
This interface may be implemented by clients; or subclass the standard abstract base class AbstractDocumentProvider
.
In order to provided backward compatibility for clients of IDocumentProvider
, extension interfaces are used to provide a means of evolution. The following extension interfaces exist:
- {@link org.eclipse.ui.texteditor.IDocumentProviderExtension} since version 2.0 introducingstate validation, extended read-only handling and synchronization.
- {@link org.eclipse.ui.texteditor.IDocumentProviderExtension2} since version 2.1 introducingadding support for a global progress monitor.
- {@link org.eclipse.ui.texteditor.IDocumentProviderExtension3} since version 3.0 addinga predicate for querying synchronization state.
- {@link org.eclipse.ui.texteditor.IDocumentProviderExtension4} since version 3.1 addinga predicate for querying an element's the content description.
- {@link org.eclipse.ui.texteditor.IDocumentProviderExtension5} since version 3.2 addingthe ability to detect a non-synchronized exception.
@see org.eclipse.jface.text.IDocument
@see org.eclipse.ui.texteditor.AbstractDocumentProvider
@see org.eclipse.ui.texteditor.IDocumentProviderExtension
@see org.eclipse.ui.texteditor.IDocumentProviderExtension2
@see org.eclipse.ui.texteditor.IDocumentProviderExtension3
@see org.eclipse.ui.texteditor.IDocumentProviderExtension4
@see org.eclipse.ui.texteditor.IDocumentProviderExtension5