public abstract class SharedDocumentAdapter extends Object implements ISharedDocumentAdapter
ISharedDocumentAdapter
that provides default behavior for the
methods of that interface.
Clients may subclass this class.
Constructor and Description |
---|
SharedDocumentAdapter() |
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) . |
IEditorInput |
getDocumentKey(Object element)
Default implementation of
getDocumentKey(Object) that returns a
FileEditorInput for the element if the element adapts to IFile . |
static IDocumentProvider |
getDocumentProvider(IEditorInput input)
Return the document provider for the given editor input.
|
protected void |
saveDocument(IDocumentProvider provider,
IEditorInput documentKey,
IDocument document,
boolean overwrite,
IProgressMonitor monitor)
A helper method to save a document.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
flushDocument
public static IDocumentProvider getDocumentProvider(IEditorInput input)
input
- the editor inputpublic void connect(IDocumentProvider provider, IEditorInput documentKey) throws CoreException
ISharedDocumentAdapter
connect
in interface ISharedDocumentAdapter
provider
- 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)
ISharedDocumentAdapter
disconnect
in interface ISharedDocumentAdapter
provider
- the document providerdocumentKey
- the element's key returned from ISharedDocumentAdapter.getDocumentKey(Object)
IDocumentProvider.disconnect(Object)
public IEditorInput getDocumentKey(Object element)
getDocumentKey(Object)
that returns a
FileEditorInput
for the element if the element adapts to IFile
.getDocumentKey
in interface ISharedDocumentAdapter
element
- the element being queried for a shared documentnull
ISharedDocumentAdapter.getDocumentKey(java.lang.Object)
protected void saveDocument(IDocumentProvider provider, IEditorInput documentKey, IDocument document, boolean overwrite, IProgressMonitor monitor) throws CoreException
provider
- the document providerdocumentKey
- the document keydocument
- the documentoverwrite
- indicates whether overwrite should be performed
while saving the given element if necessarymonitor
- a progress monitorCoreException
public void disconnect(Object element)
ISharedDocumentAdapter
ISharedDocumentAdapter.getDocumentKey(Object)
and the appropriate provider and calls ISharedDocumentAdapter.disconnect(IDocumentProvider, IEditorInput)
.disconnect
in interface ISharedDocumentAdapter
element
- the element that was used to previously connect to a documentIDocumentProvider.disconnect(Object)
Copyright (c) 2000, 2016 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.