Package org.eclipse.compare
Class SharedDocumentAdapter
java.lang.Object
org.eclipse.compare.SharedDocumentAdapter
- All Implemented Interfaces:
- ISharedDocumentAdapter
An implementation of 
ISharedDocumentAdapter that provides default behavior for the
 methods of that interface.
 Clients may subclass this class.
- Since:
- 3.3
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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 (usingISharedDocumentAdapter.getDocumentKey(Object)and the appropriate provider and callsISharedDocumentAdapter.disconnect(IDocumentProvider, IEditorInput).voiddisconnect(IDocumentProvider provider, IEditorInput documentKey) Disconnect the element from the document provider.getDocumentKey(Object element) Default implementation ofgetDocumentKey(Object)that returns aFileEditorInputfor the element if the element adapts toIFile.static IDocumentProvidergetDocumentProvider(IEditorInput input) Returns the document provider for the given editor input.protected voidsaveDocument(IDocumentProvider provider, IEditorInput documentKey, IDocument document, boolean overwrite, IProgressMonitor monitor) A helper method to save a document.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.compare.ISharedDocumentAdapterflushDocument
- 
Constructor Details- 
SharedDocumentAdapterpublic SharedDocumentAdapter()
 
- 
- 
Method Details- 
getDocumentProviderReturns the document provider for the given editor input.- Parameters:
- input- the editor input
- Returns:
- the document provider for the given editor input
 
- 
connectDescription copied from interface:ISharedDocumentAdapterConnect 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.- Specified by:
- connectin interface- ISharedDocumentAdapter
- Parameters:
- provider- the document provider
- documentKey- the element's key returned from- ISharedDocumentAdapter.getDocumentKey(Object)
- Throws:
- CoreException- if connection was not possible
- See Also:
 
- 
disconnectDescription copied from interface:ISharedDocumentAdapterDisconnect 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.- Specified by:
- disconnectin interface- ISharedDocumentAdapter
- Parameters:
- provider- the document provider
- documentKey- the element's key returned from- ISharedDocumentAdapter.getDocumentKey(Object)
- See Also:
 
- 
getDocumentKeyDefault implementation ofgetDocumentKey(Object)that returns aFileEditorInputfor the element if the element adapts toIFile.- Specified by:
- getDocumentKeyin interface- ISharedDocumentAdapter
- 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
- See Also:
 
- 
saveDocumentprotected void saveDocument(IDocumentProvider provider, IEditorInput documentKey, IDocument document, boolean overwrite, IProgressMonitor monitor) throws CoreException A helper method to save a document.- Parameters:
- provider- the document provider
- documentKey- the document key
- document- the document
- overwrite- indicates whether overwrite should be performed while saving the given element if necessary
- monitor- a progress monitor
- Throws:
- CoreException- if document could not be stored to the given element
 
- 
disconnectDescription copied from interface:ISharedDocumentAdapterA helper disconnect method that looks up the appropriate key (usingISharedDocumentAdapter.getDocumentKey(Object)and the appropriate provider and callsISharedDocumentAdapter.disconnect(IDocumentProvider, IEditorInput).- Specified by:
- disconnectin interface- ISharedDocumentAdapter
- Parameters:
- element- the element that was used to previously connect to a document
- See Also:
 
 
-