001: /*
002: * PluginUpdate.java - Plugin update message
003: * :tabSize=8:indentSize=8:noTabs=false:
004: * :folding=explicit:collapseFolds=1:
005: *
006: * Copyright (C) 2003 Slava Pestov
007: *
008: * This program is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU General Public License
010: * as published by the Free Software Foundation; either version 2
011: * of the License, or any later version.
012: *
013: * This program is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: * GNU General Public License for more details.
017: *
018: * You should have received a copy of the GNU General Public License
019: * along with this program; if not, write to the Free Software
020: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
021: */
022:
023: package org.gjt.sp.jedit.msg;
024:
025: import org.gjt.sp.jedit.*;
026:
027: /**
028: * Message sent when plugins are loaded and unloaded.
029: * @author Slava Pestov
030: * @version $Id: PluginUpdate.java 9402 2007-04-02 17:17:25Z ezust $
031: *
032: * @since jEdit 4.2pre1
033: */
034: public class PluginUpdate extends EBMessage {
035: //{{{ Message types
036: /**
037: * Plugin loaded. This is sent after a JAR file is added to the
038: * list and scanned.
039: * @since jEdit 4.2pre1
040: */
041: public static final Object LOADED = "LOADED";
042:
043: /**
044: * Plugin activated. This is sent after the plugin core class
045: * is loaded and its <code>start()</code> method is called.
046: * @since jEdit 4.2pre1
047: */
048: public static final Object ACTIVATED = "ACTIVATED";
049:
050: /**
051: * Plugin deactivated. This is sent after the plugin core class
052: * <code>stop()</code> method is called.
053: * @since jEdit 4.2pre2
054: */
055: public static final Object DEACTIVATED = "DEACTIVATED";
056:
057: /**
058: * Plugin unloaded.
059: * @since jEdit 4.2pre1
060: */
061: public static final Object UNLOADED = "UNLOADED";
062:
063: //}}}
064:
065: //{{{ PluginUpdate constructor
066: /**
067: * Creates a new plugin update message.
068: * @param jar The plugin
069: * @param what What happened
070: * @param exit Is the editor exiting?
071: * @since jEdit 4.2pre3
072: */
073: public PluginUpdate(PluginJAR jar, Object what, boolean exit) {
074: super (jar);
075:
076: if (what == null)
077: throw new NullPointerException("What must be non-null");
078:
079: this .what = what;
080: this .exit = exit;
081: } //}}}
082:
083: //{{{ getWhat() method
084: /**
085: * Returns what caused this plugin update.
086: */
087: public Object getWhat() {
088: return what;
089: } //}}}
090:
091: //{{{ isExiting() method
092: /**
093: * Returns true if this plugin is being unloaded as part of the
094: * shutdown process, in which case some components like the help
095: * viewer and plugin manager ignore the event.
096: * @since jEdit 4.2pre3
097: */
098: public boolean isExiting() {
099: return exit;
100: } //}}}
101:
102: //{{{ getPluginJAR() method
103: /**
104: * Returns the plugin involved.
105: */
106: public PluginJAR getPluginJAR() {
107: return (PluginJAR) getSource();
108: } //}}}
109:
110: //{{{ paramString() method
111: public String paramString() {
112: return "what=" + what + ",exit=" + exit + ","
113: + super .paramString();
114: } //}}}
115:
116: //{{{ Private members
117: private Object what;
118: private boolean exit;
119: //}}}
120: }
|