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

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

#
Java | 99 lines | 29 code | 7 blank | 63 comment | 0 complexity | 410b2ef7f1fc81bb3f413fce7de1cdf5 MD5 | raw file
 1/*
 2 * EBMessage.java - An EditBus message
 3 * :tabSize=8:indentSize=8:noTabs=false:
 4 * :folding=explicit:collapseFolds=1:
 5 *
 6 * Copyright (C) 1999, 2002 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;
24
25/**
26 * The base class of all EditBus messages.<p>
27 *
28 * Message classes extending this class typically add
29 * other data members and methods to provide subscribers with whatever is
30 * needed to handle the message appropriately.<p>
31 *
32 * Message types sent by jEdit can be found in the
33 * {@link org.gjt.sp.jedit.msg} package.
34 *
35 * @author Slava Pestov
36 * @author John Gellene (API documentation)
37 * @version $Id: EBMessage.java 12625 2008-05-11 12:07:29Z kpouer $
38 *
39 * @since jEdit 2.2pre6
40 */
41public abstract class EBMessage
42{
43	//{{{ EBMessage constructor
44	/**
45	 * Creates a new message.
46	 * @param source The message source
47	 * @since jEdit 4.2pre1
48	 */
49	protected EBMessage(Object source)
50	{
51		this.source = source;
52	} //}}}
53
54	//{{{ EBMessage constructor
55	/**
56	 * Creates a new message.
57	 * @param source The message source
58	 */
59	protected EBMessage(EBComponent source)
60	{
61		this.source = source;
62	} //}}}
63
64	//{{{ getSource() method
65	/**
66	 * Returns the sender of this message.
67	 * @since jEdit 4.2pre1
68	 */
69	public Object getSource()
70	{
71		return source;
72	} //}}}
73
74	//{{{ toString() method
75	/**
76	 * Returns a string representation of this message.
77	 */
78	@Override
79	public String toString()
80	{
81		String className = getClass().getName();
82		int index = className.lastIndexOf('.');
83		return className.substring(index + 1)
84			+ '[' + paramString() + ']';
85	} //}}}
86
87	//{{{ paramString() method
88	/**
89	 * Returns a string representation of this message's parameters.
90	 */
91	public String paramString()
92	{
93		return "source=" + source;
94	} //}}}
95
96	//{{{ Private members
97	private Object source;
98	//}}}
99}