org.gjt.sp.jedit.buffer
Interface BufferChangeListener

All Known Implementing Classes:
BufferChangeAdapter

public interface BufferChangeListener

A interface for notification of changes to buffer text. While the BufferUpdate EditBus message is used for general buffer state changes, this interface is used for events which are fired frequently, or for which performance is essential.

Because this interface is subject to change in the future, you should subclass BufferChangeAdapter instead of implementing it directly.

Since:
jEdit 4.0pre1
Version:
$Id: BufferChangeListener.java,v 1.12 2004/03/28 00:07:26 spestov Exp $
Author:
Slava Pestov

Method Summary
 void contentInserted(Buffer buffer, int startLine, int offset, int numLines, int length)
          Called when text is inserted into the buffer.
 void contentRemoved(Buffer buffer, int startLine, int offset, int numLines, int length)
          Called when text is removed from the buffer.
 void foldHandlerChanged(Buffer buffer)
          Called to notify the text area that folds need to be collapsed if the "collapseFolds" property is set.
 void foldLevelChanged(Buffer buffer, int startLine, int endLine)
          Called when line fold levels change.
 void preContentRemoved(Buffer buffer, int startLine, int offset, int numLines, int length)
          Called when text is about to be removed from the buffer, but is still present.
 void transactionComplete(Buffer buffer)
          Called after an undo or compound edit has finished.
 

Method Detail

foldLevelChanged

public void foldLevelChanged(Buffer buffer,
                             int startLine,
                             int endLine)
Called when line fold levels change.

Parameters:
buffer - The buffer in question
startLine - The start line number
endLine - The end line number
Since:
jEdit 4.0pre1

contentInserted

public void contentInserted(Buffer buffer,
                            int startLine,
                            int offset,
                            int numLines,
                            int length)
Called when text is inserted into the buffer.

Parameters:
buffer - The buffer in question
startLine - The first line
offset - The start offset, from the beginning of the buffer
numLines - The number of lines inserted
length - The number of characters inserted
Since:
jEdit 4.0pre1

contentRemoved

public void contentRemoved(Buffer buffer,
                           int startLine,
                           int offset,
                           int numLines,
                           int length)
Called when text is removed from the buffer.

Parameters:
buffer - The buffer in question
startLine - The first line
offset - The start offset, from the beginning of the buffer
numLines - The number of lines removed
length - The number of characters removed
Since:
jEdit 4.0pre1

preContentRemoved

public void preContentRemoved(Buffer buffer,
                              int startLine,
                              int offset,
                              int numLines,
                              int length)
Called when text is about to be removed from the buffer, but is still present.

Parameters:
buffer - The buffer in question
startLine - The first line
offset - The start offset, from the beginning of the buffer
numLines - The number of lines to be removed
length - The number of characters to be removed
Since:
jEdit 4.2pre1

transactionComplete

public void transactionComplete(Buffer buffer)
Called after an undo or compound edit has finished. The text area uses this event to queue up and collapse cleanup operations so they are only run once during a long transaction (such as a "Replace All" operation.)

Parameters:
buffer - The buffer in question
Since:
jEdit 4.0pre6

foldHandlerChanged

public void foldHandlerChanged(Buffer buffer)
Called to notify the text area that folds need to be collapsed if the "collapseFolds" property is set. This method is called after the buffer has been loaded, and also if the user changes the fold handler.

Parameters:
buffer - The buffer in question
Since:
jEdit 4.2pre2