Runtime

## org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document
Class FileDiagramDocumentProvider

    java.lang.Object
      org.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

All Implemented Interfaces:
  IDiagramDocumentProvider, IDocumentProvider

    public class FileDiagramDocumentProvider

extends FileDocumentProvider
implements IDiagramDocumentProvider

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 org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider

`aboutToChange, addElementStateListener, addUnchangedElementListeners, canSaveDocument, changed, connect, connected, disconnect, disconnected, executeOperation, fireElementContentAboutToBeReplaced, fireElementContentReplaced, fireElementDeleted, fireElementDirtyStateChanged, fireElementMoved, fireElementStateChangeFailed, fireElementStateChanging, fireElementStateValidationChanged, getConnectedElements, getDocument, getProgressMonitor, getResetOperation, getSaveOperation, getStatus, invalidatesState, isStateValidated, mustSaveDocument, removeElementStateListener, removeUnchangedElementListeners, resetDocument, saveDocument, setCanSaveDocument, setProgressMonitor, synchronize, updateStateCache, validateState`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FileDiagramDocumentProvider

    public FileDiagramDocumentProvider()

Method Detail

### createEmptyDocument

    protected IDocument createEmptyDocument()

  Description copied from class: `StorageDocumentProvider`
  Factory method for creating empty documents.

  Specified by:
    `createEmptyDocument` in class `StorageDocumentProvider`
  Returns:
    the newly created document

### getDiagramDocument

    public IDiagramDocument getDiagramDocument(java.lang.Object element)

  Description copied from interface: `IDiagramDocumentProvider`
  Returns the diagram document.

  Specified by:
    `getDiagramDocument` in interface `IDiagramDocumentProvider`
  Parameters:
    `element` - The Editor Input for which the diagram document is requred.
  Returns:
    the Diagram document.
  See Also:
    `IDocumentProvider.getDocument(Object)`

### disposeElementInfo

    protected void disposeElementInfo(java.lang.Object element,
                                      AbstractDocumentProvider.ElementInfo info)

  Description copied from class: `AbstractDocumentProvider`
  Disposes of the given element info object.

  This method is called when an element info is disposed. The `AbstractDocumentProvider` implementation of this method does nothing. Subclasses may reimplement.

  Overrides:
    `disposeElementInfo` in class `FileDocumentProvider`
  Parameters:
    `element` - the element
    `info` - the element info object

### setDocumentContentFromStorage

    protected void setDocumentContentFromStorage(IDocument document,
                                                 IStorage storage)
                                          throws CoreException

  Description copied from class: `StorageDocumentProvider`
  Initializes the given document with the given stream using the given encoding.

  Specified by:
    `setDocumentContentFromStorage` in class `StorageDocumentProvider`
  Parameters:
    `document` - the document to be initialized
  Throws:
    `CoreException` - if the given stream can not be read

### saveDocumentToFile

    protected void saveDocumentToFile(IDocument document,
                                      IFile file,
                                      boolean overwrite,
                                      IProgressMonitor monitor)
                               throws CoreException

  Description copied from class: `FileDocumentProvider`
  Initializes the given document with the given stream using the given encoding.

  Specified by:
    `saveDocumentToFile` in class `FileDocumentProvider`
  Parameters:
    `document` - the document to be initialized
  Throws:
    `CoreException` - if the given stream can not be read

### handleElementContentChanged

    protected void handleElementContentChanged(IFileEditorInput fileEditorInput)

  Updates the element info to a change of the file content and sends out appropriate notifications.

  Overrides:
    `handleElementContentChanged` in class `FileDocumentProvider`
  Parameters:
    `fileEditorInput` - the input of an text editor

### createFileInfo

    protected FileDocumentProvider.FileInfo createFileInfo(IDocument document,
                                                           FileDocumentProvider.FileSynchronizer synchronizer,
                                                           IFileEditorInput input)

  Description copied from class: `FileDocumentProvider`
  Create a FileInfo for the given document. May also construct and start required listeners.

  Overrides:
    `createFileInfo` in class `FileDocumentProvider`
  Parameters:
    `document` - to create a FileInfo for
    `synchronizer` - FileSynchronizer which has been created for the IFileEditorInput
    `input` - IFileEditorInput corresponding to the document
  Returns:
    FileInfo for the given document

### setDocumentContent

    protected boolean setDocumentContent(IDocument document,
                                         IEditorInput editorInput)
                                  throws CoreException

  Description copied from class: `StorageDocumentProvider`
  Initializes the given document from the given editor input using the given character encoding.

  Overrides:
    `setDocumentContent` in class `StorageDocumentProvider`
  Parameters:
    `document` - the document to be initialized
    `editorInput` - the input from which to derive the content of the document
  Returns:
    `true` if the document content could be set, `false` otherwise
  Throws:
    `CoreException` - if the given editor input cannot be accessed

### createInputWithEditingDomain

    public IEditorInput createInputWithEditingDomain(IEditorInput editorInput,
                                                     org.eclipse.emf.transaction.TransactionalEditingDomain domain)

  Specified by:
    `createInputWithEditingDomain` in interface `IDiagramDocumentProvider`

### doSaveDocument

    protected void doSaveDocument(IProgressMonitor monitor,
                                  java.lang.Object element,
                                  IDocument document,
                                  boolean overwrite)
                           throws CoreException

  Description copied from class: `AbstractDocumentProvider`
  Performs the actual work of saving the given document provided for the given element.

  Subclasses must implement this method.

  Overrides:
    `doSaveDocument` in class `FileDocumentProvider`
  Parameters:
    `monitor` - a progress monitor to report progress and request cancellation
    `element` - the element
    `document` - the document
    `overwrite` - indicates whether an overwrite should happen if necessary
  Throws:
    `CoreException` - if document could not be stored to the given element

### getSaveRule

    protected ISchedulingRule getSaveRule(java.lang.Object element)

  Description copied from class: `AbstractDocumentProvider`
  Returns the scheduling rule required for executing `save` on the given element. This default implementation returns `null`.

  Overrides:
    `getSaveRule` in class `FileDocumentProvider`
  Parameters:
    `element` - the element
  Returns:
    the scheduling rule for `save`

### doSave

    protected void doSave(org.eclipse.emf.transaction.TransactionalEditingDomain domain,
                          IFile file,
                          Diagram diagram,
                          java.util.Map options,
                          IProgressMonitor monitor)
                   throws CoreException

  Handles the saving of the diagram to a file

  Parameters:
    `domain` - the TransactionalEditingDomain we are saving in
    `file` - the IFile to save to
    `diagram` - Diagram that will be saved
    `options` - save options or null
    `monitor` - IProgressMonitor
  Throws:
    `CoreException`

### handleElementMoved

    protected void handleElementMoved(IFileEditorInput fileEditorInput,
                                      IPath path)

  Additionally handles updating the URI of the diagram's resource when on an element moved event.

  Overrides:
    `handleElementMoved` in class `FileDocumentProvider`
  Parameters:
    `fileEditorInput` - the input of an document editor
    `path` - the path of the new location of the file

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.