01: /*
02: * BufferChanging.java - Buffer changing (specialized Edit Pane update message)
03: * :tabSize=8:indentSize=8:noTabs=false:
04: * :folding=explicit:collapseFolds=1:
05: *
06: * Copyright (C) 2006 Alan Ezust
07: *
08: * This program is free software; you can redistribute it and/or
09: * 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:
23: package org.gjt.sp.jedit.msg;
24:
25: import org.gjt.sp.jedit.Buffer;
26: import org.gjt.sp.jedit.EditPane;
27:
28: /** An EBMessage sent by the EditPane just before the buffer changes.
29: * It is also sent by some plugins just before the caret position is changed.
30: * In hindsight, a better name for this class would be PositionChanging.
31: *
32: * Plugins may emit this message just before they perform a
33: * Navigation-Like operation, such as jumping the cursor to
34: * another location (which may be in the same buffer or not). This is mostly
35: * for the benefit of the Navigator plugin, but may be used by other plugins
36: * too, such as BufferLocal.
37: *
38: * @since jEdit 4.3pre4
39: * @version $Id: BufferChanging.java 9899 2007-07-01 20:25:52Z ezust $
40: */
41: public class BufferChanging extends EditPaneUpdate {
42: /**
43: * @param editPane the editPane that sent the message
44: * @param newBuffer the buffer that will soon be displayed, or null if this is
45: * a jump to the same buffer.
46: *
47: */
48: public BufferChanging(EditPane editPane, Buffer newBuffer) {
49: super (editPane, BUFFER_CHANGING);
50: m_buffer = newBuffer;
51: }
52:
53: /**
54: * @return the new buffer that is about to be displayed. This value can sometimes be null,
55: * in the case where a plugin is changing to another position in the current buffer.
56: */
57: public Buffer getBuffer() {
58: return m_buffer;
59: }
60:
61: private Buffer m_buffer;
62: }
|