001: /*
002: * BufferListener.java - Buffer listener interface
003: * :tabSize=8:indentSize=8:noTabs=false:
004: * :folding=explicit:collapseFolds=1:
005: *
006: * Copyright (C) 2001, 2005 Slava Pestov
007: *
008: * This program is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU General Public License
010: * as published by the Free Software Foundation; either version 2
011: * of the License, or any later version.
012: *
013: * This program is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: * GNU General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public License
019: * along with this program; if not, write to the Free Software
020: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
021: */
022:
023: package org.gjt.sp.jedit.buffer;
024:
025: /**
026: * A interface for notification of changes to buffer text.<p>
027: *
028: * This interface is new in jEdit 4.3pre3. The text area was made independent
029: * of the rest of jEdit, and thus this class could no longer depend on
030: * <code>org.gjt.sp.jedit.Buffer</code>.<p>
031: *
032: * While the
033: * {@link org.gjt.sp.jedit.msg.BufferUpdate} EditBus message is used for
034: * general buffer state changes, this interface is used for events which are
035: * fired frequently, or for which performance is essential.<p>
036: *
037: * Because this interface is subject to change in the future, you
038: * should subclass <code>BufferAdapter</code> instead of
039: * implementing it directly.
040: *
041: * @author Slava Pestov
042: * @version $Id: BufferListener.java 10708 2007-09-21 19:41:03Z kpouer $
043: * @since jEdit 4.3pre3
044: */
045: public interface BufferListener {
046: //{{{ foldLevelChanged() method
047: /**
048: * Called when line fold levels change.
049: * @param buffer The buffer in question
050: * @param startLine The start line number
051: * @param endLine The end line number
052: * @since jEdit 4.3pre3
053: */
054: void foldLevelChanged(JEditBuffer buffer, int startLine, int endLine);
055:
056: //}}}
057:
058: //{{{ contentInserted() method
059: /**
060: * Called when text is inserted into the buffer.
061: * @param buffer The buffer in question
062: * @param startLine The first line
063: * @param offset The start offset, from the beginning of the buffer
064: * @param numLines The number of lines inserted
065: * @param length The number of characters inserted
066: * @since jEdit 4.3pre3
067: */
068: void contentInserted(JEditBuffer buffer, int startLine, int offset,
069: int numLines, int length);
070:
071: //}}}
072:
073: //{{{ contentRemoved() method
074: /**
075: * Called when text is removed from the buffer.
076: * @param buffer The buffer in question
077: * @param startLine The first line
078: * @param offset The start offset, from the beginning of the buffer
079: * @param numLines The number of lines removed
080: * @param length The number of characters removed
081: * @since jEdit 4.3pre3
082: */
083: void contentRemoved(JEditBuffer buffer, int startLine, int offset,
084: int numLines, int length);
085:
086: //}}}
087:
088: //{{{ preContentInserted() method
089: /**
090: * Called when text is about to be inserted in the buffer.
091: * @param buffer The buffer in question
092: * @param startLine The first line
093: * @param offset The start offset, from the beginning of the buffer
094: * @param numLines The number of lines inserted
095: * @param length The number of characters inserted
096: * @since jEdit 4.3pre11
097: */
098: void preContentInserted(JEditBuffer buffer, int startLine,
099: int offset, int numLines, int length);
100:
101: //}}}
102:
103: //{{{ preContentRemoved() method
104: /**
105: * Called when text is about to be removed from the buffer, but is
106: * still present.
107: * @param buffer The buffer in question
108: * @param startLine The first line
109: * @param offset The start offset, from the beginning of the buffer
110: * @param numLines The number of lines to be removed
111: * @param length The number of characters to be removed
112: * @since jEdit 4.3pre3
113: */
114: void preContentRemoved(JEditBuffer buffer, int startLine,
115: int offset, int numLines, int length);
116:
117: //}}}
118:
119: //{{{ transactionComplete() method
120: /**
121: * Called after an undo or compound edit has finished. The text area
122: * uses this event to queue up and collapse cleanup operations so they
123: * are only run once during a long transaction (such as a "Replace All"
124: * operation.)
125: *
126: * @param buffer The buffer in question
127: * @since jEdit 4.3pre3
128: */
129: void transactionComplete(JEditBuffer buffer);
130:
131: //}}}
132:
133: //{{{ foldHandlerChanged() method
134: /**
135: * Called to notify the text area that folds need to be collapsed if
136: * the "collapseFolds" property is set. This method is called after the
137: * buffer has been loaded, and also if the user changes the fold
138: * handler.
139: *
140: * @param buffer The buffer in question
141: * @since jEdit 4.3pre3
142: */
143: void foldHandlerChanged(JEditBuffer buffer);
144:
145: //}}}
146:
147: //{{{ foldHandlerChanged() method
148: /**
149: * Called to notify the text area that the buffer has been reloaded.
150: *
151: * @param buffer The buffer in question
152: * @since jEdit 4.3pre3
153: */
154: void bufferLoaded(JEditBuffer buffer);
155: //}}}
156: }
|