|
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.ProjectionDocument
A ProjectionDocument
represents a projection of its master document.
The contents of a projection document is a sequence of fragments of the master document, i.e.
the projection document can be thought as being constructed from the master document by
not copying the whole master document by omitting serveral ranges of the master document.
The projection document utilizes its master document as ITextStore
.
This class if for internal use only.
Inner classes inherited from class org.eclipse.jface.text.IDocumentExtension |
IDocumentExtension.IReplace |
Field Summary | |
static String |
FRAGMENT_CATEGORY
The position category used by ProjectionDocument s to manage the fragments they consist of. |
Fields inherited from interface org.eclipse.jface.text.IDocument |
DEFAULT_CATEGORY, DEFAULT_CONTENT_TYPE |
Constructor Summary | |
ProjectionDocument(IDocument parentDocument,
String projectionCategory)
Creates a projection document for the given parent document. |
Method Summary | |
void |
addFragment(int offsetInParent,
int lengthInParent)
Add a new fragment of the parent document to this projection document. |
IRegion |
computeParentDocumentRegion(int offset,
int length)
Computes and returns the region of the parent document that corresponds to the given region of the projection document. |
Position |
computeProjectionDocumentPosition(int offsetInParent,
int lengthInParent)
Creates a position describing the projection document range corresponding to the given parent document range. |
Fragment |
createFragment(Position parentPosition)
Creates a fragment from a postion of the parent document. |
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 semantically equal slave document event instead. |
Position[] |
getAffectedFragments(int offsetInParent,
int lengthInParent)
Returns the list of fragments whose corresponding ranges in the parent document overlap with the specifed range of the parent document. |
Position[] |
getFragmentation()
Returns the list of all fragments of this projection document. |
protected Fragment |
getFragmentOfOffset(int offset)
Returns the fragment that contains the given offset. |
protected Fragment[] |
getFragmentsOfRange(int offset,
int length)
Returns the minimal consecutive list of fragments that completely covers the given range. |
IDocument |
getParentDocument()
Returns parent document. |
Position |
getParentDocumentCoverage()
Returns the minimal range of the parent document that covers all ranges that correspond to the fragments of this projection document. |
Position[] |
getProjection()
Returns the ranges of the parent document that correspond to the fragments of this projection document. |
void |
hide(int offsetInParent,
int lengthInParent)
Convenience method for removing and adapting the fragments whose corresponding ranges in the parent document are included or overlap with the given range of the parent document. |
void |
joinFragments()
Joins all fragments that represent neighboring regions in the parent document. |
void |
parentDocumentAboutToBeChanged(DocumentEvent event)
When called, this projection document is informed about a forthcoming change of its parent document. |
void |
parentDocumentChanged(DocumentEvent event)
When called, this projection 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 |
removeAllFragments()
Removes all fragments and thereby clears this projection document. |
void |
removeFragment(Position parentPosition)
Removes the fragment that corresponds to the given parent document range. |
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 |
show(int offsetInParent,
int lengthInParent)
Convenience method for adding fragments or adapting existing fragments so that their corresponding ranges in the parent document include the given range of the parent document. |
int |
toParentDocumentOffset(int offset)
Returns the offset in the parent document that corresponds to the given offset in this projection document. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String FRAGMENT_CATEGORY
ProjectionDocument
s to manage the fragments they consist of.Constructor Detail |
public ProjectionDocument(IDocument parentDocument, String projectionCategory)
parentDocument
- the parent DocumentprojectionCategory
- the document position category whose positions define the projection of the parent documentMethod Detail |
public Fragment createFragment(Position parentPosition)
parentPosition
- a position of the parent documentpublic Position computeProjectionDocumentPosition(int offsetInParent, int lengthInParent)
offsetInParent
- the parent document offsetlengthInParent
- the parent document lenghpublic int toParentDocumentOffset(int offset) throws BadLocationException
offset
- the offset in the projection documentBadLocationException
- if offset
is not valid in this projection documentpublic IRegion computeParentDocumentRegion(int offset, int length) throws BadLocationException
offset
- the offset of the projection document regionlength
- the length of the projection document regionBadLocationException
- if the given projection document region is not validpublic void removeAllFragments()
public void addFragment(int offsetInParent, int lengthInParent) throws BadLocationException
offsetInParent
- offset of the parent document rangelengthInParent
- length of the parent document rangeBadLocationException
- public void joinFragments()
public void removeFragment(Position parentPosition) throws BadLocationException
parentPosition
- the position representing the parent document rangeBadLocationException
- if the fragment position category is not defined in this projection documentpublic Position[] getAffectedFragments(int offsetInParent, int lengthInParent)
offsetInParent
- the offset of the parent document rangelengthInParent
- the length of the parent document rangeprotected Fragment getFragmentOfOffset(int offset) throws BadLocationException
offset
- the offsetBadLocationException
- if offset
is not a valid offsetprotected Fragment[] getFragmentsOfRange(int offset, int length)
offset
- the offset of the rangelength
- the length of the rangepublic Position getParentDocumentCoverage()
public IDocument getParentDocument()
public Position[] getProjection()
public Position[] getFragmentation()
public 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 hide(int offsetInParent, int lengthInParent)
offsetInParent
- the offset of the parent document rangelengthInParent
- the length of the parent document rangepublic void show(int offsetInParent, int lengthInParent)
offsetInParent
- the offset of the parent document rangelengthInParent
- the length of the parent document range
|
Eclipse Platform 2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |