public interface IDocumentProvider
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:
IDocumentProviderExtension
since version 2.0 introducing
state validation, extended read-only handling and synchronization.IDocumentProviderExtension2
since version 2.1 introducing
adding support for a global progress monitor.IDocumentProviderExtension3
since version 3.0 adding
a predicate for querying synchronization state.IDocumentProviderExtension4
since version 3.1 adding
a predicate for querying an element's the content description.IDocumentProviderExtension5
since version 3.2 adding
the ability to detect a non-synchronized exception.Modifier and Type | Method and Description |
---|---|
void |
aboutToChange(Object element)
Informs this document provider about upcoming changes of the given element.
|
void |
addElementStateListener(IElementStateListener listener)
Adds the given element state listener to this document provider.
|
boolean |
canSaveDocument(Object element)
Returns whether the document provided for the given element differs from
its original state which would required that it be saved.
|
void |
changed(Object element)
Informs this document provider that the given element has been changed.
|
void |
connect(Object element)
Connects the given element to this document provider.
|
void |
disconnect(Object element)
Disconnects the given element from this document provider.
|
IAnnotationModel |
getAnnotationModel(Object element)
Returns the annotation model for the given element.
|
IDocument |
getDocument(Object element)
Returns the document for the given element.
|
long |
getModificationStamp(Object element)
Returns the modification stamp of the given element.
|
long |
getSynchronizationStamp(Object element)
Returns the time stamp of the last synchronization of the given element and its provided
document.
|
boolean |
isDeleted(Object element)
Returns whether the given element has been deleted.
|
boolean |
mustSaveDocument(Object element)
Returns whether the document provided for the given element must be saved.
|
void |
removeElementStateListener(IElementStateListener listener)
Removes the given element state listener from this document provider.
|
void |
resetDocument(Object element)
Resets the given element's document to its last saved state.
|
void |
saveDocument(IProgressMonitor monitor,
Object element,
IDocument document,
boolean overwrite)
Saves the given document provided for the given element.
|
void connect(Object element) throws CoreException
disconnect(Object)
this provider can assume to know the
correct number of clients working with the document provided for that
domain model element.
The given element must not be null
.
element
- the elementCoreException
- if the textual representation or the annotation model
of the element could not be createdvoid disconnect(Object element)
connect(Object)
and of this method this provider can assume to
know the correct number of clients working with the document provided for that
domain model element.
The given element must not be null
.
element
- the elementIDocument getDocument(Object element)
element
- the element, or null
null
if nonevoid resetDocument(Object element) throws CoreException
elementContentAboutToBeReplaced
)
and after (elementContentReplaced
) the content is changed.element
- the element, or null
CoreException
- if document could not be reset for the given elementvoid saveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException
monitor
- a progress monitor to report progress and request cancelationelement
- the element, or null
document
- the documentoverwrite
- indicates whether overwrite should be performed
while saving the given element if necessaryCoreException
- if document could not be stored to the given elementlong getModificationStamp(Object element)
element
- the elementlong getSynchronizationStamp(Object element)
element
- the elementboolean isDeleted(Object element)
element
- the elementtrue
if the element has been deletedboolean mustSaveDocument(Object element)
element
- the element, or null
true
if the document must be saved, and
false
otherwise (including the element is null
)boolean canSaveDocument(Object element)
element
- the element, or null
true
if the document can be saved, and
false
otherwise (including the element is null
)IAnnotationModel getAnnotationModel(Object element)
element
- the element, or null
null
if nonevoid aboutToChange(Object element)
aboutToChange
has been and before changed
is called. In this case,
it is assumed that the document is already up to date, e.g., a save operation is a
typical case.
The concrete nature of the change notification depends on the concrete type of the
given element. If the element is, e.g., an IResource
the notification
is a resource delta.
element
- the element, or null
void changed(Object element)
IResource
the notification is a resource delta.element
- the element, or null
void addElementStateListener(IElementStateListener listener)
listener
- the listenervoid removeElementStateListener(IElementStateListener listener)
listener
- the listener
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.