PageRenderTime 145ms CodeModel.GetById 142ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/org/gjt/sp/jedit/EBMessage.java

#
Java | 98 lines | 28 code | 7 blank | 63 comment | 0 complexity | f77597e631af8ed9c2ad73a9ac520ac0 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 5167 2005-01-09 01:47:38Z spestov $
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	public 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	public 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	public String toString()
79	{
80		String className = getClass().getName();
81		int index = className.lastIndexOf('.');
82		return className.substring(index + 1)
83			+ "[" + paramString() + "]";
84	} //}}}
85
86	//{{{ paramString() method
87	/**
88	 * Returns a string representation of this message's parameters.
89	 */
90	public String paramString()
91	{
92		return "source=" + source;
93	} //}}}
94
95	//{{{ Private members
96	private Object source;
97	//}}}
98}