/jEdit/tags/jedit-4-1-pre5/doc/users-guide/api-message.xml

# · XML · 379 lines · 306 code · 70 blank · 3 comment · 0 complexity · 9cb72050e85a489b08648a4e4f8108d9 MD5 · raw file

  1. <!-- jEdit 3.1 Plugin Guide, (C) 2001 John Gellene -->
  2. <!-- jEdit buffer-local properties: -->
  3. <!-- :indentSize=1:tabSize=2:noTabs=true:maxLineLen=72: -->
  4. <chapter id="api-message"><title>EditBus Classes</title>
  5. <para>
  6. This section describes the <classname>EditBus</classname> class
  7. itself, as well as the abstract <classname>EBMessage</classname>
  8. class and all classes that derive from it.
  9. See <xref linkend="host-display-manager" /> for an overview
  10. of how the EditBus works.
  11. </para>
  12. <sect1 id="class-editbus"><title>Class EditBus</title>
  13. <para>
  14. This class provides a messaging system for all components that implement
  15. the <classname>EBComponent</classname> interface, including
  16. <classname>View</classname> and <classname>EBPlugin</classname>
  17. objects.
  18. </para>
  19. <itemizedlist>
  20. <listitem>
  21. <funcsynopsis>
  22. <funcprototype>
  23. <funcdef>public static void <function>addToBus</function></funcdef>
  24. <paramdef>EBComponent <parameter>component</parameter></paramdef>
  25. </funcprototype>
  26. </funcsynopsis>
  27. </listitem>
  28. <listitem>
  29. <funcsynopsis>
  30. <funcprototype>
  31. <funcdef>public static void <function>removeFromBus</function></funcdef>
  32. <paramdef>EBComponent <parameter>component</parameter></paramdef>
  33. </funcprototype>
  34. </funcsynopsis>
  35. <para>
  36. Adds or removes a subscribing component.
  37. </para>
  38. </listitem>
  39. <listitem>
  40. <funcsynopsis>
  41. <funcprototype>
  42. <funcdef>public EBComponent[] <function>getComponents</function></funcdef>
  43. <void/>
  44. </funcprototype>
  45. </funcsynopsis>
  46. <para>
  47. Returns an array of all components connected to the EditBus.
  48. </para>
  49. </listitem>
  50. <listitem>
  51. <funcsynopsis>
  52. <funcprototype>
  53. <funcdef>public void <function>send</function></funcdef>
  54. <paramdef>EBMessage <parameter>message</parameter></paramdef>
  55. </funcprototype>
  56. </funcsynopsis>
  57. <para>
  58. Send the specified message to all subscribers on the EditBus.
  59. </para>
  60. </listitem>
  61. </itemizedlist>
  62. </sect1>
  63. <sect1 id="class-ebcomponent"><title>Interface EBComponent</title>
  64. <para>
  65. This interface is required for any class that subscribes to messages
  66. published on the EditBus. It contains a single method.
  67. </para>
  68. <itemizedlist>
  69. <listitem>
  70. <funcsynopsis>
  71. <funcprototype>
  72. <funcdef>public void <function>handleMessage</function></funcdef>
  73. <paramdef>EBMessage <parameter>message</parameter></paramdef>
  74. </funcprototype>
  75. </funcsynopsis>
  76. </listitem>
  77. </itemizedlist>
  78. </sect1>
  79. <sect1 id="class-ebmessage"><title>Class EBMessage</title>
  80. <para>
  81. This abstract class defines a message that can be sent on the EditBus to
  82. subscribing components. It contains two attributes that can be obtained
  83. with the following methods:
  84. </para>
  85. <itemizedlist>
  86. <listitem>
  87. <funcsynopsis>
  88. <funcprototype>
  89. <funcdef>public EBComponent <function>getSource</function></funcdef>
  90. <void/>
  91. </funcprototype>
  92. </funcsynopsis>
  93. </listitem>
  94. <listitem>
  95. <funcsynopsis>
  96. <funcprototype>
  97. <funcdef>public boolean <function>isVetoed</function></funcdef>
  98. <void/>
  99. </funcprototype>
  100. </funcsynopsis>
  101. </listitem>
  102. <listitem>
  103. <funcsynopsis>
  104. <funcprototype>
  105. <funcdef>public void <function>veto</function></funcdef>
  106. <void/>
  107. </funcprototype>
  108. </funcsynopsis>
  109. <para>
  110. This sets the <parameter>vetoed</parameter> state to
  111. <constant>true</constant>, which terminates circulation of the
  112. message to subscribers on the EditBus. To prevent a message from being
  113. vetoed, the message object must be derived from the abstract class
  114. <classname>EBMessage.NonVetoable</classname>. An object of this class
  115. will throw an <classname>InternalError</classname> if the
  116. <function>veto()</function> method is called on it.
  117. </para>
  118. </listitem>
  119. </itemizedlist>
  120. <para>
  121. A summary of classes derived from <classname>EBMessage</classname>
  122. can be found in the following sections.
  123. </para>
  124. </sect1>
  125. <sect1 id="class-bufferupdate"><title>Class BufferUpdate</title>
  126. <para>
  127. This message is sent when the status of a buffer changes. It may
  128. not be vetoed by a subscriber, so that all subscribers are
  129. assured of receiving it regardless of an individual subscriber's
  130. response.
  131. </para>
  132. <itemizedlist>
  133. <listitem>
  134. <funcsynopsis>
  135. <funcprototype>
  136. <funcdef>public Buffer <function>getBuffer</function></funcdef>
  137. <void/>
  138. </funcprototype>
  139. </funcsynopsis>
  140. </listitem>
  141. <listitem>
  142. <funcsynopsis>
  143. <funcprototype>
  144. <funcdef>public View <function>getView</function></funcdef>
  145. <void/>
  146. </funcprototype>
  147. </funcsynopsis>
  148. <para>
  149. This may be <literal>null</literal> with some message types.
  150. </para>
  151. </listitem>
  152. <listitem>
  153. <funcsynopsis>
  154. <funcprototype>
  155. <funcdef>public Object <function>getWhat</function></funcdef>
  156. <void/>
  157. </funcprototype>
  158. </funcsynopsis>
  159. <para>
  160. Returns one of the following constants defined in the
  161. <classname>BufferUpdate</classname> class:
  162. </para>
  163. <itemizedlist>
  164. <listitem><para><varname>CREATED</varname></para></listitem>
  165. <listitem><para><varname>LOAD_STARTED</varname></para></listitem>
  166. <listitem><para><varname>DIRTY_CHANGED</varname></para></listitem>
  167. <listitem><para><varname>MARKERS_CHANGED</varname></para></listitem>
  168. <listitem><para><varname>MODE_CHANGED</varname></para></listitem>
  169. <listitem><para><varname>ENCODING_CHANGED</varname></para></listitem>
  170. <listitem><para><varname>SAVING</varname></para></listitem>
  171. </itemizedlist>
  172. </listitem>
  173. </itemizedlist>
  174. </sect1>
  175. <sect1 id="class-editorexiting"><title>Class EditorExiting</title>
  176. <para>
  177. This message signifies that the host application is about to exit.
  178. The message has no parameters and may not be vetoed.
  179. </para>
  180. </sect1>
  181. <sect1 id="class-editorexitrequested"><title>Class EditorExitRequested</title>
  182. <para>
  183. This message signifies that a request has been made for the host application
  184. to exit. The request is subject to cancellation in response to a request to
  185. write a modified buffer to storage. It may not be vetoed.
  186. </para>
  187. <itemizedlist>
  188. <listitem>
  189. <funcsynopsis>
  190. <funcprototype>
  191. <funcdef>public View <function>getView</function></funcdef>
  192. <void/>
  193. </funcprototype>
  194. </funcsynopsis>
  195. </listitem>
  196. </itemizedlist>
  197. </sect1>
  198. <sect1 id="class-editorstarted"><title>Class EditorStarted</title>
  199. <para>
  200. This message signifies that the host application has started. The
  201. message is sent before any views are created. The message has no
  202. parameters and it may not be vetoed.
  203. </para>
  204. </sect1>
  205. <sect1 id="class-editpaneupdate"><title>Class EditPaneUpdate</title>
  206. <para>
  207. This message is sent when the status of a edit pane changes. It may
  208. not be vetoed.
  209. </para>
  210. <itemizedlist>
  211. <listitem>
  212. <funcsynopsis>
  213. <funcprototype>
  214. <funcdef>public EditPane <function>getEditPane</function></funcdef>
  215. <void/>
  216. </funcprototype>
  217. </funcsynopsis>
  218. </listitem>
  219. <listitem>
  220. <funcsynopsis>
  221. <funcprototype>
  222. <funcdef>public Object <function>getWhat</function></funcdef>
  223. <void/>
  224. </funcprototype>
  225. </funcsynopsis>
  226. <para>
  227. Returns one of the following constants defined in the
  228. <classname>EditPaneUpdate</classname> class:
  229. </para>
  230. <itemizedlist>
  231. <listitem><para><varname>CREATED</varname></para></listitem>
  232. <listitem><para><varname>DESTROYED</varname></para></listitem>
  233. <listitem><para><varname>BUFFER_CHANGED</varname> - a change in the buffer
  234. displayed in the edit pane</para></listitem>
  235. </itemizedlist>
  236. </listitem>
  237. </itemizedlist>
  238. </sect1>
  239. <sect1 id="class-macroschanged"><title>Class MacrosChanged</title>
  240. <para>
  241. This message signifies that the list of available macros have changed.
  242. The message has no parameters and may not be vetoed.
  243. </para>
  244. </sect1>
  245. <sect1 id="class-propertieschanged"><title>Class PropertiesChanged</title>
  246. <para>
  247. This message is sent when configuration settings have been changed through
  248. any of the option panes in the options dialog. The message has no
  249. parameters and may be vetoed.
  250. </para>
  251. </sect1>
  252. <sect1 id="class-searchsettingschanged">
  253. <title>Class SearchSettingsChanged</title>
  254. <para>
  255. This message is sent when settings in the <quote>Search and
  256. Replace</quote> dialog have changed. The message has no
  257. parameters and may be vetoed.
  258. </para>
  259. </sect1>
  260. <sect1 id="class-vfsupdate"><title>Class VFSUpdate</title>
  261. <para>
  262. This message is sent when the status of a file or directory changes.
  263. This allows subscribers that display or operate upon files an
  264. opportunity to adjust their state. This message may not be vetoed.
  265. </para>
  266. <itemizedlist>
  267. <listitem>
  268. <funcsynopsis>
  269. <funcprototype>
  270. <funcdef>public String <function>getPath</function></funcdef>
  271. <void/>
  272. </funcprototype>
  273. </funcsynopsis>
  274. </listitem>
  275. </itemizedlist>
  276. </sect1>
  277. <sect1 id="class-viewupdate"><title>Class ViewUpdate</title>
  278. <para>
  279. This message is sent when the status of a view changes. It may
  280. not be vetoed.
  281. </para>
  282. <itemizedlist>
  283. <listitem>
  284. <funcsynopsis>
  285. <funcprototype>
  286. <funcdef>public View <function>getView</function></funcdef>
  287. <void/>
  288. </funcprototype>
  289. </funcsynopsis>
  290. </listitem>
  291. <listitem>
  292. <funcsynopsis>
  293. <funcprototype>
  294. <funcdef>public Object <function>getWhat</function></funcdef>
  295. <void/>
  296. </funcprototype>
  297. </funcsynopsis>
  298. <para>
  299. Returns one of the following constants defined in the
  300. <classname>ViewUpdate</classname> class:
  301. </para>
  302. <itemizedlist>
  303. <listitem><para><varname>CREATED</varname></para></listitem>
  304. <listitem><para><varname>CLOSED</varname></para></listitem>
  305. </itemizedlist>
  306. </listitem>
  307. </itemizedlist>
  308. </sect1>
  309. </chapter>