PageRenderTime 144ms CodeModel.GetById 140ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Java | 125 lines | 36 code | 14 blank | 75 comment | 2 complexity | fc4b295b5d0e7885d16aee3866b11731 MD5 | raw file
  1/*
  2 * PluginUpdate.java - Plugin update message
  3 * :tabSize=8:indentSize=8:noTabs=false:
  4 * :folding=explicit:collapseFolds=1:
  5 *
  6 * Copyright (C) 2003 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 plugins are loaded and unloaded.
 29 * @author Slava Pestov
 30 * @version $Id: PluginUpdate.java 5004 2004-03-28 00:07:27Z spestov $
 31 *
 32 * @since jEdit 4.2pre1
 33 */
 34public class PluginUpdate extends EBMessage
 35{
 36	//{{{ Message types
 37	/**
 38	 * Plugin loaded. This is sent after a JAR file is added to the
 39	 * list and scanned.
 40	 * @since jEdit 4.2pre1
 41	 */
 42	public static final Object LOADED = "LOADED";
 43
 44	/**
 45	 * Plugin activated. This is sent after the plugin core class
 46	 * is loaded and its <code>start()</code> method is called.
 47	 * @since jEdit 4.2pre1
 48	 */
 49	public static final Object ACTIVATED = "ACTIVATED";
 50
 51	/**
 52	 * Plugin activated. This is sent after the plugin core class
 53	 * <code>stop()</code> method is called.
 54	 * @since jEdit 4.2pre2
 55	 */
 56	public static final Object DEACTIVATED = "DEACTIVATED";
 57
 58	/**
 59	 * Plugin unloaded.
 60	 * @since jEdit 4.2pre1
 61	 */
 62	public static final Object UNLOADED = "UNLOADED";
 63	//}}}
 64
 65	//{{{ PluginUpdate constructor
 66	/**
 67	 * Creates a new plugin update message.
 68	 * @param jar The plugin
 69	 * @param what What happened
 70	 * @param exit Is the editor exiting?
 71	 * @since jEdit 4.2pre3
 72	 */
 73	public PluginUpdate(PluginJAR jar, Object what, boolean exit)
 74	{
 75		super(jar);
 76
 77		if(what == null)
 78			throw new NullPointerException("What must be non-null");
 79
 80		this.what = what;
 81		this.exit = exit;
 82	} //}}}
 83
 84	//{{{ getWhat() method
 85	/**
 86	 * Returns what caused this plugin update.
 87	 */
 88	public Object getWhat()
 89	{
 90		return what;
 91	} //}}}
 92
 93	//{{{ isExiting() method
 94	/**
 95	 * Returns true if this plugin is being unloaded as part of the
 96	 * shutdown process, in which case some components like the help
 97	 * viewer and plugin manager ignore the event.
 98	 * @since jEdit 4.2pre3
 99	 */
100	public boolean isExiting()
101	{
102		return exit;
103	} //}}}
104
105	//{{{ getPluginJAR() method
106	/**
107	 * Returns the plugin involved.
108	 */
109	public PluginJAR getPluginJAR()
110	{
111		return (PluginJAR)getSource();
112	} //}}}
113
114	//{{{ paramString() method
115	public String paramString()
116	{
117		return "what=" + what + ",exit=" + exit + ","
118			+ super.paramString();
119	} //}}}
120
121	//{{{ Private members
122	private Object what;
123	private boolean exit;
124	//}}}
125}