|
Eclipse Platform 2.1 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--org.eclipse.ui.texteditor.AbstractDocumentProvider
|
+--org.eclipse.ui.editors.text.StorageDocumentProvider
|
+--org.eclipse.ui.editors.text.FileDocumentProvider
Shareable document provider specialized for file resources (IFile).
This class may be instantiated or be subclassed.
| Inner Class Summary | |
protected class |
FileDocumentProvider.FileInfo
Bundle of all required information to allow files as underlying document resources. |
protected class |
FileDocumentProvider.FileSynchronizer
Synchronizes the document with external resource changes. |
protected class |
FileDocumentProvider.SafeChange
Runnable encapsulating an element state change. |
| Inner classes inherited from class org.eclipse.ui.editors.text.StorageDocumentProvider |
StorageDocumentProvider.StorageInfo |
| Inner classes inherited from class org.eclipse.ui.texteditor.AbstractDocumentProvider |
AbstractDocumentProvider.ElementInfo |
| Fields inherited from class org.eclipse.ui.editors.text.StorageDocumentProvider |
DEFAULT_FILE_SIZE |
| Fields inherited from class org.eclipse.ui.texteditor.AbstractDocumentProvider |
PR10806_UC5_ENABLED, PR14469_ENABLED, STATUS_ERROR, STATUS_OK |
| Constructor Summary | |
FileDocumentProvider()
Creates and returns a new document provider. |
|
| Method Summary | |
protected void |
checkSynchronizationState(long cachedModificationStamp,
IResource resource)
Checks whether the given resource has been changed on the local file system by comparing the actual time stamp with the cached one. |
protected long |
computeModificationStamp(IResource resource)
Computes the initial modification stamp for the given resource. |
protected IAnnotationModel |
createAnnotationModel(Object element)
Creates an annotation model for the given element. |
protected AbstractDocumentProvider.ElementInfo |
createElementInfo(Object element)
Creates a new element info object for the given element. |
protected void |
disposeElementInfo(Object element,
AbstractDocumentProvider.ElementInfo info)
Disposes of the given element info object. |
protected void |
doSaveDocument(IProgressMonitor monitor,
Object element,
IDocument document,
boolean overwrite)
Performs the actual work of saving the given document provided for the given element. |
protected void |
doValidateState(Object element,
Object computationContext)
Hook method for validating the state of the given element. |
protected AbstractDocumentProvider.ElementInfo |
getElementInfo(Object element)
Returns the element info object for the given element. |
long |
getModificationStamp(Object element)
Returns the modification stamp of the given element. |
protected String |
getPersistedEncoding(Object element)
Returns the persited encoding for the given element. |
long |
getSynchronizationStamp(Object element)
Returns the time stamp of the last synchronization of the given element and it's provided document. |
protected void |
handleElementContentChanged(IFileEditorInput fileEditorInput)
Updates the element info to a change of the file content and sends out appropriate notifications. |
protected void |
handleElementDeleted(IFileEditorInput fileEditorInput)
Sends out the notification that the file serving as document input has been deleted. |
protected void |
handleElementMoved(IFileEditorInput fileEditorInput,
IPath path)
Sends out the notification that the file serving as document input has been moved. |
boolean |
isDeleted(Object element)
Returns whether the given element has been deleted. |
boolean |
isModifiable(Object element)
Returns whether the document provider thinks that the given element can persistently be modified. |
protected void |
persistEncoding(Object element,
String encoding)
Persists the given encoding for the given element. |
protected void |
refreshFile(IFile file)
Refreshes the given file resource. |
void |
resetDocument(Object element)
Resets the given element's document to its last saved state. |
protected boolean |
setDocumentContent(IDocument document,
IEditorInput editorInput)
Deprecated. use file encoding based version |
protected boolean |
setDocumentContent(IDocument document,
IEditorInput editorInput,
String encoding)
Intitializes the given document from the given editor input using the given character encoding. |
void |
synchronize(Object element)
Synchronizes the document provided for the given element with the given element. |
| Methods inherited from class org.eclipse.ui.editors.text.StorageDocumentProvider |
createDocument, createEmptyDocument, doUpdateStateCache, getDefaultEncoding, getEncoding, handleCoreException, isReadOnly, setDocumentContent, setDocumentContent, setEncoding, updateCache |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FileDocumentProvider()
| Method Detail |
protected boolean setDocumentContent(IDocument document,
IEditorInput editorInput)
throws CoreException
StorageDocumentProvider#setDocumentContent(IDocument, IEditorInput).setDocumentContent in class StorageDocumentProvider
protected boolean setDocumentContent(IDocument document,
IEditorInput editorInput,
String encoding)
throws CoreException
StorageDocumentProvidersetDocumentContent in class StorageDocumentProviderorg.eclipse.ui.editors.text.StorageDocumentProviderdocument - the document to be initializededitorInput - the input from which to derive the content of the documentencoding - the character encoding used to read the editor inputtrue if the document content could be set, false otherwiseCoreException - if the given editor input cannot be accessed
protected IAnnotationModel createAnnotationModel(Object element)
throws CoreException
AbstractDocumentProviderSubclasses must implement this method.
createAnnotationModel in class StorageDocumentProviderorg.eclipse.ui.texteditor.AbstractDocumentProviderelement - the elementCoreException - if the annotation model could not be created
protected void checkSynchronizationState(long cachedModificationStamp,
IResource resource)
throws CoreException
CoreException
is thrown.cachedModificationStamp - the chached modification stampresource - the resource to checkCoreException - if resource has been changed on the file systemprotected long computeModificationStamp(IResource resource)
resource - the resourcepublic long getModificationStamp(Object element)
IDocumentProvidergetModificationStamp in class AbstractDocumentProviderorg.eclipse.ui.texteditor.IDocumentProviderelement - the elementpublic long getSynchronizationStamp(Object element)
IDocumentProvidergetSynchronizationStamp in class AbstractDocumentProviderorg.eclipse.ui.texteditor.IDocumentProviderelement - the element
public void synchronize(Object element)
throws CoreException
IDocumentProviderExtensiongetSynchronizationTimeStamp
and getModificationTimeStamp return the same value.synchronize in class AbstractDocumentProviderorg.eclipse.ui.texteditor.IDocumentProviderExtensionelement - the elementCoreException - if the synchronization could not be performedpublic boolean isDeleted(Object element)
IDocumentProviderisDeleted in class AbstractDocumentProviderorg.eclipse.ui.texteditor.IDocumentProviderelement - the elementtrue if the element has been deleted
protected void doSaveDocument(IProgressMonitor monitor,
Object element,
IDocument document,
boolean overwrite)
throws CoreException
AbstractDocumentProviderSubclasses must implement this method.
doSaveDocument in class StorageDocumentProviderorg.eclipse.ui.texteditor.AbstractDocumentProvidermonitor - a progress monitor to report progress and request cancelationelement - the elementdocument - the documentoverwrite - indicates whether an overwrite should happen if necessaryCoreException - if document could not be stored to the given element
protected AbstractDocumentProvider.ElementInfo createElementInfo(Object element)
throws CoreException
AbstractDocumentProvider
This method is called from connect when an element info needs
to be created. The AbstractDocumentProvider implementation
of this method returns a new element info object whose document and
annotation model are the values of createDocument(element)
and createAnnotationModel(element), respectively. Subclasses
may override.
createElementInfo in class StorageDocumentProviderorg.eclipse.ui.texteditor.AbstractDocumentProviderelement - the elementCoreException - if the document or annotation model could not be created
protected void disposeElementInfo(Object element,
AbstractDocumentProvider.ElementInfo info)
AbstractDocumentProvider
This method is called when an element info is disposed. The
AbstractDocumentProvider implementation of this
method does nothing. Subclasses may reimplement.
disposeElementInfo in class AbstractDocumentProviderorg.eclipse.ui.texteditor.AbstractDocumentProviderelement - the elementinfo - the element info objectprotected void handleElementContentChanged(IFileEditorInput fileEditorInput)
fileEditorInput - the input of an text editor
protected void handleElementMoved(IFileEditorInput fileEditorInput,
IPath path)
fileEditorInput - the input of an text editorpath - the path of the new location of the fileprotected void handleElementDeleted(IFileEditorInput fileEditorInput)
fileEditorInput - the input of an text editorprotected AbstractDocumentProvider.ElementInfo getElementInfo(Object element)
AbstractDocumentProvidergetElementInfo in class AbstractDocumentProviderorg.eclipse.ui.texteditor.AbstractDocumentProviderelement - the elementnull if none
protected void doValidateState(Object element,
Object computationContext)
throws CoreException
AbstractDocumentProviderdoValidateState in class AbstractDocumentProviderorg.eclipse.ui.texteditor.AbstractDocumentProviderelement - the elementcomputationContext - the context in which validation happensValidateStateException - in case validation succeeds, but the state cannot be changedCoreException - in case validation failspublic boolean isModifiable(Object element)
IDocumentProviderExtensionisReadOnly 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.isModifiable in class StorageDocumentProviderorg.eclipse.ui.texteditor.IDocumentProviderExtensionelement - the elementtrue if the given element is modifiable, false otherwise
public void resetDocument(Object element)
throws CoreException
IDocumentProviderelementContentAboutToBeReplaced)
and after (elementContentReplaced) the content is changed.resetDocument in class AbstractDocumentProviderorg.eclipse.ui.texteditor.IDocumentProviderelement - the element, or null
protected void refreshFile(IFile file)
throws CoreException
file - a - CoreException if the refresh failsprotected String getPersistedEncoding(Object element)
getPersistedEncoding in class StorageDocumentProviderelement - the element for which to get the persisted encoding
protected void persistEncoding(Object element,
String encoding)
throws CoreException
persistEncoding in class StorageDocumentProviderelement - the element for which to store the persisted encodingencoding - the encoding
|
Eclipse Platform 2.1 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||