public class SharedDocumentAdapterWrapper extends Object implements ISharedDocumentAdapter
ISharedDocumentAdapter that wraps another
shared document adapter.
Clients may subclass this class.
| Constructor and Description |
|---|
SharedDocumentAdapterWrapper(ISharedDocumentAdapter wrappedAdapter)
Create a shared document adapter that wraps the given adapter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
connect(IDocumentProvider provider,
IEditorInput documentKey)
Connect the given element to its document provider.
|
void |
disconnect(IDocumentProvider provider,
IEditorInput documentKey)
Disconnect the element from the document provider.
|
void |
disconnect(Object element)
A helper disconnect method that looks up the appropriate key (using
ISharedDocumentAdapter.getDocumentKey(Object)
and the appropriate provider and calls ISharedDocumentAdapter.disconnect(IDocumentProvider, IEditorInput). |
void |
flushDocument(IDocumentProvider provider,
IEditorInput documentKey,
IDocument document,
boolean overwrite)
Flush the contents of the given document into the typed element that provided the
document.
|
static ISharedDocumentAdapter |
getAdapter(Object element)
Helper method that returns the shared document adapter for the
given typed element or
null if there isn't one. |
IEditorInput |
getDocumentKey(Object element)
Return the object that is to be used as the key for retrieving the
appropriate
IDocumentProvider from the
DocumentProviderRegistry and for obtaining the shared
IDocument from the document provider. |
ISharedDocumentAdapter |
getWrappedAdapter()
Return the wrapped adapter.
|
public SharedDocumentAdapterWrapper(ISharedDocumentAdapter wrappedAdapter)
wrappedAdapter - the wrapped adapterpublic static ISharedDocumentAdapter getAdapter(Object element)
null if there isn't one.element - the typed elementnullpublic void connect(IDocumentProvider provider, IEditorInput documentKey) throws CoreException
ISharedDocumentAdapterconnect in interface ISharedDocumentAdapterprovider - the document providerdocumentKey - the element's key returned from ISharedDocumentAdapter.getDocumentKey(Object)CoreException - if connection was not possibleIDocumentProvider.connect(Object)public void disconnect(IDocumentProvider provider, IEditorInput documentKey)
ISharedDocumentAdapterdisconnect in interface ISharedDocumentAdapterprovider - the document providerdocumentKey - the element's key returned from ISharedDocumentAdapter.getDocumentKey(Object)IDocumentProvider.disconnect(Object)public IEditorInput getDocumentKey(Object element)
ISharedDocumentAdapterIDocumentProvider from the
DocumentProviderRegistry and for obtaining the shared
IDocument from the document provider. Returns null
if the element does not have a shared document.getDocumentKey in interface ISharedDocumentAdapterelement - the element being queried for a shared documentnullpublic void flushDocument(IDocumentProvider provider, IEditorInput documentKey, IDocument document, boolean overwrite) throws CoreException
ISharedDocumentAdapterflushDocument in interface ISharedDocumentAdapterprovider - the document providerdocumentKey - the element's key returned from ISharedDocumentAdapter.getDocumentKey(Object)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 elementIDocumentProvider.saveDocument(IProgressMonitor, Object, IDocument, boolean)public final ISharedDocumentAdapter getWrappedAdapter()
public void disconnect(Object element)
ISharedDocumentAdapterISharedDocumentAdapter.getDocumentKey(Object)
and the appropriate provider and calls ISharedDocumentAdapter.disconnect(IDocumentProvider, IEditorInput).disconnect in interface ISharedDocumentAdapterelement - the element that was used to previously connect to a documentIDocumentProvider.disconnect(Object)
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.