PageRenderTime 68ms CodeModel.GetById 64ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Java | 58 lines | 17 code | 5 blank | 36 comment | 1 complexity | e613294cea94dfc83dbbe9280578b3b7 MD5 | raw file
 1/*
 2 * EBPlugin.java - An EditBus plugin
 3 * Copyright (C) 1999 Slava Pestov
 4 *
 5 * This program is free software; you can redistribute it and/or
 6 * modify it under the terms of the GNU General Public License
 7 * as published by the Free Software Foundation; either version 2
 8 * of the License, or any later version.
 9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19
20package org.gjt.sp.jedit;
21
22import org.gjt.sp.util.Log;
23
24/**
25 * Plugins extending this class are automatically added to the EditBus.
26 * Otherwise, this class is identical to the {@link EditPlugin}
27 * class.
28 *
29 * @see org.gjt.sp.jedit.EditBus
30 * @see org.gjt.sp.jedit.EBComponent
31 * @see org.gjt.sp.jedit.EBMessage
32 *
33 * @author Slava Pestov
34 * @version $Id: EBPlugin.java 4669 2003-05-01 02:21:27Z spestov $
35 */
36public abstract class EBPlugin extends EditPlugin implements EBComponent
37{
38	/**
39	 * Handles a message sent on the EditBus.
40	 */
41	// next version: remove this
42	public void handleMessage(EBMessage message)
43	{
44		EditBus.removeFromBus(this);
45		if(seenWarning)
46			return;
47		seenWarning = true;
48		Log.log(Log.WARNING,this,getClassName() + " should extend"
49			+ " EditPlugin not EBPlugin since it has an empty"
50			+ " handleMessage()");
51	}
52
53	// protected members
54	protected EBPlugin() {}
55
56	// private members
57	private boolean seenWarning;
58}