|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.StorageDocumentProvider
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileDocumentProvider
org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileDiagramDocumentProvider
public class FileDiagramDocumentProvider
An implementation of IDiagramDocumentProvider
for
connecting org.eclipse.ui.IFileEditorInput
and
IDiagramDocument
.
Nested Class Summary | |
---|---|
class |
FileDiagramDocumentProvider.DiagramFileInfo
|
Nested classes/interfaces inherited from class org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileDocumentProvider |
---|
FileDocumentProvider.FileInfo, FileDocumentProvider.FileSynchronizer, FileDocumentProvider.SafeChange |
Nested classes/interfaces inherited from class org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.StorageDocumentProvider |
---|
StorageDocumentProvider.StorageInfo |
Nested classes/interfaces inherited from class org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider |
---|
AbstractDocumentProvider.DocumentProviderOperation, AbstractDocumentProvider.ElementInfo |
Field Summary |
---|
Fields inherited from class org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileDocumentProvider |
---|
fResourceRuleFactory |
Fields inherited from class org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider |
---|
PR10806_UC5_ENABLED, PR14469_ENABLED, STATUS_ERROR, STATUS_OK |
Constructor Summary | |
---|---|
FileDiagramDocumentProvider()
|
Method Summary | |
---|---|
protected IDocument |
createEmptyDocument()
Factory method for creating empty documents. |
protected FileDocumentProvider.FileInfo |
createFileInfo(IDocument document,
FileDocumentProvider.FileSynchronizer synchronizer,
IFileEditorInput input)
Create a FileInfo for the given document. |
IEditorInput |
createInputWithEditingDomain(IEditorInput editorInput,
org.eclipse.emf.transaction.TransactionalEditingDomain domain)
|
protected void |
disposeElementInfo(java.lang.Object element,
AbstractDocumentProvider.ElementInfo info)
Disposes of the given element info object. |
protected void |
doSave(org.eclipse.emf.transaction.TransactionalEditingDomain domain,
IFile file,
Diagram diagram,
java.util.Map options,
IProgressMonitor monitor)
Handles the saving of the diagram to a file |
protected void |
doSaveDocument(IProgressMonitor monitor,
java.lang.Object element,
IDocument document,
boolean overwrite)
Performs the actual work of saving the given document provided for the given element. |
IDiagramDocument |
getDiagramDocument(java.lang.Object element)
Returns the diagram document. |
protected ISchedulingRule |
getSaveRule(java.lang.Object element)
Returns the scheduling rule required for executing save on the given element. |
protected void |
handleElementContentChanged(IFileEditorInput fileEditorInput)
Updates the element info to a change of the file content and sends out appropriate notifications. |
protected void |
handleElementMoved(IFileEditorInput fileEditorInput,
IPath path)
Additionally handles updating the URI of the diagram's resource when on an element moved event. |
protected void |
saveDocumentToFile(IDocument document,
IFile file,
boolean overwrite,
IProgressMonitor monitor)
Initializes the given document with the given stream using the given encoding. |
protected boolean |
setDocumentContent(IDocument document,
IEditorInput editorInput)
Initializes the given document from the given editor input using the given character encoding. |
protected void |
setDocumentContentFromStorage(IDocument document,
IStorage storage)
Initializes the given document with the given stream using the given encoding. |
Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileDocumentProvider |
---|
checkSynchronizationState, computeModificationStamp, createElementInfo, doResetDocument, doSynchronize, doValidateState, getElementInfo, getModificationStamp, getOperationRunner, getResetRule, getSynchronizationStamp, getSynchronizeRule, getValidateStateRule, handleElementDeleted, isDeleted, isModifiable, isSynchronized, refreshFile, refreshFile, setDocumentContent |
Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.StorageDocumentProvider |
---|
createDocument, createNewElementInfo, doUpdateStateCache, handleCoreException, isReadOnly, setupDocument, updateCache |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileDiagramDocumentProvider()
Method Detail |
---|
protected IDocument createEmptyDocument()
StorageDocumentProvider
createEmptyDocument
in class StorageDocumentProvider
public IDiagramDocument getDiagramDocument(java.lang.Object element)
IDiagramDocumentProvider
getDiagramDocument
in interface IDiagramDocumentProvider
element
- The Editor Input for which the diagram document is requred.
IDocumentProvider.getDocument(Object)
protected void disposeElementInfo(java.lang.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 FileDocumentProvider
element
- the elementinfo
- the element info objectprotected void setDocumentContentFromStorage(IDocument document, IStorage storage) throws CoreException
StorageDocumentProvider
setDocumentContentFromStorage
in class StorageDocumentProvider
document
- the document to be initialized
CoreException
- if the given stream can not be readprotected void saveDocumentToFile(IDocument document, IFile file, boolean overwrite, IProgressMonitor monitor) throws CoreException
FileDocumentProvider
saveDocumentToFile
in class FileDocumentProvider
document
- the document to be initialized
CoreException
- if the given stream can not be readprotected void handleElementContentChanged(IFileEditorInput fileEditorInput)
handleElementContentChanged
in class FileDocumentProvider
fileEditorInput
- the input of an text editorprotected FileDocumentProvider.FileInfo createFileInfo(IDocument document, FileDocumentProvider.FileSynchronizer synchronizer, IFileEditorInput input)
FileDocumentProvider
createFileInfo
in class FileDocumentProvider
document
- to create a FileInfo forsynchronizer
- FileSynchronizer which has been created for the
IFileEditorInputinput
- IFileEditorInput corresponding to the document
protected boolean setDocumentContent(IDocument document, IEditorInput editorInput) throws CoreException
StorageDocumentProvider
setDocumentContent
in class StorageDocumentProvider
document
- the document to be initializededitorInput
- the input from which to derive the content of the document
true
if the document content could be set, false
otherwise
CoreException
- if the given editor input cannot be accessedpublic IEditorInput createInputWithEditingDomain(IEditorInput editorInput, org.eclipse.emf.transaction.TransactionalEditingDomain domain)
createInputWithEditingDomain
in interface IDiagramDocumentProvider
protected void doSaveDocument(IProgressMonitor monitor, java.lang.Object element, IDocument document, boolean overwrite) throws CoreException
AbstractDocumentProvider
Subclasses must implement this method.
doSaveDocument
in class FileDocumentProvider
monitor
- a progress monitor to report progress and request cancellationelement
- the elementdocument
- the documentoverwrite
- indicates whether an overwrite should happen if necessary
CoreException
- if document could not be stored to the given elementprotected ISchedulingRule getSaveRule(java.lang.Object element)
AbstractDocumentProvider
save
on the given element. This default
implementation returns null
.
getSaveRule
in class FileDocumentProvider
element
- the element
save
protected void doSave(org.eclipse.emf.transaction.TransactionalEditingDomain domain, IFile file, Diagram diagram, java.util.Map options, IProgressMonitor monitor) throws CoreException
domain
- the TransactionalEditingDomain we are saving infile
- the IFile to save todiagram
- Diagram that will be savedoptions
- save options or nullmonitor
- IProgressMonitor
CoreException
protected void handleElementMoved(IFileEditorInput fileEditorInput, IPath path)
handleElementMoved
in class FileDocumentProvider
fileEditorInput
- the input of an document editorpath
- the path of the new location of the file
|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.