PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-5-pre1/org/gjt/sp/jedit/buffer/BufferListener.java

#
Java | 150 lines | 16 code | 9 blank | 125 comment | 0 complexity | 0f502a061a092abfe6c4d843b7075655 MD5 | raw file
  1/*
  2 * BufferListener.java - Buffer listener interface
  3 * :tabSize=8:indentSize=8:noTabs=false:
  4 * :folding=explicit:collapseFolds=1:
  5 *
  6 * Copyright (C) 2001, 2005 Slava Pestov
  7 *
  8 * This program is free software; you can redistribute it and/or
  9 * modify it under the terms of the GNU General Public License
 10 * as published by the Free Software Foundation; either version 2
 11 * of the License, or any later version.
 12 *
 13 * This program is distributed in the hope that it will be useful,
 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 * GNU General Public License for more details.
 17 *
 18 * You should have received a copy of the GNU General Public License
 19 * along with this program; if not, write to the Free Software
 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 21 */
 22
 23package org.gjt.sp.jedit.buffer;
 24
 25/**
 26 * A interface for notification of changes to buffer text.<p>
 27 *
 28 * This interface is new in jEdit 4.3pre3. The text area was made independent
 29 * of the rest of jEdit, and thus this class could no longer depend on
 30 * <code>org.gjt.sp.jedit.Buffer</code>.<p>
 31 *
 32 * While the
 33 * {@link org.gjt.sp.jedit.msg.BufferUpdate} EditBus message is used for
 34 * general buffer state changes, this interface is used for events which are
 35 * fired frequently, or for which performance is essential.<p>
 36 *
 37 * Because this interface is subject to change in the future, you
 38 * should subclass <code>BufferAdapter</code> instead of
 39 * implementing it directly.
 40 *
 41 * @author Slava Pestov
 42 * @version $Id: BufferListener.java 12504 2008-04-22 23:12:43Z ezust $
 43 * @since jEdit 4.3pre3
 44 */
 45public interface BufferListener
 46{
 47	//{{{ foldLevelChanged() method
 48	/**
 49	 * Called when line fold levels change.
 50	 * @param buffer The buffer in question
 51	 * @param startLine The start line number
 52	 * @param endLine The end line number
 53	 * @since jEdit 4.3pre3
 54	 */
 55	void foldLevelChanged(JEditBuffer buffer, int startLine, int endLine);
 56	//}}}
 57
 58	//{{{ contentInserted() method
 59	/**
 60	 * Called when text is inserted into the buffer.
 61	 * @param buffer The buffer in question
 62	 * @param startLine The first line
 63	 * @param offset The start offset, from the beginning of the buffer
 64	 * @param numLines The number of lines inserted
 65	 * @param length The number of characters inserted
 66	 * @since jEdit 4.3pre3
 67	 */
 68	void contentInserted(JEditBuffer buffer, int startLine, int offset,
 69		int numLines, int length);
 70	//}}}
 71
 72	//{{{ contentRemoved() method
 73	/**
 74	 * Called when text is removed from the buffer.
 75	 * @param buffer The buffer in question
 76	 * @param startLine The first line
 77	 * @param offset The start offset, from the beginning of the buffer
 78	 * @param numLines The number of lines removed
 79	 * @param length The number of characters removed
 80	 * @since jEdit 4.3pre3
 81	 */
 82	void contentRemoved(JEditBuffer buffer, int startLine, int offset,
 83		int numLines, int length);
 84	//}}}
 85
 86	//{{{ preContentInserted() method
 87	/**
 88	 * Called when text is about to be inserted in the buffer.
 89	 * @param buffer The buffer in question
 90	 * @param startLine The first line
 91	 * @param offset The start offset, from the beginning of the buffer
 92	 * @param numLines The number of lines inserted
 93	 * @param length The number of characters inserted
 94	 * @since jEdit 4.3pre11
 95	 */
 96	void preContentInserted(JEditBuffer buffer, int startLine, int offset,
 97		int numLines, int length);
 98	//}}}
 99
100	//{{{ preContentRemoved() method
101	/**
102	 * Called when text is about to be removed from the buffer, but is
103	 * still present.
104	 * @param buffer The buffer in question
105	 * @param startLine The first line
106	 * @param offset The start offset, from the beginning of the buffer
107	 * @param numLines The number of lines to be removed
108	 * @param length The number of characters to be removed
109	 * @since jEdit 4.3pre3
110	 */
111	void preContentRemoved(JEditBuffer buffer, int startLine, int offset,
112		int numLines, int length);
113	//}}}
114
115	//{{{ transactionComplete() method
116	/**
117	 * Called after an undo or compound edit has finished. The text area
118	 * uses this event to queue up and collapse cleanup operations so they
119	 * are only run once during a long transaction (such as a "Replace All"
120	 * operation.)
121	 *
122	 * @param buffer The buffer in question
123	 * @since jEdit 4.3pre3
124	 */
125	void transactionComplete(JEditBuffer buffer);
126	//}}}
127
128	//{{{ foldHandlerChanged() method
129	/**
130	 * Called to notify the text area that folds need to be collapsed if
131	 * the "collapseFolds" property is set. This method is called after the
132	 * buffer has been loaded, and also if the user changes the fold
133	 * handler.
134	 *
135	 * @param buffer The buffer in question
136	 * @since jEdit 4.3pre3
137	 */
138	void foldHandlerChanged(JEditBuffer buffer);
139	//}}}
140
141	//{{{ foldHandlerChanged() method
142	/**
143	 * Called to notify the text area that the buffer has been reloaded.
144	 *
145	 * @param buffer The buffer in question
146	 * @since jEdit 4.3pre3
147	 */
148	void bufferLoaded(JEditBuffer buffer);
149	//}}}
150}