Kernel-Announcements.js 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138
  1. define(["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  3. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  4. $core.addPackage("Kernel-Announcements");
  5. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  6. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  8. //>>excludeStart("ide", pragmas.excludeIdeData);
  9. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  10. //>>excludeEnd("ide");
  11. $core.addMethod(
  12. $core.method({
  13. selector: "announcementClass",
  14. protocol: "accessing",
  15. fn: function (){
  16. var self=this,$self=this;
  17. return $self["@announcementClass"];
  18. },
  19. //>>excludeStart("ide", pragmas.excludeIdeData);
  20. args: [],
  21. source: "announcementClass\x0a\x09^ announcementClass",
  22. referencedClasses: [],
  23. //>>excludeEnd("ide");
  24. messageSends: []
  25. }),
  26. $globals.AnnouncementSubscription);
  27. $core.addMethod(
  28. $core.method({
  29. selector: "announcementClass:",
  30. protocol: "accessing",
  31. fn: function (aClass){
  32. var self=this,$self=this;
  33. $self["@announcementClass"]=aClass;
  34. return self;
  35. },
  36. //>>excludeStart("ide", pragmas.excludeIdeData);
  37. args: ["aClass"],
  38. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  39. referencedClasses: [],
  40. //>>excludeEnd("ide");
  41. messageSends: []
  42. }),
  43. $globals.AnnouncementSubscription);
  44. $core.addMethod(
  45. $core.method({
  46. selector: "deliver:",
  47. protocol: "announcing",
  48. fn: function (anAnnouncement){
  49. var self=this,$self=this;
  50. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  51. return $core.withContext(function($ctx1) {
  52. //>>excludeEnd("ctx");
  53. var $1;
  54. $1=$self._handlesAnnouncement_(anAnnouncement);
  55. if($core.assert($1)){
  56. $recv($self._valuable())._value_(anAnnouncement);
  57. }
  58. return self;
  59. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  61. //>>excludeEnd("ctx");
  62. },
  63. //>>excludeStart("ide", pragmas.excludeIdeData);
  64. args: ["anAnnouncement"],
  65. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  66. referencedClasses: [],
  67. //>>excludeEnd("ide");
  68. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  69. }),
  70. $globals.AnnouncementSubscription);
  71. $core.addMethod(
  72. $core.method({
  73. selector: "handlesAnnouncement:",
  74. protocol: "announcing",
  75. fn: function (anAnnouncement){
  76. var self=this,$self=this;
  77. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  78. return $core.withContext(function($ctx1) {
  79. //>>excludeEnd("ctx");
  80. var $2,$3,$1,$receiver;
  81. $2=$recv($globals.Smalltalk)._globals();
  82. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  83. $ctx1.sendIdx["globals"]=1;
  84. //>>excludeEnd("ctx");
  85. $3=$recv($self._announcementClass())._name();
  86. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  87. $ctx1.sendIdx["name"]=1;
  88. //>>excludeEnd("ctx");
  89. $1=$recv($2)._at_($3);
  90. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  91. $ctx1.sendIdx["at:"]=1;
  92. //>>excludeEnd("ctx");
  93. if(($receiver = $1) == null || $receiver.a$nil){
  94. return false;
  95. } else {
  96. var class_;
  97. class_=$receiver;
  98. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  99. }
  100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  101. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  102. //>>excludeEnd("ctx");
  103. },
  104. //>>excludeStart("ide", pragmas.excludeIdeData);
  105. args: ["anAnnouncement"],
  106. source: "handlesAnnouncement: anAnnouncement\x0a\x09\x22anAnnouncement might be announced from within another Amber environment\x22\x0a\x09\x0a\x09^ (Smalltalk globals at: self announcementClass name)\x0a\x09\x09ifNil: [ ^ false ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09(Smalltalk globals at: anAnnouncement class theNonMetaClass name) includesBehavior: class ]",
  107. referencedClasses: ["Smalltalk"],
  108. //>>excludeEnd("ide");
  109. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  110. }),
  111. $globals.AnnouncementSubscription);
  112. $core.addMethod(
  113. $core.method({
  114. selector: "receiver",
  115. protocol: "accessing",
  116. fn: function (){
  117. var self=this,$self=this;
  118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  119. return $core.withContext(function($ctx1) {
  120. //>>excludeEnd("ctx");
  121. return $recv($self._valuable())._receiver();
  122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  123. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  124. //>>excludeEnd("ctx");
  125. },
  126. //>>excludeStart("ide", pragmas.excludeIdeData);
  127. args: [],
  128. source: "receiver\x0a\x09^ self valuable receiver",
  129. referencedClasses: [],
  130. //>>excludeEnd("ide");
  131. messageSends: ["receiver", "valuable"]
  132. }),
  133. $globals.AnnouncementSubscription);
  134. $core.addMethod(
  135. $core.method({
  136. selector: "valuable",
  137. protocol: "accessing",
  138. fn: function (){
  139. var self=this,$self=this;
  140. return $self["@valuable"];
  141. },
  142. //>>excludeStart("ide", pragmas.excludeIdeData);
  143. args: [],
  144. source: "valuable\x0a\x09^ valuable",
  145. referencedClasses: [],
  146. //>>excludeEnd("ide");
  147. messageSends: []
  148. }),
  149. $globals.AnnouncementSubscription);
  150. $core.addMethod(
  151. $core.method({
  152. selector: "valuable:",
  153. protocol: "accessing",
  154. fn: function (aValuable){
  155. var self=this,$self=this;
  156. $self["@valuable"]=aValuable;
  157. return self;
  158. },
  159. //>>excludeStart("ide", pragmas.excludeIdeData);
  160. args: ["aValuable"],
  161. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  162. referencedClasses: [],
  163. //>>excludeEnd("ide");
  164. messageSends: []
  165. }),
  166. $globals.AnnouncementSubscription);
  167. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  168. //>>excludeStart("ide", pragmas.excludeIdeData);
  169. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  170. //>>excludeEnd("ide");
  171. $core.addMethod(
  172. $core.method({
  173. selector: "receiver",
  174. protocol: "accessing",
  175. fn: function (){
  176. var self=this,$self=this;
  177. return $self["@receiver"];
  178. },
  179. //>>excludeStart("ide", pragmas.excludeIdeData);
  180. args: [],
  181. source: "receiver\x0a\x09^ receiver",
  182. referencedClasses: [],
  183. //>>excludeEnd("ide");
  184. messageSends: []
  185. }),
  186. $globals.AnnouncementValuable);
  187. $core.addMethod(
  188. $core.method({
  189. selector: "receiver:",
  190. protocol: "accessing",
  191. fn: function (anObject){
  192. var self=this,$self=this;
  193. $self["@receiver"]=anObject;
  194. return self;
  195. },
  196. //>>excludeStart("ide", pragmas.excludeIdeData);
  197. args: ["anObject"],
  198. source: "receiver: anObject\x0a\x09receiver := anObject",
  199. referencedClasses: [],
  200. //>>excludeEnd("ide");
  201. messageSends: []
  202. }),
  203. $globals.AnnouncementValuable);
  204. $core.addMethod(
  205. $core.method({
  206. selector: "valuable",
  207. protocol: "accessing",
  208. fn: function (){
  209. var self=this,$self=this;
  210. return $self["@valuable"];
  211. },
  212. //>>excludeStart("ide", pragmas.excludeIdeData);
  213. args: [],
  214. source: "valuable\x0a\x09^ valuable",
  215. referencedClasses: [],
  216. //>>excludeEnd("ide");
  217. messageSends: []
  218. }),
  219. $globals.AnnouncementValuable);
  220. $core.addMethod(
  221. $core.method({
  222. selector: "valuable:",
  223. protocol: "accessing",
  224. fn: function (anObject){
  225. var self=this,$self=this;
  226. $self["@valuable"]=anObject;
  227. return self;
  228. },
  229. //>>excludeStart("ide", pragmas.excludeIdeData);
  230. args: ["anObject"],
  231. source: "valuable: anObject\x0a\x09valuable := anObject",
  232. referencedClasses: [],
  233. //>>excludeEnd("ide");
  234. messageSends: []
  235. }),
  236. $globals.AnnouncementValuable);
  237. $core.addMethod(
  238. $core.method({
  239. selector: "value",
  240. protocol: "evaluating",
  241. fn: function (){
  242. var self=this,$self=this;
  243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  244. return $core.withContext(function($ctx1) {
  245. //>>excludeEnd("ctx");
  246. return $recv($self._valuable())._value();
  247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  248. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  249. //>>excludeEnd("ctx");
  250. },
  251. //>>excludeStart("ide", pragmas.excludeIdeData);
  252. args: [],
  253. source: "value\x0a\x09^ self valuable value",
  254. referencedClasses: [],
  255. //>>excludeEnd("ide");
  256. messageSends: ["value", "valuable"]
  257. }),
  258. $globals.AnnouncementValuable);
  259. $core.addMethod(
  260. $core.method({
  261. selector: "value:",
  262. protocol: "evaluating",
  263. fn: function (anObject){
  264. var self=this,$self=this;
  265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  266. return $core.withContext(function($ctx1) {
  267. //>>excludeEnd("ctx");
  268. return $recv($self._valuable())._value_(anObject);
  269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  270. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  271. //>>excludeEnd("ctx");
  272. },
  273. //>>excludeStart("ide", pragmas.excludeIdeData);
  274. args: ["anObject"],
  275. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  276. referencedClasses: [],
  277. //>>excludeEnd("ide");
  278. messageSends: ["value:", "valuable"]
  279. }),
  280. $globals.AnnouncementValuable);
  281. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  282. //>>excludeStart("ide", pragmas.excludeIdeData);
  283. $globals.Announcer.comment="I hold annoncement subscriptions (instances of `AnnouncementSubscription`) in a private registry.\x0aI announce (trigger) announces, which are then dispatched to all subscriptions.\x0a\x0aThe code is based on the announcements as [described by Vassili Bykov](http://www.cincomsmalltalk.com/userblogs/vbykov/blogView?searchCategory=Announcements%20Framework).\x0a\x0a## API\x0a\x0aUse `#announce:` to trigger an announcement.\x0a\x0aUse `#on:do:` or `#on:send:to:` to register subscriptions.\x0a\x0aWhen using `#on:send:to:`, unregistration can be done with `#unregister:`.\x0a\x0a## Usage example:\x0a\x0a SystemAnnouncer current\x0a on: ClassAdded\x0a do: [ :ann | window alert: ann theClass name, ' added' ].";
  284. //>>excludeEnd("ide");
  285. $core.addMethod(
  286. $core.method({
  287. selector: "announce:",
  288. protocol: "announcing",
  289. fn: function (anAnnouncement){
  290. var self=this,$self=this;
  291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  292. return $core.withContext(function($ctx1) {
  293. //>>excludeEnd("ctx");
  294. $recv($self["@subscriptions"])._do_((function(each){
  295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  296. return $core.withContext(function($ctx2) {
  297. //>>excludeEnd("ctx");
  298. return $recv(each)._deliver_(anAnnouncement);
  299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  300. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  301. //>>excludeEnd("ctx");
  302. }));
  303. return self;
  304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  305. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  306. //>>excludeEnd("ctx");
  307. },
  308. //>>excludeStart("ide", pragmas.excludeIdeData);
  309. args: ["anAnnouncement"],
  310. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  311. referencedClasses: [],
  312. //>>excludeEnd("ide");
  313. messageSends: ["do:", "deliver:"]
  314. }),
  315. $globals.Announcer);
  316. $core.addMethod(
  317. $core.method({
  318. selector: "initialize",
  319. protocol: "initialization",
  320. fn: function (){
  321. var self=this,$self=this;
  322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  323. return $core.withContext(function($ctx1) {
  324. //>>excludeEnd("ctx");
  325. (
  326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  327. $ctx1.supercall = true,
  328. //>>excludeEnd("ctx");
  329. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  331. $ctx1.supercall = false;
  332. //>>excludeEnd("ctx");;
  333. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  334. return self;
  335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  336. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  337. //>>excludeEnd("ctx");
  338. },
  339. //>>excludeStart("ide", pragmas.excludeIdeData);
  340. args: [],
  341. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  342. referencedClasses: ["OrderedCollection"],
  343. //>>excludeEnd("ide");
  344. messageSends: ["initialize", "new"]
  345. }),
  346. $globals.Announcer);
  347. $core.addMethod(
  348. $core.method({
  349. selector: "on:do:",
  350. protocol: "subscribing",
  351. fn: function (aClass,aBlock){
  352. var self=this,$self=this;
  353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  354. return $core.withContext(function($ctx1) {
  355. //>>excludeEnd("ctx");
  356. $self._on_do_for_(aClass,aBlock,nil);
  357. return self;
  358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  359. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  360. //>>excludeEnd("ctx");
  361. },
  362. //>>excludeStart("ide", pragmas.excludeIdeData);
  363. args: ["aClass", "aBlock"],
  364. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  365. referencedClasses: [],
  366. //>>excludeEnd("ide");
  367. messageSends: ["on:do:for:"]
  368. }),
  369. $globals.Announcer);
  370. $core.addMethod(
  371. $core.method({
  372. selector: "on:do:for:",
  373. protocol: "subscribing",
  374. fn: function (aClass,aBlock,aReceiver){
  375. var self=this,$self=this;
  376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  377. return $core.withContext(function($ctx1) {
  378. //>>excludeEnd("ctx");
  379. var $1,$3,$5,$6,$4,$2;
  380. $1=$self["@subscriptions"];
  381. $3=$recv($globals.AnnouncementSubscription)._new();
  382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  383. $ctx1.sendIdx["new"]=1;
  384. //>>excludeEnd("ctx");
  385. $5=$recv($globals.AnnouncementValuable)._new();
  386. $recv($5)._valuable_(aBlock);
  387. $recv($5)._receiver_(aReceiver);
  388. $6=$recv($5)._yourself();
  389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  390. $ctx1.sendIdx["yourself"]=1;
  391. //>>excludeEnd("ctx");
  392. $4=$6;
  393. $recv($3)._valuable_($4);
  394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  395. $ctx1.sendIdx["valuable:"]=1;
  396. //>>excludeEnd("ctx");
  397. $recv($3)._announcementClass_(aClass);
  398. $2=$recv($3)._yourself();
  399. $recv($1)._add_($2);
  400. return self;
  401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  402. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  403. //>>excludeEnd("ctx");
  404. },
  405. //>>excludeStart("ide", pragmas.excludeIdeData);
  406. args: ["aClass", "aBlock", "aReceiver"],
  407. source: "on: aClass do: aBlock for: aReceiver\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (AnnouncementValuable new\x0a\x09\x09\x09valuable: aBlock;\x0a\x09\x09\x09receiver: aReceiver;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  408. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  409. //>>excludeEnd("ide");
  410. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  411. }),
  412. $globals.Announcer);
  413. $core.addMethod(
  414. $core.method({
  415. selector: "on:doOnce:",
  416. protocol: "subscribing",
  417. fn: function (aClass,aBlock){
  418. var self=this,$self=this;
  419. var subscription;
  420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  421. return $core.withContext(function($ctx1) {
  422. //>>excludeEnd("ctx");
  423. var $1;
  424. $1=$recv($globals.AnnouncementSubscription)._new();
  425. $recv($1)._announcementClass_(aClass);
  426. subscription=$recv($1)._yourself();
  427. $recv(subscription)._valuable_((function(ann){
  428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  429. return $core.withContext(function($ctx2) {
  430. //>>excludeEnd("ctx");
  431. $recv($self["@subscriptions"])._remove_(subscription);
  432. return $recv(aBlock)._value_(ann);
  433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  434. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  435. //>>excludeEnd("ctx");
  436. }));
  437. $recv($self["@subscriptions"])._add_(subscription);
  438. return self;
  439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  440. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  441. //>>excludeEnd("ctx");
  442. },
  443. //>>excludeStart("ide", pragmas.excludeIdeData);
  444. args: ["aClass", "aBlock"],
  445. source: "on: aClass doOnce: aBlock\x0a\x09| subscription |\x0a\x09\x0a\x09subscription := AnnouncementSubscription new\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself.\x0a\x09subscription valuable: [ :ann |\x0a\x09\x09subscriptions remove: subscription.\x0a\x09\x09aBlock value: ann ].\x0a\x0a\x09subscriptions add: subscription",
  446. referencedClasses: ["AnnouncementSubscription"],
  447. //>>excludeEnd("ide");
  448. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  449. }),
  450. $globals.Announcer);
  451. $core.addMethod(
  452. $core.method({
  453. selector: "on:send:to:",
  454. protocol: "subscribing",
  455. fn: function (aClass,aSelector,anObject){
  456. var self=this,$self=this;
  457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  458. return $core.withContext(function($ctx1) {
  459. //>>excludeEnd("ctx");
  460. var $1,$3,$5,$6,$4,$2;
  461. $1=$self["@subscriptions"];
  462. $3=$recv($globals.AnnouncementSubscription)._new();
  463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  464. $ctx1.sendIdx["new"]=1;
  465. //>>excludeEnd("ctx");
  466. $5=$recv($globals.MessageSend)._new();
  467. $recv($5)._receiver_(anObject);
  468. $recv($5)._selector_(aSelector);
  469. $6=$recv($5)._yourself();
  470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  471. $ctx1.sendIdx["yourself"]=1;
  472. //>>excludeEnd("ctx");
  473. $4=$6;
  474. $recv($3)._valuable_($4);
  475. $recv($3)._announcementClass_(aClass);
  476. $2=$recv($3)._yourself();
  477. $recv($1)._add_($2);
  478. return self;
  479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  480. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  481. //>>excludeEnd("ctx");
  482. },
  483. //>>excludeStart("ide", pragmas.excludeIdeData);
  484. args: ["aClass", "aSelector", "anObject"],
  485. source: "on: aClass send: aSelector to: anObject\x0a\x09subscriptions add: (AnnouncementSubscription new\x0a\x09\x09valuable: (MessageSend new\x0a\x09\x09\x09receiver: anObject;\x0a\x09\x09\x09selector: aSelector;\x0a\x09\x09\x09yourself);\x0a\x09\x09announcementClass: aClass;\x0a\x09\x09yourself)",
  486. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  487. //>>excludeEnd("ide");
  488. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  489. }),
  490. $globals.Announcer);
  491. $core.addMethod(
  492. $core.method({
  493. selector: "unsubscribe:",
  494. protocol: "subscribing",
  495. fn: function (anObject){
  496. var self=this,$self=this;
  497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  498. return $core.withContext(function($ctx1) {
  499. //>>excludeEnd("ctx");
  500. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  502. return $core.withContext(function($ctx2) {
  503. //>>excludeEnd("ctx");
  504. return $recv($recv(each)._receiver()).__eq(anObject);
  505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  507. //>>excludeEnd("ctx");
  508. }));
  509. return self;
  510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  511. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  512. //>>excludeEnd("ctx");
  513. },
  514. //>>excludeStart("ide", pragmas.excludeIdeData);
  515. args: ["anObject"],
  516. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  517. referencedClasses: [],
  518. //>>excludeEnd("ide");
  519. messageSends: ["reject:", "=", "receiver"]
  520. }),
  521. $globals.Announcer);
  522. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  523. //>>excludeStart("ide", pragmas.excludeIdeData);
  524. $globals.SystemAnnouncer.comment="My unique instance is the global announcer handling all Amber system-related announces.\x0a\x0a## API\x0a\x0aAccess to the unique instance is done via `#current`";
  525. //>>excludeEnd("ide");
  526. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  527. $core.addMethod(
  528. $core.method({
  529. selector: "current",
  530. protocol: "accessing",
  531. fn: function (){
  532. var self=this,$self=this;
  533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  534. return $core.withContext(function($ctx1) {
  535. //>>excludeEnd("ctx");
  536. var $1,$receiver;
  537. $1=$self["@current"];
  538. if(($receiver = $1) == null || $receiver.a$nil){
  539. $self["@current"]=(
  540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  541. $ctx1.supercall = true,
  542. //>>excludeEnd("ctx");
  543. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  545. $ctx1.supercall = false;
  546. //>>excludeEnd("ctx");;
  547. return $self["@current"];
  548. } else {
  549. return $1;
  550. }
  551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  552. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  553. //>>excludeEnd("ctx");
  554. },
  555. //>>excludeStart("ide", pragmas.excludeIdeData);
  556. args: [],
  557. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  558. referencedClasses: [],
  559. //>>excludeEnd("ide");
  560. messageSends: ["ifNil:", "new"]
  561. }),
  562. $globals.SystemAnnouncer.a$cls);
  563. $core.addMethod(
  564. $core.method({
  565. selector: "new",
  566. protocol: "instance creation",
  567. fn: function (){
  568. var self=this,$self=this;
  569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  570. return $core.withContext(function($ctx1) {
  571. //>>excludeEnd("ctx");
  572. $self._shouldNotImplement();
  573. return self;
  574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  575. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  576. //>>excludeEnd("ctx");
  577. },
  578. //>>excludeStart("ide", pragmas.excludeIdeData);
  579. args: [],
  580. source: "new\x0a\x09self shouldNotImplement",
  581. referencedClasses: [],
  582. //>>excludeEnd("ide");
  583. messageSends: ["shouldNotImplement"]
  584. }),
  585. $globals.SystemAnnouncer.a$cls);
  586. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  587. //>>excludeStart("ide", pragmas.excludeIdeData);
  588. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  589. //>>excludeEnd("ide");
  590. $core.addMethod(
  591. $core.method({
  592. selector: "classTag",
  593. protocol: "accessing",
  594. fn: function (){
  595. var self=this,$self=this;
  596. return "announcement";
  597. },
  598. //>>excludeStart("ide", pragmas.excludeIdeData);
  599. args: [],
  600. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'announcement'",
  601. referencedClasses: [],
  602. //>>excludeEnd("ide");
  603. messageSends: []
  604. }),
  605. $globals.SystemAnnouncement.a$cls);
  606. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  607. //>>excludeStart("ide", pragmas.excludeIdeData);
  608. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  609. //>>excludeEnd("ide");
  610. $core.addMethod(
  611. $core.method({
  612. selector: "theClass",
  613. protocol: "accessing",
  614. fn: function (){
  615. var self=this,$self=this;
  616. return $self["@theClass"];
  617. },
  618. //>>excludeStart("ide", pragmas.excludeIdeData);
  619. args: [],
  620. source: "theClass\x0a\x09^ theClass",
  621. referencedClasses: [],
  622. //>>excludeEnd("ide");
  623. messageSends: []
  624. }),
  625. $globals.ClassAnnouncement);
  626. $core.addMethod(
  627. $core.method({
  628. selector: "theClass:",
  629. protocol: "accessing",
  630. fn: function (aClass){
  631. var self=this,$self=this;
  632. $self["@theClass"]=aClass;
  633. return self;
  634. },
  635. //>>excludeStart("ide", pragmas.excludeIdeData);
  636. args: ["aClass"],
  637. source: "theClass: aClass\x0a\x09theClass := aClass",
  638. referencedClasses: [],
  639. //>>excludeEnd("ide");
  640. messageSends: []
  641. }),
  642. $globals.ClassAnnouncement);
  643. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  644. //>>excludeStart("ide", pragmas.excludeIdeData);
  645. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  646. //>>excludeEnd("ide");
  647. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  648. //>>excludeStart("ide", pragmas.excludeIdeData);
  649. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  650. //>>excludeEnd("ide");
  651. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  652. //>>excludeStart("ide", pragmas.excludeIdeData);
  653. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  654. //>>excludeEnd("ide");
  655. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  656. //>>excludeStart("ide", pragmas.excludeIdeData);
  657. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  658. //>>excludeEnd("ide");
  659. $core.addMethod(
  660. $core.method({
  661. selector: "oldClass",
  662. protocol: "accessing",
  663. fn: function (){
  664. var self=this,$self=this;
  665. return $self["@oldClass"];
  666. },
  667. //>>excludeStart("ide", pragmas.excludeIdeData);
  668. args: [],
  669. source: "oldClass\x0a\x09^ oldClass",
  670. referencedClasses: [],
  671. //>>excludeEnd("ide");
  672. messageSends: []
  673. }),
  674. $globals.ClassMigrated);
  675. $core.addMethod(
  676. $core.method({
  677. selector: "oldClass:",
  678. protocol: "accessing",
  679. fn: function (aClass){
  680. var self=this,$self=this;
  681. $self["@oldClass"]=aClass;
  682. return self;
  683. },
  684. //>>excludeStart("ide", pragmas.excludeIdeData);
  685. args: ["aClass"],
  686. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  687. referencedClasses: [],
  688. //>>excludeEnd("ide");
  689. messageSends: []
  690. }),
  691. $globals.ClassMigrated);
  692. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  693. //>>excludeStart("ide", pragmas.excludeIdeData);
  694. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  695. //>>excludeEnd("ide");
  696. $core.addMethod(
  697. $core.method({
  698. selector: "oldPackage",
  699. protocol: "accessing",
  700. fn: function (){
  701. var self=this,$self=this;
  702. return $self["@oldPackage"];
  703. },
  704. //>>excludeStart("ide", pragmas.excludeIdeData);
  705. args: [],
  706. source: "oldPackage\x0a\x09^ oldPackage",
  707. referencedClasses: [],
  708. //>>excludeEnd("ide");
  709. messageSends: []
  710. }),
  711. $globals.ClassMoved);
  712. $core.addMethod(
  713. $core.method({
  714. selector: "oldPackage:",
  715. protocol: "accessing",
  716. fn: function (aPackage){
  717. var self=this,$self=this;
  718. $self["@oldPackage"]=aPackage;
  719. return self;
  720. },
  721. //>>excludeStart("ide", pragmas.excludeIdeData);
  722. args: ["aPackage"],
  723. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  724. referencedClasses: [],
  725. //>>excludeEnd("ide");
  726. messageSends: []
  727. }),
  728. $globals.ClassMoved);
  729. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  730. //>>excludeStart("ide", pragmas.excludeIdeData);
  731. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  732. //>>excludeEnd("ide");
  733. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  734. //>>excludeStart("ide", pragmas.excludeIdeData);
  735. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  736. //>>excludeEnd("ide");
  737. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  738. //>>excludeStart("ide", pragmas.excludeIdeData);
  739. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  740. //>>excludeEnd("ide");
  741. $core.addMethod(
  742. $core.method({
  743. selector: "method",
  744. protocol: "accessing",
  745. fn: function (){
  746. var self=this,$self=this;
  747. return $self["@method"];
  748. },
  749. //>>excludeStart("ide", pragmas.excludeIdeData);
  750. args: [],
  751. source: "method\x0a\x09^ method",
  752. referencedClasses: [],
  753. //>>excludeEnd("ide");
  754. messageSends: []
  755. }),
  756. $globals.MethodAnnouncement);
  757. $core.addMethod(
  758. $core.method({
  759. selector: "method:",
  760. protocol: "accessing",
  761. fn: function (aCompiledMethod){
  762. var self=this,$self=this;
  763. $self["@method"]=aCompiledMethod;
  764. return self;
  765. },
  766. //>>excludeStart("ide", pragmas.excludeIdeData);
  767. args: ["aCompiledMethod"],
  768. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  769. referencedClasses: [],
  770. //>>excludeEnd("ide");
  771. messageSends: []
  772. }),
  773. $globals.MethodAnnouncement);
  774. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  775. //>>excludeStart("ide", pragmas.excludeIdeData);
  776. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  777. //>>excludeEnd("ide");
  778. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  779. //>>excludeStart("ide", pragmas.excludeIdeData);
  780. $globals.MethodModified.comment="I am emitted when a `CompiledMethod` is modified (a new method is installed). I hold a reference to the old method being replaced.";
  781. //>>excludeEnd("ide");
  782. $core.addMethod(
  783. $core.method({
  784. selector: "oldMethod",
  785. protocol: "accessing",
  786. fn: function (){
  787. var self=this,$self=this;
  788. return $self["@oldMethod"];
  789. },
  790. //>>excludeStart("ide", pragmas.excludeIdeData);
  791. args: [],
  792. source: "oldMethod\x0a\x09^ oldMethod",
  793. referencedClasses: [],
  794. //>>excludeEnd("ide");
  795. messageSends: []
  796. }),
  797. $globals.MethodModified);
  798. $core.addMethod(
  799. $core.method({
  800. selector: "oldMethod:",
  801. protocol: "accessing",
  802. fn: function (aMethod){
  803. var self=this,$self=this;
  804. $self["@oldMethod"]=aMethod;
  805. return self;
  806. },
  807. //>>excludeStart("ide", pragmas.excludeIdeData);
  808. args: ["aMethod"],
  809. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  810. referencedClasses: [],
  811. //>>excludeEnd("ide");
  812. messageSends: []
  813. }),
  814. $globals.MethodModified);
  815. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  816. //>>excludeStart("ide", pragmas.excludeIdeData);
  817. $globals.MethodMoved.comment="I am emitted when a `CompiledMethod` is moved to another protocol. I hold a refernce to the old protocol of the method.";
  818. //>>excludeEnd("ide");
  819. $core.addMethod(
  820. $core.method({
  821. selector: "oldProtocol",
  822. protocol: "accessing",
  823. fn: function (){
  824. var self=this,$self=this;
  825. return $self["@oldProtocol"];
  826. },
  827. //>>excludeStart("ide", pragmas.excludeIdeData);
  828. args: [],
  829. source: "oldProtocol\x0a\x09^ oldProtocol",
  830. referencedClasses: [],
  831. //>>excludeEnd("ide");
  832. messageSends: []
  833. }),
  834. $globals.MethodMoved);
  835. $core.addMethod(
  836. $core.method({
  837. selector: "oldProtocol:",
  838. protocol: "accessing",
  839. fn: function (aString){
  840. var self=this,$self=this;
  841. $self["@oldProtocol"]=aString;
  842. return self;
  843. },
  844. //>>excludeStart("ide", pragmas.excludeIdeData);
  845. args: ["aString"],
  846. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  847. referencedClasses: [],
  848. //>>excludeEnd("ide");
  849. messageSends: []
  850. }),
  851. $globals.MethodMoved);
  852. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  853. //>>excludeStart("ide", pragmas.excludeIdeData);
  854. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  855. //>>excludeEnd("ide");
  856. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  857. //>>excludeStart("ide", pragmas.excludeIdeData);
  858. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  859. //>>excludeEnd("ide");
  860. $core.addMethod(
  861. $core.method({
  862. selector: "package",
  863. protocol: "accessing",
  864. fn: function (){
  865. var self=this,$self=this;
  866. return $self["@package"];
  867. },
  868. //>>excludeStart("ide", pragmas.excludeIdeData);
  869. args: [],
  870. source: "package\x0a\x09^ package",
  871. referencedClasses: [],
  872. //>>excludeEnd("ide");
  873. messageSends: []
  874. }),
  875. $globals.PackageAnnouncement);
  876. $core.addMethod(
  877. $core.method({
  878. selector: "package:",
  879. protocol: "accessing",
  880. fn: function (aPackage){
  881. var self=this,$self=this;
  882. $self["@package"]=aPackage;
  883. return self;
  884. },
  885. //>>excludeStart("ide", pragmas.excludeIdeData);
  886. args: ["aPackage"],
  887. source: "package: aPackage\x0a\x09package := aPackage",
  888. referencedClasses: [],
  889. //>>excludeEnd("ide");
  890. messageSends: []
  891. }),
  892. $globals.PackageAnnouncement);
  893. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  894. //>>excludeStart("ide", pragmas.excludeIdeData);
  895. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  896. //>>excludeEnd("ide");
  897. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  898. //>>excludeStart("ide", pragmas.excludeIdeData);
  899. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  900. //>>excludeEnd("ide");
  901. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  902. //>>excludeStart("ide", pragmas.excludeIdeData);
  903. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  904. //>>excludeEnd("ide");
  905. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  906. //>>excludeStart("ide", pragmas.excludeIdeData);
  907. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  908. //>>excludeEnd("ide");
  909. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  910. //>>excludeStart("ide", pragmas.excludeIdeData);
  911. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  912. //>>excludeEnd("ide");
  913. $core.addMethod(
  914. $core.method({
  915. selector: "package",
  916. protocol: "accessing",
  917. fn: function (){
  918. var self=this,$self=this;
  919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  920. return $core.withContext(function($ctx1) {
  921. //>>excludeEnd("ctx");
  922. var $1,$receiver;
  923. $1=$self._theClass();
  924. if(($receiver = $1) == null || $receiver.a$nil){
  925. return $1;
  926. } else {
  927. var class_;
  928. class_=$receiver;
  929. return $recv(class_)._packageOfProtocol_($self._protocol());
  930. }
  931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  932. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  933. //>>excludeEnd("ctx");
  934. },
  935. //>>excludeStart("ide", pragmas.excludeIdeData);
  936. args: [],
  937. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  938. referencedClasses: [],
  939. //>>excludeEnd("ide");
  940. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  941. }),
  942. $globals.ProtocolAnnouncement);
  943. $core.addMethod(
  944. $core.method({
  945. selector: "protocol",
  946. protocol: "accessing",
  947. fn: function (){
  948. var self=this,$self=this;
  949. return $self["@protocol"];
  950. },
  951. //>>excludeStart("ide", pragmas.excludeIdeData);
  952. args: [],
  953. source: "protocol\x0a\x09^ protocol",
  954. referencedClasses: [],
  955. //>>excludeEnd("ide");
  956. messageSends: []
  957. }),
  958. $globals.ProtocolAnnouncement);
  959. $core.addMethod(
  960. $core.method({
  961. selector: "protocol:",
  962. protocol: "accessing",
  963. fn: function (aString){
  964. var self=this,$self=this;
  965. $self["@protocol"]=aString;
  966. return self;
  967. },
  968. //>>excludeStart("ide", pragmas.excludeIdeData);
  969. args: ["aString"],
  970. source: "protocol: aString\x0a\x09protocol := aString",
  971. referencedClasses: [],
  972. //>>excludeEnd("ide");
  973. messageSends: []
  974. }),
  975. $globals.ProtocolAnnouncement);
  976. $core.addMethod(
  977. $core.method({
  978. selector: "theClass",
  979. protocol: "accessing",
  980. fn: function (){
  981. var self=this,$self=this;
  982. return $self["@theClass"];
  983. },
  984. //>>excludeStart("ide", pragmas.excludeIdeData);
  985. args: [],
  986. source: "theClass\x0a\x09^ theClass",
  987. referencedClasses: [],
  988. //>>excludeEnd("ide");
  989. messageSends: []
  990. }),
  991. $globals.ProtocolAnnouncement);
  992. $core.addMethod(
  993. $core.method({
  994. selector: "theClass:",
  995. protocol: "accessing",
  996. fn: function (aClass){
  997. var self=this,$self=this;
  998. $self["@theClass"]=aClass;
  999. return self;
  1000. },
  1001. //>>excludeStart("ide", pragmas.excludeIdeData);
  1002. args: ["aClass"],
  1003. source: "theClass: aClass\x0a\x09theClass := aClass",
  1004. referencedClasses: [],
  1005. //>>excludeEnd("ide");
  1006. messageSends: []
  1007. }),
  1008. $globals.ProtocolAnnouncement);
  1009. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  1010. //>>excludeStart("ide", pragmas.excludeIdeData);
  1011. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  1012. //>>excludeEnd("ide");
  1013. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  1014. //>>excludeStart("ide", pragmas.excludeIdeData);
  1015. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  1016. //>>excludeEnd("ide");
  1017. });