|
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.document.DiagramInputDocumentProvider
public class DiagramInputDocumentProvider
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DiagramInputDocumentProvider()
Method Detail |
---|
protected IDocument createDocument(java.lang.Object element) throws CoreException
AbstractDocumentProvider
Subclasses must implement this method.
createDocument
in class AbstractDocumentProvider
element
- the element
CoreException
- if the document could not be createdprotected void setupDocument(java.lang.Object element, IDocument document)
element
- the blue-print elementdocument
- the document to set upprotected IDocument createEmptyDocument()
createEmptyDocument
in class AbstractDocumentProvider
protected AbstractDocumentProvider.ElementInfo createElementInfo(java.lang.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 AbstractDocumentProvider
element
- the element
CoreException
- if the document or annotation model could not be createdprotected 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 AbstractDocumentProvider
element
- the elementinfo
- the element info objectprotected boolean setDocumentContent(IDocument document, IEditorInput editorInput) throws CoreException
document
- the document to be initializededitorInput
- the input from which to derive the content of the documentencoding
- the character encoding used to read the editor input
true
if the document content could be set, false
otherwise
CoreException
- if the given editor input cannot be accessedprotected void doSaveDocument(IProgressMonitor monitor, java.lang.Object element, IDocument document, boolean overwrite) throws CoreException
AbstractDocumentProvider
Subclasses must implement this method.
doSaveDocument
in class AbstractDocumentProvider
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 void handleCoreException(CoreException exception, java.lang.String message)
CoreExceptions
. Exceptions
are written to the plug-in log.
exception
- the exception to be loggedmessage
- the message to be loggedprotected void updateCache(IDiagramEditorInput input) throws CoreException
input
- the input whose cache will be updated
CoreException
- if the storage cannot be retrieved from the inputpublic boolean isReadOnly(java.lang.Object element)
IDocumentProvider
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.
isReadOnly
in interface IDocumentProvider
isReadOnly
in class AbstractDocumentProvider
element
- the element
true
if the given element is read-only, false
otherwisepublic boolean isModifiable(java.lang.Object element)
IDocumentProvider
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.
isModifiable
in interface IDocumentProvider
isModifiable
in class AbstractDocumentProvider
element
- the element
true
if the given element is modifiable, false
otherwiseprotected void doUpdateStateCache(java.lang.Object element) throws CoreException
AbstractDocumentProvider
doUpdateStateCache
in class AbstractDocumentProvider
element
- the element
CoreException
- in case state cache updating failsprotected IRunnableContext getOperationRunner(IProgressMonitor monitor)
AbstractDocumentProvider
getOperationRunner
in class AbstractDocumentProvider
monitor
- a progress monitor to track the operation
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)
public IEditorInput createInputWithEditingDomain(IEditorInput editorInput, org.eclipse.emf.transaction.TransactionalEditingDomain domain)
createInputWithEditingDomain
in interface IDiagramDocumentProvider
|
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.