|
Eclipse Platform 2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jface.text.AbstractDocument | +--org.eclipse.jface.text.ChildDocument
A child document is one particular example of a slave document. Child documents
are created by the ChildDocumentManager
, an implementation of
ISlaveDocumentManager
.
A child document represents one consequetive range of its master document.
The master document is called parent document. The child document is always in sync
with its parent document by utilizing the parent document as its ITextStore
.
This class is for internal use only.
ITextStore
Inner classes inherited from class org.eclipse.jface.text.IDocumentExtension |
IDocumentExtension.IReplace |
Fields inherited from interface org.eclipse.jface.text.IDocument |
DEFAULT_CATEGORY, DEFAULT_CONTENT_TYPE |
Constructor Summary | |
ChildDocument(IDocument parentDocument,
Position range)
Creates a child document for the given range of the given parent document. |
Method Summary | |
protected void |
fireDocumentAboutToBeChanged(DocumentEvent event)
Fires the given document event to all registers document listeners informing them about the forthcoming document manipulation. |
protected void |
fireDocumentChanged(DocumentEvent event)
Ignores the given event and sends the similar child document event instead. |
IDocument |
getParentDocument()
Returns parent document |
Position |
getParentDocumentRange()
Returns the range of the parent document covered by this child document. |
boolean |
isAutoExpandEvent(DocumentEvent event)
Returns whether the given document might cause this document to auto expand. |
DocumentEvent |
normalize(DocumentEvent event)
Transforms a document event of the parent document into a child document based document event. |
void |
parentDocumentAboutToBeChanged(DocumentEvent event)
When called this child document is informed about a forthcoming change of its parent document. |
void |
parentDocumentChanged(DocumentEvent event)
When called this child document is informed about a change of its parent document. |
void |
registerPostNotificationReplace(IDocumentListener owner,
IDocumentExtension.IReplace replace)
Callback for document listeners to be used inside documentChanged
to register a post notification replace operation on the document notifying them. |
void |
replace(int offset,
int length,
String text)
Subsitutes the given text for the specified document range. |
void |
set(String text)
Replaces the content of the document with the given text. |
void |
setAutoExpandMode(boolean autoExpand)
Sets the auto expand mode of this document. |
void |
setParentDocumentRange(int offset,
int length)
Sets the child document's parent document range. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ChildDocument(IDocument parentDocument, Position range)
parentDocument
- the parent Documentrange
- the parent document range covered by the child documentMethod Detail |
public void setParentDocumentRange(int offset, int length) throws BadLocationException
offset
- the offset of the parent document rangelength
- the length of the parent document rangepublic IDocument getParentDocument()
public Position getParentDocumentRange()
public DocumentEvent normalize(DocumentEvent event)
Transforms a document event of the parent document into a child document based document event. This method considers whether the document is in auto expand mode.
This method is public for test purposes only.e
- the parent document eventpublic void parentDocumentAboutToBeChanged(DocumentEvent event)
event
- the parent document eventpublic void parentDocumentChanged(DocumentEvent event)
event
- the parent document eventprotected void fireDocumentAboutToBeChanged(DocumentEvent event)
AbstractDocument
fireDocumentAboutToBeChanged
in class AbstractDocument
org.eclipse.jface.text.AbstractDocument
event
- the event to be sent outprotected void fireDocumentChanged(DocumentEvent event)
fireDocumentChanged
in class AbstractDocument
event
- the event to be ignoredpublic void replace(int offset, int length, String text) throws BadLocationException
IDocument
DocumentEvent
to all registered IDocumentListener
.replace
in class AbstractDocument
org.eclipse.jface.text.IDocument
offset
- the document offsetlength
- the length of the specified rangetext
- the substitution textBadLocationException
- if the offset is invalid in this documentDocumentEvent
,
IDocumentListener
public void set(String text)
IDocument
DocumentEvent
to all registered IDocumentListener
.
This method is a convenience method for
replace(0, getLength(), text)
.set
in class AbstractDocument
org.eclipse.jface.text.IDocument
text
- the new content of the documentDocumentEvent
,
IDocumentListener
public void registerPostNotificationReplace(IDocumentListener owner, IDocumentExtension.IReplace replace)
IDocumentExtension
documentChanged
to register a post notification replace operation on the document notifying them.registerPostNotificationReplace
in class AbstractDocument
org.eclipse.jface.text.IDocumentExtension
owner
- the owner of the replace operationthe
- replace operation to be executedUnsupportedOperationException
- if registerPostNotificationReplace
is not supported by this documentpublic void setAutoExpandMode(boolean autoExpand)
autoExpand
- true
if auto expanding, false
otherwisepublic boolean isAutoExpandEvent(DocumentEvent event)
event
- the document eventtrue
if the given event might cause this document to auto expand
|
Eclipse Platform 2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |