org.eclipse.gmf.runtime.diagram.ui.resources.editor.document
Class AbstractDocument
java.lang.Object
org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocument
-
All Implemented Interfaces:
-
IDocument
-
Direct Known Subclasses:
-
DiagramDocument
-
public abstract class AbstractDocument
- extends java.lang.Object
- implements
IDocument
Abstract implementation of IDocument
. This class
provides implementation for registering IDocumentListener
s.
Additionally it also handles firing of DocumentEvent
to
the document listeners.
Field Summary
|
protected java.lang.Object
|
content
Content of this document. |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
content
protected java.lang.Object content
- Content of this document.
AbstractDocument
public AbstractDocument()
getModificationStamp
public long getModificationStamp()
-
Description copied from interface:
IDocument
- Returns the modification stamp of this document. The modification stamp
is updated each time a modifying operation is called on this document. If
two modification stamps of the same document are identical then the document
content is too, however, same content does not imply same modification stamp.
The magnitude or sign of the numerical difference between two modification stamps
is not significant.
-
-
Specified by:
-
getModificationStamp
in interface
IDocument
-
-
Returns:
- the modification stamp of this document or
UNKNOWN_MODIFICATION_STAMP
-
See Also:
-
org.eclipse.gmf.runtime.diagram.ui.editor.IDocument#getModificationStamp()
completeInitialization
protected void completeInitialization()
- Initializes document listeners, positions, and position updaters.
Must be called inside the constructor after the implementation plug-ins
have been set.
-
-
addDocumentListener
public void addDocumentListener(
IDocumentListener listener)
-
Description copied from interface:
IDocument
- Registers the document listener with the document. After registration
the IDocumentListener is informed about each change of this document.
If the listener is already registered nothing happens.
An IDocumentListener
may call back to this method
when being inside a document notification.
-
-
Specified by:
-
addDocumentListener
in interface
IDocument
-
-
Parameters:
-
listener
- the listener to be registered -
See Also:
-
org.eclipse.gmf.runtime.diagram.ui.editor.IDocument#addDocumentListener(org.eclipse.gmf.runtime.diagram.ui.editor.IDocumentListener)
removeDocumentListener
public void removeDocumentListener(
IDocumentListener listener)
-
Description copied from interface:
IDocument
- Removes the listener from the document's list of document listeners.
If the listener is not registered with the document nothing happens.
An IDocumentListener
may call back to this method
when being inside a document notification.
-
-
Specified by:
-
removeDocumentListener
in interface
IDocument
-
-
Parameters:
-
listener
- the listener to be removed -
See Also:
-
org.eclipse.gmf.runtime.diagram.ui.editor.IDocument#removeDocumentListener(org.eclipse.gmf.runtime.diagram.ui.editor.IDocumentListener)
addPrenotifiedDocumentListener
public void addPrenotifiedDocumentListener(
IDocumentListener listener)
-
Description copied from interface:
IDocument
- Adds the given document listener as one which is notified before
those document listeners added with
addDocumentListener
are notified. If the given listener is also registered using
addDocumentListener
it will be notified twice.
If the listener is already registered nothing happens.
This method is not for public use.
-
-
Specified by:
-
addPrenotifiedDocumentListener
in interface
IDocument
-
-
Parameters:
-
listener
- the listener to be added as pre-notified document listener -
See Also:
-
org.eclipse.gmf.runtime.diagram.ui.editor.IDocument#addPrenotifiedDocumentListener(org.eclipse.gmf.runtime.diagram.ui.editor.IDocumentListener)
removePrenotifiedDocumentListener
public void removePrenotifiedDocumentListener(
IDocumentListener listener)
-
Description copied from interface:
IDocument
- Removes the given document listener from the document's list of
pre-notified document listeners. If the listener is not registered
with the document nothing happens.
This method is not for public use.
-
-
Specified by:
-
removePrenotifiedDocumentListener
in interface
IDocument
-
-
Parameters:
-
listener
- the listener to be removed -
See Also:
-
org.eclipse.gmf.runtime.diagram.ui.editor.IDocument#removePrenotifiedDocumentListener(org.eclipse.gmf.runtime.diagram.ui.editor.IDocumentListener)
getContent
public java.lang.Object getContent()
-
Description copied from interface:
IDocument
- Returns this document's contents.
-
-
Specified by:
-
getContent
in interface
IDocument
-
-
Returns:
- the document's contents
-
See Also:
-
org.eclipse.gmf.runtime.diagram.ui.editor.IDocument#getContent()
setContent
public void setContent(java.lang.Object documentContent)
-
Description copied from interface:
IDocument
- Replaces the content of the document with the given content.
Sends a
DocumentEvent
to all registered IDocumentListener
.
-
-
Specified by:
-
setContent
in interface
IDocument
-
-
Parameters:
-
documentContent
- the new content of the document -
See Also:
-
org.eclipse.gmf.runtime.diagram.ui.editor.IDocument#setContent(java.lang.Object)
setContent
public void setContent(java.lang.Object documentContent,
long modificationStamp)
-
Description copied from interface:
IDocument
- Replaces the content of the document with the given text.
Sends a
DocumentEvent
to all registered IDocumentListener
.
-
-
Specified by:
-
setContent
in interface
IDocument
-
-
Parameters:
-
documentContent
- the new content of the document -
modificationStamp
- of the document after setting the content -
See Also:
-
org.eclipse.gmf.runtime.diagram.ui.editor.IDocument#setContent(java.lang.Object, long)
fireDocumentAboutToBeChanged
protected void fireDocumentAboutToBeChanged(
DocumentEvent event)
- Fires the given document event to all registers document listeners informing them
about the forthcoming document manipulation. Uses a robust iterator.
-
-
-
Parameters:
-
event
- the event to be sent out
fireDocumentChanged
protected void fireDocumentChanged(
DocumentEvent event)
- Updates the internal document structures and informs all document listeners
if listener notification has been enabled. Otherwise it remembers the event
to be sent to the listeners on resume.
-
-
-
Parameters:
-
event
- the document event to be sent out
doFireDocumentChanged
protected void doFireDocumentChanged(
DocumentEvent event)
- Notifies all listeners about the given document change. Uses a robust
iterator.
Executes all registered post notification replace operation.
This method will be renamed to doFireDocumentChanged
.
-
-
-
Parameters:
-
event
- the event to be sent out
resumeListenerNotification
public void resumeListenerNotification()
-
Description copied from interface:
IDocument
- Resumes the notification of document listeners which must previously
have been stopped by a call to
stopListenerNotification
.
-
-
Specified by:
-
resumeListenerNotification
in interface
IDocument
-
-
See Also:
-
org.eclipse.gmf.runtime.diagram.ui.editor.IDocument#resumeListenerNotification()
stopListenerNotification
public void stopListenerNotification()
-
Description copied from interface:
IDocument
- The affect of these calls is that no document listener is notified
until
resumeListenerNotification
is called. This allows clients
to update structure before any listener is informed about the change.
Listener notification can only be stopped for a single replace
operation.
Otherwise, document change notifications will be lost.
-
-
Specified by:
-
stopListenerNotification
in interface
IDocument
-
-
See Also:
-
org.eclipse.gmf.runtime.diagram.ui.editor.IDocument#stopListenerNotification()
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.