|
Runtime | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IDocumentProvider
A document provider maps between domain elements and documents. A document provider has the following responsibilities:
This interface may be implemented by clients; or subclass the standard abstract base class
AbstractDocumentProvider.
IDocument,
AbstractDocumentProvider| Method Summary | |
|---|---|
void |
aboutToChange(java.lang.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(java.lang.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(java.lang.Object element)
Informs this document provider that the given element has been changed. |
void |
connect(java.lang.Object element)
Connects the given element to this document provider. |
void |
disconnect(java.lang.Object element)
Disconnects the given element from this document provider. |
IDocument |
getDocument(java.lang.Object element)
Returns the document for the given element. |
long |
getModificationStamp(java.lang.Object element)
Returns the modification stamp of the given element. |
IProgressMonitor |
getProgressMonitor()
Returns this providers progress monitor. |
IStatus |
getStatus(java.lang.Object element)
Returns the status of the given element. |
long |
getSynchronizationStamp(java.lang.Object element)
Returns the time stamp of the last synchronization of the given element and it's provided document. |
boolean |
isDeleted(java.lang.Object element)
Returns whether the given element has been deleted. |
boolean |
isModifiable(java.lang.Object element)
Returns whether the document provider thinks that the given element can persistently be modified. |
boolean |
isReadOnly(java.lang.Object element)
Returns whether the document provider thinks that the given element is read-only. |
boolean |
isStateValidated(java.lang.Object element)
Returns whether the state of the given element has been validated. |
boolean |
isSynchronized(java.lang.Object element)
Returns whether the information provided for the given element is in sync with the element. |
boolean |
mustSaveDocument(java.lang.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(java.lang.Object element)
Resets the given element's document to its last saved state. |
void |
saveDocument(IProgressMonitor monitor,
java.lang.Object element,
IDocument document,
boolean overwrite)
Saves the given document provided for the given element. |
void |
setCanSaveDocument(java.lang.Object element)
Marks the document managed for the given element as saveable. |
void |
setProgressMonitor(IProgressMonitor progressMonitor)
Sets this providers progress monitor. |
void |
synchronize(java.lang.Object element)
Synchronizes the document provided for the given element with the given element. |
void |
updateStateCache(java.lang.Object element)
Updates the state cache for the given element. |
void |
validateState(java.lang.Object element,
java.lang.Object computationContext)
Validates the state of the given element. |
| Method Detail |
|---|
void connect(java.lang.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 element
CoreException - if the document representation could not be createdvoid disconnect(java.lang.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(java.lang.Object element)
element - the element, or null
null if none
void resetDocument(java.lang.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 element
void saveDocument(IProgressMonitor monitor,
java.lang.Object element,
IDocument document,
boolean overwrite)
throws CoreException
monitor - a progress monitor to report progress and request cancellationelement - the element, or nulldocument - the documentoverwrite - indicates whether overwrite should be performed
while saving the given element if necessary
CoreException - if document could not be stored to the given elementlong getModificationStamp(java.lang.Object element)
element - the element
long getSynchronizationStamp(java.lang.Object element)
element - the element
boolean isDeleted(java.lang.Object element)
element - the element
true if the element has been deletedboolean mustSaveDocument(java.lang.Object element)
element - the element, or null
true if the document must be saved, and
false otherwise (including the element is null)boolean canSaveDocument(java.lang.Object element)
element - the element, or null
true if the document can be saved, and
false otherwise (including the element is null)void aboutToChange(java.lang.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 nullvoid changed(java.lang.Object element)
IResource the notification is a resource delta.
element - the element, or nullvoid addElementStateListener(IElementStateListener listener)
listener - the listenervoid removeElementStateListener(IElementStateListener listener)
listener - the listenerboolean isReadOnly(java.lang.Object element)
true, saveDocument could fail.
This method does not say anything about the document constructed from the given
element. If the given element is not connected to this document provider, the return
value is undefined. Document providers are allowed to use a cache to answer this
question, i.e. there can be a difference between the "real" state of the element and
the return value.
element - the element
true if the given element is read-only, false otherwiseboolean isModifiable(java.lang.Object element)
isReadOnly as read-only elements may be modifiable and
writable elements may not be modifiable. If the given element is not connected to this document
provider, the result is undefined. Document providers are allowed to use a cache to answer this
question, i.e. there can be a difference between the "real" state of the element and the return
value.
element - the element
true if the given element is modifiable, false otherwise
void validateState(java.lang.Object element,
java.lang.Object computationContext)
throws CoreException
isReadOnly and isModifiable. If the
given element is not connected to this document provider, the effect is undefined.
element - the elementcomputationContext - the context in which the computation is performed, e.g., a SWT shell
CoreException - if validating failsboolean isStateValidated(java.lang.Object element)
element - the element
true if the state has been validated
void updateStateCache(java.lang.Object element)
throws CoreException
isReadOnly and isModifiable. If the given element is not
connected to this document provider, the effect is undefined.
element - the element
CoreException - if validating failsvoid setCanSaveDocument(java.lang.Object element)
canBeSaved(element) will return true
afterwards.
element - the elementIStatus getStatus(java.lang.Object element)
element - the element
void synchronize(java.lang.Object element)
throws CoreException
getSynchronizationTimeStamp
and getModificationTimeStamp return the same value.
element - the element
CoreException - if the synchronization could not be performedvoid setProgressMonitor(IProgressMonitor progressMonitor)
progressMonitor - IProgressMonitor getProgressMonitor()
boolean isSynchronized(java.lang.Object element)
element - the element
true if the information is in sync with the element, false otherwise
|
Runtime | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.