PageRenderTime 37ms CodeModel.GetById 12ms RepoModel.GetById 0ms 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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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. package org.gjt.sp.jedit.msg;
  23. import org.gjt.sp.jedit.*;
  24. /**
  25. * Message sent when plugins are loaded and unloaded.
  26. * @author Slava Pestov
  27. * @version $Id: PluginUpdate.java 5004 2004-03-28 00:07:27Z spestov $
  28. *
  29. * @since jEdit 4.2pre1
  30. */
  31. public class PluginUpdate extends EBMessage
  32. {
  33. //{{{ Message types
  34. /**
  35. * Plugin loaded. This is sent after a JAR file is added to the
  36. * list and scanned.
  37. * @since jEdit 4.2pre1
  38. */
  39. public static final Object LOADED = "LOADED";
  40. /**
  41. * Plugin activated. This is sent after the plugin core class
  42. * is loaded and its <code>start()</code> method is called.
  43. * @since jEdit 4.2pre1
  44. */
  45. public static final Object ACTIVATED = "ACTIVATED";
  46. /**
  47. * Plugin activated. This is sent after the plugin core class
  48. * <code>stop()</code> method is called.
  49. * @since jEdit 4.2pre2
  50. */
  51. public static final Object DEACTIVATED = "DEACTIVATED";
  52. /**
  53. * Plugin unloaded.
  54. * @since jEdit 4.2pre1
  55. */
  56. public static final Object UNLOADED = "UNLOADED";
  57. //}}}
  58. //{{{ PluginUpdate constructor
  59. /**
  60. * Creates a new plugin update message.
  61. * @param jar The plugin
  62. * @param what What happened
  63. * @param exit Is the editor exiting?
  64. * @since jEdit 4.2pre3
  65. */
  66. public PluginUpdate(PluginJAR jar, Object what, boolean exit)
  67. {
  68. super(jar);
  69. if(what == null)
  70. throw new NullPointerException("What must be non-null");
  71. this.what = what;
  72. this.exit = exit;
  73. } //}}}
  74. //{{{ getWhat() method
  75. /**
  76. * Returns what caused this plugin update.
  77. */
  78. public Object getWhat()
  79. {
  80. return what;
  81. } //}}}
  82. //{{{ isExiting() method
  83. /**
  84. * Returns true if this plugin is being unloaded as part of the
  85. * shutdown process, in which case some components like the help
  86. * viewer and plugin manager ignore the event.
  87. * @since jEdit 4.2pre3
  88. */
  89. public boolean isExiting()
  90. {
  91. return exit;
  92. } //}}}
  93. //{{{ getPluginJAR() method
  94. /**
  95. * Returns the plugin involved.
  96. */
  97. public PluginJAR getPluginJAR()
  98. {
  99. return (PluginJAR)getSource();
  100. } //}}}
  101. //{{{ paramString() method
  102. public String paramString()
  103. {
  104. return "what=" + what + ",exit=" + exit + ","
  105. + super.paramString();
  106. } //}}}
  107. //{{{ Private members
  108. private Object what;
  109. private boolean exit;
  110. //}}}
  111. }