Package org.eclipse.compare
Interface ISharedDocumentAdapter
- All Known Implementing Classes:
SharedDocumentAdapter,SharedDocumentAdapterWrapper
public interface ISharedDocumentAdapter
An
ISharedDocumentAdapter is used to map an
ITypedElement to a shared document for the purposes of editing.- Since:
- 3.3
- Restriction:
- Clients are not expected to implement this interface but instead
should subclass
SharedDocumentAdapterorSharedDocumentAdapterWrapper.
-
Method Summary
Modifier and TypeMethodDescriptionvoidconnect(IDocumentProvider provider, IEditorInput documentKey) Connect the given element to its document provider.voiddisconnect(Object element) A helper disconnect method that looks up the appropriate key (usinggetDocumentKey(Object)and the appropriate provider and callsdisconnect(IDocumentProvider, IEditorInput).voiddisconnect(IDocumentProvider provider, IEditorInput documentKey) Disconnect the element from the document provider.voidflushDocument(IDocumentProvider provider, IEditorInput documentKey, IDocument document, boolean overwrite) Flush the contents of the given document into the typed element that provided the document.getDocumentKey(Object element) Return the object that is to be used as the key for retrieving the appropriateIDocumentProviderfrom theDocumentProviderRegistryand for obtaining the sharedIDocumentfrom the document provider.
-
Method Details
-
getDocumentKey
Return the object that is to be used as the key for retrieving the appropriateIDocumentProviderfrom theDocumentProviderRegistryand for obtaining the sharedIDocumentfrom the document provider. Returnsnullif the element does not have a shared document.- Parameters:
element- the element being queried for a shared document- Returns:
- the object that acts as the key to obtain a document provider and
document or
null
-
connect
Connect the given element to its document provider. All connections must be performed through this adapter so that the adapter can track whether it is connected or not.- Parameters:
provider- the document providerdocumentKey- the element's key returned fromgetDocumentKey(Object)- Throws:
CoreException- if connection was not possible- See Also:
-
disconnect
Disconnect the element from the document provider. All connects and disconnects must occur through the adapter so that the adapter can track whether it is connected or not.- Parameters:
provider- the document providerdocumentKey- the element's key returned fromgetDocumentKey(Object)- See Also:
-
disconnect
A helper disconnect method that looks up the appropriate key (usinggetDocumentKey(Object)and the appropriate provider and callsdisconnect(IDocumentProvider, IEditorInput).- Parameters:
element- the element that was used to previously connect to a document- See Also:
-
flushDocument
void flushDocument(IDocumentProvider provider, IEditorInput documentKey, IDocument document, boolean overwrite) throws CoreException Flush the contents of the given document into the typed element that provided the document. This method is invoked by the Compare framework classes when a request to flush the viewers has been made. It is up to the implementor to decide whether the changes in the buffer should be saved to disk at the time of the flush or buffered to be saved at a later time.- Parameters:
provider- the document providerdocumentKey- the element's key returned fromgetDocumentKey(Object)document- the documentoverwrite- indicates whether overwrite should be performed while saving the given element if necessary- Throws:
CoreException- if document could not be stored to the given element- See Also:
-