Class ProjectionDocumentEvent
- java.lang.Object
-
- org.eclipse.jface.text.DocumentEvent
-
- org.eclipse.jface.text.SlaveDocumentEvent
-
- org.eclipse.jface.text.projection.ProjectionDocumentEvent
-
public class ProjectionDocumentEvent extends SlaveDocumentEvent
This event is sent out by anProjectionDocument
when it is manipulated. The manipulation is either a content manipulation or a change of the projection between the master and the slave. Clients can determine the type of change by asking the projection document event for its change type (seegetChangeType()
) and comparing it with the predefined typesPROJECTION_CHANGE
andCONTENT_CHANGE
.Clients are not supposed to create instances of this class. Instances are created by
ProjectionDocument
instances. This class is not intended to be subclassed.- Since:
- 3.0
- Restriction:
- This class is not intended to be subclassed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static Object
CONTENT_CHANGE
The change type indicating a content changestatic Object
PROJECTION_CHANGE
The change type indicating a projection change-
Fields inherited from class org.eclipse.jface.text.DocumentEvent
fDocument, fLength, fModificationStamp, fOffset, fText
-
-
Constructor Summary
Constructors Constructor Description ProjectionDocumentEvent(IDocument doc, int offset, int length, String text, int masterOffset, int masterLength)
Creates a new projection change event for the given properties.ProjectionDocumentEvent(IDocument doc, int offset, int length, String text, int masterOffset, int masterLength, DocumentEvent masterEvent)
Creates a new projection document event for the given properties.ProjectionDocumentEvent(IDocument doc, int offset, int length, String text, DocumentEvent masterEvent)
Creates a new content change event caused by the given master document change.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getChangeType()
Returns the change type of this event.int
getMasterLength()
Returns the length of the master document range that has been added or removed in case this event describes a projection changed, otherwise-1
.int
getMasterOffset()
Returns the offset of the master document range that has been added or removed in case this event describes a projection change, otherwise it returns-1
.-
Methods inherited from class org.eclipse.jface.text.SlaveDocumentEvent
getMasterEvent
-
Methods inherited from class org.eclipse.jface.text.DocumentEvent
getDocument, getLength, getModificationStamp, getOffset, getText, toString
-
-
-
-
Constructor Detail
-
ProjectionDocumentEvent
public ProjectionDocumentEvent(IDocument doc, int offset, int length, String text, DocumentEvent masterEvent)
Creates a new content change event caused by the given master document change. Instances created using this constructor return-1
when callinggetMasterOffset
orgetMasterLength
. This information can be obtained by accessing the master event.- Parameters:
doc
- the changed projection documentoffset
- the offset in the projection documentlength
- the length in the projection documenttext
- the replacement textmasterEvent
- the original master event
-
ProjectionDocumentEvent
public ProjectionDocumentEvent(IDocument doc, int offset, int length, String text, int masterOffset, int masterLength)
Creates a new projection change event for the given properties. Instances created with this constructor return the given master document offset and length but do not have an associated master document event.- Parameters:
doc
- the projection documentoffset
- the offset in the projection documentlength
- the length in the projection documenttext
- the replacement textmasterOffset
- the offset in the master documentmasterLength
- the length in the master document
-
ProjectionDocumentEvent
public ProjectionDocumentEvent(IDocument doc, int offset, int length, String text, int masterOffset, int masterLength, DocumentEvent masterEvent)
Creates a new projection document event for the given properties. The projection change is caused by a manipulation of the master document. In order to accommodate the master document change, the projection document had to change the projection. Instances created with this constructor return the given master document offset and length and also have an associated master document event.- Parameters:
doc
- the projection documentoffset
- the offset in the projection documentlength
- the length in the projection documenttext
- the replacement textmasterOffset
- the offset in the master documentmasterLength
- the length in the master documentmasterEvent
- the master document event
-
-
Method Detail
-
getChangeType
public Object getChangeType()
Returns the change type of this event. This is eitherPROJECTION_CHANGE
orCONTENT_CHANGE
.- Returns:
- the change type of this event
-
getMasterOffset
public int getMasterOffset()
Returns the offset of the master document range that has been added or removed in case this event describes a projection change, otherwise it returns-1
.- Returns:
- the master document offset of the projection change or
-1
-
getMasterLength
public int getMasterLength()
Returns the length of the master document range that has been added or removed in case this event describes a projection changed, otherwise-1
.- Returns:
- the master document length of the projection change or
-1
-
-