|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.text.AbstractDocument
org.eclipse.jface.text.projection.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
but omitting several ranges of the master document.
The projection document indirectly utilizes its master document as
ITextStore
by means of a ProjectionTextStore
.
The content of a projection document can be changed in two ways. Either by a
text replace applied to the master document or the projection document. Or by
changing the projection between the master document and the projection
document. For the latter the two methods addMasterDocumentRange
and removeMasterDocumentRange
are provided. For any
manipulation, the projection document sends out a
ProjectionDocumentEvent
describing
the change.
Clients are not supposed to directly instantiate this class. In order to
obtain a projection document, a
ProjectionDocumentManager
should be
used. This class is not intended to be subclassed outside of its origin
package.
Nested Class Summary |
---|
Nested classes inherited from class org.eclipse.jface.text.IDocumentExtension |
---|
IDocumentExtension.IReplace |
Field Summary |
---|
Fields inherited from interface org.eclipse.jface.text.IDocument |
---|
DEFAULT_CATEGORY, DEFAULT_CONTENT_TYPE |
Fields inherited from interface org.eclipse.jface.text.IDocumentExtension3 |
---|
DEFAULT_PARTITIONING |
Fields inherited from interface org.eclipse.jface.text.IDocumentExtension4 |
---|
UNKNOWN_MODIFICATION_STAMP |
Constructor Summary | |
---|---|
ProjectionDocument(IDocument masterDocument)
Creates a projection document for the given master document. |
Method Summary | |
---|---|
protected boolean |
adaptProjectionToMasterChange(DocumentEvent masterEvent)
Ensures that when the master event effects this projection document, that the whole region described by the event is part of this projection document. |
void |
addMasterDocumentRange(int offsetInMaster,
int lengthInMaster)
Ensures that the given range of the master document is part of this projection document. |
IRegion[] |
computeProjectedMasterRegions(int offsetInMaster,
int lengthInMaster)
Returns the sequence of all master document regions with are contained in the given master document range and which are part of this projection document. |
IRegion[] |
computeUnprojectedMasterRegions(int offsetInMaster,
int lengthInMaster)
Returns the sequence of all master document regions which are contained in the given master document range and which are not yet part of this projection document. |
void |
dispose()
Disposes this projection 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. |
String |
getDefaultLineDelimiter()
Returns this document's default line delimiter. |
protected Position[] |
getFragments()
Returns the fragments of the master documents. |
IDocument |
getMasterDocument()
Returns the master document of this projection document. |
ProjectionMapping |
getProjectionMapping()
Returns the projection mapping used by this document. |
protected Position[] |
getSegments()
Returns the segments of this projection document. |
protected boolean |
isUpdating()
Returns whether this project is being updated. |
void |
masterDocumentAboutToBeChanged(DocumentEvent masterEvent)
When called, this projection document is informed about a forthcoming change of its master document. |
void |
masterDocumentChanged(DocumentEvent masterEvent)
When called, this projection document is informed about a change of its master 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 |
removeMasterDocumentRange(int offsetInMaster,
int lengthInMaster)
Ensures that the given range of the master document is not part of this projection document. |
void |
replace(int offset,
int length,
String text)
Substitutes the given text for the specified document range. |
void |
replaceMasterDocumentRanges(int offsetInMaster,
int lengthInMaster)
Replaces all master document ranges with the given master document range. |
void |
set(String text)
Replaces the content of the document with the given text. |
void |
setAutoExpandMode(boolean autoExpandMode)
Sets the auto expand mode for this document. |
protected void |
updateDocumentStructures(DocumentEvent event)
Updates document partitioning and document positions according to the specification given by the document event. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ProjectionDocument(IDocument masterDocument)
masterDocument
- the master documentMethod Detail |
public void dispose()
protected final Position[] getFragments()
protected final Position[] getSegments()
public ProjectionMapping getProjectionMapping()
public IDocument getMasterDocument()
public String getDefaultLineDelimiter()
IDocumentExtension4
This default line delimiter should be used by clients who want unique delimiters (e.g. 'CR's) in the document.
getDefaultLineDelimiter
in interface IDocumentExtension4
getDefaultLineDelimiter
in class AbstractDocument
public final IRegion[] computeUnprojectedMasterRegions(int offsetInMaster, int lengthInMaster) throws BadLocationException
offsetInMaster
- the range offset in the master documentlengthInMaster
- the range length in the master document
BadLocationException
- in case the given range is invalid in the
master documentpublic void addMasterDocumentRange(int offsetInMaster, int lengthInMaster) throws BadLocationException
offsetInMaster
- the offset of the master document rangelengthInMaster
- the length of the master document range
BadLocationException
- in case the master event is not validpublic void removeMasterDocumentRange(int offsetInMaster, int lengthInMaster) throws BadLocationException
offsetInMaster
- the offset of the master document rangelengthInMaster
- the length of the master document range
BadLocationException
- in case the master event is not validpublic final IRegion[] computeProjectedMasterRegions(int offsetInMaster, int lengthInMaster) throws BadLocationException
null
if no such
regions exist.
offsetInMaster
- the range offset in the master documentlengthInMaster
- the range length in the master document
null
BadLocationException
- in case the given range is invalid in the master documentprotected boolean isUpdating()
true
if the document is updatingpublic void replace(int offset, int length, String text) throws BadLocationException
IDocument
DocumentEvent
to all registered IDocumentListener
.
replace
in interface IDocument
replace
in class AbstractDocument
BadLocationException
public void set(String text)
IDocument
DocumentEvent
to all registered IDocumentListener
.
This method is a convenience method for replace(0, getLength(), text)
.
set
in interface IDocument
set
in class AbstractDocument
protected final boolean adaptProjectionToMasterChange(DocumentEvent masterEvent) throws BadLocationException
masterEvent
- the master document event
true
if masterEvent affects this projection document
BadLocationException
- in case the master event is not validpublic void masterDocumentAboutToBeChanged(DocumentEvent masterEvent)
masterEvent
- the master document eventpublic void masterDocumentChanged(DocumentEvent masterEvent)
masterEvent
- the master document eventprotected void fireDocumentAboutToBeChanged(DocumentEvent event)
AbstractDocument
fireDocumentAboutToBeChanged
in class AbstractDocument
event
- the event to be sent outprotected void fireDocumentChanged(DocumentEvent event)
fireDocumentChanged
in class AbstractDocument
event
- the event to be ignoredprotected void updateDocumentStructures(DocumentEvent event)
AbstractDocument
updateDocumentStructures
in class AbstractDocument
event
- the document event describing the change to which structures must be adaptedpublic void registerPostNotificationReplace(IDocumentListener owner, IDocumentExtension.IReplace replace)
IDocumentExtension
documentChanged
to register a post notification replace operation on the document notifying them.
registerPostNotificationReplace
in interface IDocumentExtension
registerPostNotificationReplace
in class AbstractDocument
public void setAutoExpandMode(boolean autoExpandMode)
autoExpandMode
- true
if auto-expandingpublic void replaceMasterDocumentRanges(int offsetInMaster, int lengthInMaster) throws BadLocationException
offsetInMaster
- the offset in the master documentlengthInMaster
- the length in the master document
BadLocationException
- if the given range of the master document is not valid
|
Eclipse Platform Release 3.1 |
|||||||||||
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. and others 2000, 2005. All rights reserved.