PageRenderTime 19ms CodeModel.GetById 10ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre5/org/gjt/sp/jedit/msg/BufferUpdate.java

#
Java | 153 lines | 43 code | 22 blank | 88 comment | 2 complexity | 5e26094b231ca73b365a0bf378d6549e MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1/*
  2 * BufferUpdate.java - Buffer update message
  3 * :tabSize=8:indentSize=8:noTabs=false:
  4 * :folding=explicit:collapseFolds=1:
  5 *
  6 * Copyright (C) 1999, 2001 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.msg;
 24
 25import org.gjt.sp.jedit.*;
 26
 27/**
 28 * Message sent when a buffer-related change occurs.
 29 * @author Slava Pestov
 30 * @version $Id: BufferUpdate.java 4013 2002-02-05 06:28:10Z  $
 31 *
 32 * @since jEdit 2.2pre6
 33 */
 34public class BufferUpdate extends EBMessage.NonVetoable
 35{
 36	//{{{ Message types
 37	/**
 38	 * Buffer created.
 39	 */
 40	public static final Object CREATED = "CREATED";
 41
 42	/**
 43	 * Buffer load started.
 44	 * @since jEdit 2.6pre1
 45	 */
 46	public static final Object LOAD_STARTED = "LOAD_STARTED";
 47
 48	/**
 49	 * Buffer loaded.
 50	 */
 51	public static final Object LOADED = "LOADED";
 52
 53	/**
 54	 * Buffer closed.
 55	 */
 56	public static final Object CLOSED = "CLOSED";
 57
 58	/**
 59	 * Buffer dirty changed.
 60	 */
 61	public static final Object DIRTY_CHANGED = "DIRTY_CHANGED";
 62
 63	/**
 64	 * Buffer markers changed.
 65	 */
 66	public static final Object MARKERS_CHANGED = "MARKERS_CHANGED";
 67
 68	/**
 69	 * Buffer mode changed.
 70	 */
 71	public static final Object MODE_CHANGED = "MODE_CHANGED";
 72
 73	/**
 74	 * Character encoding changed.
 75	 * @since jEdit 3.2pre4
 76	 */
 77	public static final Object ENCODING_CHANGED = "ENCODING_CHANGED";
 78
 79	/**
 80	 * Fold handler changed.
 81	 * @since jEdit 4.0pre1
 82	 */
 83	public static final Object FOLD_HANDLER_CHANGED = "FOLD_HANDLER_CHANGED";
 84
 85	/**
 86	 * Buffer saving.
 87	 */
 88	public static final Object SAVING = "SAVING";
 89
 90	/**
 91	 * Buffer saved.
 92	 * @since jEdit 4.0pre4
 93	 */
 94	public static final Object SAVED = "SAVED";
 95	//}}}
 96
 97	//{{{ BufferUpdate constructor
 98	/**
 99	 * Creates a new buffer update message.
100	 * @param buffer The buffer
101	 * @param what What happened
102	 */
103	public BufferUpdate(Buffer buffer, View view, Object what)
104	{
105		super(buffer);
106
107		this.view = view;
108
109		if(what == null)
110			throw new NullPointerException("What must be non-null");
111
112		this.what = what;
113	} //}}}
114
115	//{{{ getWhat() method
116	/**
117	 * Returns what caused this buffer update.
118	 */
119	public Object getWhat()
120	{
121		return what;
122	} //}}}
123
124	//{{{ getBuffer() method
125	/**
126	 * Returns the buffer involved.
127	 */
128	public Buffer getBuffer()
129	{
130		return (Buffer)getSource();
131	} //}}}
132
133	//{{{ getView() method
134	/**
135	 * Returns the view involved, which may be null.
136	 */
137	public View getView()
138	{
139		return view;
140	} //}}}
141
142	//{{{ paramString() method
143	public String paramString()
144	{
145		return super.paramString() + ",what=" + what
146			+ ",view=" + view;
147	} //}}}
148
149	//{{{ Private members
150	private Object what;
151	private View view;
152	//}}}
153}