Package org.eclipse.jdt.core
Class BufferChangedEvent
- java.lang.Object
-
- java.util.EventObject
-
- org.eclipse.jdt.core.BufferChangedEvent
-
- All Implemented Interfaces:
Serializable
public class BufferChangedEvent extends EventObject
A buffer changed event describes how a buffer has changed. These events are used inIBufferChangedListenernotifications.For text insertions,
getOffsetis the offset of the first inserted character,getTextis the inserted text, andgetLengthis 0.For text removals,
getOffsetis the offset of the first removed character,getTextisnull, andgetLengthis the length of the text that was removed.For replacements (including
IBuffer.setContents),getOffsetis the offset of the first replaced character,getTextis the replacement text, andgetLengthis the length of the original text that was replaced.When a buffer is closed,
getOffsetis 0,getLengthis 0, andgetTextisnull.- See Also:
IBuffer, Serialized Form- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Field Summary
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor Description BufferChangedEvent(IBuffer buffer, int offset, int length, String text)Creates a new buffer changed event indicating that the given buffer has changed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IBuffergetBuffer()Returns the buffer which has changed.intgetLength()Returns the length of text removed or replaced in the buffer, or 0 if text has been inserted into the buffer.intgetOffset()Returns the index of the first character inserted, removed, or replaced in the buffer.StringgetText()Returns the text that was inserted, the replacement text, ornullif text has been removed.-
Methods inherited from class java.util.EventObject
getSource, toString
-
-
-
-
Method Detail
-
getBuffer
public IBuffer getBuffer()
Returns the buffer which has changed.- Returns:
- the buffer affected by the change
-
getLength
public int getLength()
Returns the length of text removed or replaced in the buffer, or 0 if text has been inserted into the buffer.- Returns:
- the length of the original text fragment modified by the
buffer change (
0in case of insertion).
-
getOffset
public int getOffset()
Returns the index of the first character inserted, removed, or replaced in the buffer.- Returns:
- the source offset of the textual manipulation in the buffer
-
getText
public String getText()
Returns the text that was inserted, the replacement text, ornullif text has been removed.- Returns:
- the text corresponding to the buffer change (
nullin case of deletion).
-
-