Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Runtime

org.eclipse.gmf.runtime.diagram.ui.resources.editor.document
Class DiagramInputDocumentProvider

java.lang.Object
  extended by 

org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider
      extended by 
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramInputDocumentProvider
All Implemented Interfaces:
IDiagramDocumentProvider, IDocumentProvider

public class DiagramInputDocumentProvider
extends AbstractDocumentProvider
implements IDiagramDocumentProvider

An implementation of IDiagramDocumentProvider that connects a org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramEditorInput and a IDiagramDocument.


Nested Class Summary
protected  class DiagramInputDocumentProvider.DiagramResourceInfo
          Bundle of all required information to allow IStorage as underlying document resources.
 
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.document. AbstractDocumentProvider
PR10806_UC5_ENABLED, PR14469_ENABLED, STATUS_ERROR, STATUS_OK
 
Constructor Summary
DiagramInputDocumentProvider ()
           
 
Method Summary
protected   IDocument createDocument (java.lang.Object element)
          Creates the document for the given element.
protected   AbstractDocumentProvider.ElementInfo createElementInfo (java.lang.Object element)
          Creates a new element info object for the given element.
protected   IDocument createEmptyDocument ()
          Factory method for creating empty documents.
  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 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.
protected  void doUpdateStateCache (java.lang.Object element)
          Hook method for updating the state of the given element.
  IDiagramDocument getDiagramDocument (java.lang.Object element)
          Returns the diagram document.
protected   IRunnableContext getOperationRunner ( IProgressMonitor monitor)
          Returns the runnable context for this document provider.
protected  void handleCoreException ( CoreException exception, java.lang.String message)
          Defines the standard procedure to handle CoreExceptions.
 boolean isModifiable (java.lang.Object element)
          Returns whether the document provider thinks that the given element can persistently be modified.
 boolean isReadOnly (java.lang.Object element)
          Returns whether the document provider thinks that the given element is read-only.
protected  boolean setDocumentContent ( IDocument document, IEditorInput editorInput)
          Initializes the given document from the given editor input using the given character encoding.
protected  void setupDocument (java.lang.Object element, IDocument document)
          Sets up the given document as it would be provided for the given element.
protected  void updateCache (IDiagramEditorInput input)
          Updates the internal cache for the given input.
 
Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.resources.editor.document. AbstractDocumentProvider
aboutToChange, addElementStateListener, addUnchangedElementListeners, canSaveDocument, changed, connect, connected, disconnect, disconnected, doResetDocument, doSynchronize, doValidateState, executeOperation, fireElementContentAboutToBeReplaced, fireElementContentReplaced, fireElementDeleted, fireElementDirtyStateChanged, fireElementMoved, fireElementStateChangeFailed, fireElementStateChanging, fireElementStateValidationChanged, getConnectedElements, getDocument, getElementInfo, getModificationStamp, getProgressMonitor, getResetOperation, getResetRule, getSaveOperation, getSaveRule, getStatus, getSynchronizationStamp, getSynchronizeRule, getValidateStateRule, invalidatesState, isDeleted, isStateValidated, isSynchronized, 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

DiagramInputDocumentProvider

public DiagramInputDocumentProvider()
Method Detail

createDocument

protected 
IDocument createDocument(java.lang.Object element)
                            throws 
CoreException
Description copied from class: AbstractDocumentProvider
Creates the document for the given element.

Subclasses must implement this method.

Specified by:
createDocument in class AbstractDocumentProvider
Parameters:
element - the element
Returns:
the document
Throws:
CoreException - if the document could not be created

setupDocument

protected void setupDocument(java.lang.Object element,
                             
IDocument document)
Sets up the given document as it would be provided for the given element. The content of the document is not changed. This default implementation is empty. Subclasses may reimplement.

Parameters:
element - the blue-print element
document - the document to set up

createEmptyDocument

protected 
IDocument createEmptyDocument()
Factory method for creating empty documents.

Specified by:
createEmptyDocument in class AbstractDocumentProvider
Returns:
the newly created document

createElementInfo

protected 
AbstractDocumentProvider.ElementInfo createElementInfo(java.lang.Object element)
                                                          throws 
CoreException
Description copied from class: AbstractDocumentProvider
Creates a new element info object for the given element.

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.

Overrides:
createElementInfo in class AbstractDocumentProvider
Parameters:
element - the element
Returns:
a new element info object
Throws:
CoreException - if the document or annotation model could not be created

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 AbstractDocumentProvider
Parameters:
element - the element
info - the element info object

setDocumentContent

protected boolean setDocumentContent(
IDocument document,
                                     
IEditorInput editorInput)
                              throws 
CoreException
Initializes the given document from the given editor input using the given character encoding.

Parameters:
document - the document to be initialized
editorInput - the input from which to derive the content of the document
encoding - the character encoding used to read the editor input
Returns:
true if the document content could be set, false otherwise
Throws:
CoreException - if the given editor input cannot be accessed

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.

Specified by:
doSaveDocument in class AbstractDocumentProvider
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

handleCoreException

protected void handleCoreException(
CoreException exception,
                                   java.lang.String message)
Defines the standard procedure to handle CoreExceptions. Exceptions are written to the plug-in log.

Parameters:
exception - the exception to be logged
message - the message to be logged

updateCache

protected void updateCache(IDiagramEditorInput input)
                    throws 
CoreException
Updates the internal cache for the given input.

Parameters:
input - the input whose cache will be updated
Throws:
CoreException - if the storage cannot be retrieved from the input

isReadOnly

public boolean isReadOnly(java.lang.Object element)
Description copied from interface: IDocumentProvider
Returns whether the document provider thinks that the given element is read-only. If this method returns true, saveDocument could fail. This method does not say anything about the document constructed from the given element. If the given element is not connected to this document provider, the return value 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.

Specified by:
isReadOnly in interface IDocumentProvider
Overrides:
isReadOnly in class AbstractDocumentProvider
Parameters:
element - the element
Returns:
true if the given element is read-only, false otherwise

isModifiable

public boolean isModifiable(java.lang.Object element)
Description copied from interface: IDocumentProvider
Returns whether the document provider thinks that the given element can persistently be modified. This is orthogonal to isReadOnly 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.

Specified by:
isModifiable in interface IDocumentProvider
Overrides:
isModifiable in class AbstractDocumentProvider
Parameters:
element - the element
Returns:
true if the given element is modifiable, false otherwise

doUpdateStateCache

protected void doUpdateStateCache(java.lang.Object element)
                           throws 
CoreException
Description copied from class: AbstractDocumentProvider
Hook method for updating the state of the given element. Default implementation is empty.

Overrides:
doUpdateStateCache in class AbstractDocumentProvider
Parameters:
element - the element
Throws:
CoreException - in case state cache updating fails

getOperationRunner

protected 
IRunnableContext getOperationRunner(
IProgressMonitor monitor)
Description copied from class: AbstractDocumentProvider
Returns the runnable context for this document provider.

Specified by:
getOperationRunner in class AbstractDocumentProvider
Parameters:
monitor - a progress monitor to track the operation
Returns:
the runnable context for this document provider

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)

createInputWithEditingDomain

public 
IEditorInput createInputWithEditingDomain(
IEditorInput editorInput,
                                                 org.eclipse.emf.transaction.TransactionalEditingDomain domain)
Specified by:
createInputWithEditingDomain in interface IDiagramDocumentProvider

Runtime

Guidelines for using Eclipse APIs.

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


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire