Eclipse Platform
Release 3.0

org.eclipse.jface.text.projection
Class ProjectionDocumentEvent

java.lang.Object
  extended byorg.eclipse.jface.text.DocumentEvent
      extended byorg.eclipse.jface.text.SlaveDocumentEvent
          extended byorg.eclipse.jface.text.projection.ProjectionDocumentEvent

public class ProjectionDocumentEvent
extends SlaveDocumentEvent

This event is sent out by an ProjectionDocumentwhen 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 (see getChangeType()) and comparing it with the predefined types PROJECTION_CHANGEand CONTENT_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

Field Summary
static Object CONTENT_CHANGE
          The change type indicating a content change
static Object PROJECTION_CHANGE
          The change type indicating a projection change
 
Fields inherited from class org.eclipse.jface.text.DocumentEvent
fDocument, fLength, fOffset, fText
 
Constructor Summary
ProjectionDocumentEvent(IDocument doc, int offset, int length, String text, DocumentEvent masterEvent)
          Creates a new content change event caused by the given master document change.
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.
 
Method Summary
 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, getOffset, getText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROJECTION_CHANGE

public static final Object PROJECTION_CHANGE
The change type indicating a projection change


CONTENT_CHANGE

public static final Object CONTENT_CHANGE
The change type indicating a content change

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 calling getMasterOffset or getMasterLength. This information can be obtained by accessing the master event.

Parameters:
doc - the changed projection document
offset - the offset in the projection document
length - the length in the projection document
text - the replacement text
masterEvent - 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 document
offset - the offset in the projection document
length - the length in the projection document
text - the replacement text
masterOffset - the offset in the master document
masterLength - 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 document
offset - the offset in the projection document
length - the length in the projection document
text - the replacement text
masterOffset - the offset in the master document
masterLength - the length in the master document
masterEvent - the master document event
Method Detail

getChangeType

public Object getChangeType()
Returns the change type of this event. This is either PROJECTION_CHANGE or CONTENT_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

Eclipse Platform
Release 3.0

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.