Helios-Workspace.js 90 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392
  1. define("amber_core/Helios-Workspace", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Helios-Core"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Helios-Workspace');
  3. smalltalk.packages["Helios-Workspace"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('HLCodeModel', globals.Object, ['announcer', 'environment', 'receiver'], 'Helios-Workspace');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "announcer",
  8. protocol: 'accessing',
  9. fn: function (){
  10. var self=this;
  11. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  12. return smalltalk.withContext(function($ctx1) {
  13. var $2,$1;
  14. $2=self["@announcer"];
  15. if(($receiver = $2) == nil || $receiver == null){
  16. self["@announcer"]=_st($Announcer())._new();
  17. $1=self["@announcer"];
  18. } else {
  19. $1=$2;
  20. };
  21. return $1;
  22. }, function($ctx1) {$ctx1.fill(self,"announcer",{},globals.HLCodeModel)})},
  23. args: [],
  24. source: "announcer\x0a\x09^ announcer ifNil: [ announcer := Announcer new ]",
  25. messageSends: ["ifNil:", "new"],
  26. referencedClasses: ["Announcer"]
  27. }),
  28. globals.HLCodeModel);
  29. smalltalk.addMethod(
  30. smalltalk.method({
  31. selector: "defaultReceiver",
  32. protocol: 'defaults',
  33. fn: function (){
  34. var self=this;
  35. return smalltalk.withContext(function($ctx1) {
  36. var $1;
  37. $1=_st(self._environment())._doItReceiver();
  38. return $1;
  39. }, function($ctx1) {$ctx1.fill(self,"defaultReceiver",{},globals.HLCodeModel)})},
  40. args: [],
  41. source: "defaultReceiver\x0a\x09^ self environment doItReceiver",
  42. messageSends: ["doItReceiver", "environment"],
  43. referencedClasses: []
  44. }),
  45. globals.HLCodeModel);
  46. smalltalk.addMethod(
  47. smalltalk.method({
  48. selector: "doIt:",
  49. protocol: 'actions',
  50. fn: function (aString){
  51. var self=this;
  52. function $ErrorHandler(){return globals.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  53. return smalltalk.withContext(function($ctx1) {
  54. var $1;
  55. $1=self._try_catch_((function(){
  56. return smalltalk.withContext(function($ctx2) {
  57. return _st(self._environment())._eval_on_(aString,self._receiver());
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(e){
  59. return smalltalk.withContext(function($ctx2) {
  60. _st($ErrorHandler())._handleError_(e);
  61. return nil;
  62. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,2)})}));
  63. return $1;
  64. }, function($ctx1) {$ctx1.fill(self,"doIt:",{aString:aString},globals.HLCodeModel)})},
  65. args: ["aString"],
  66. source: "doIt: aString\x0a\x09\x22Evaluate aString in the receiver's `environment`.\x0a\x09\x0a\x09Note: Catch any error and handle it manually, bypassing\x0a\x09boot.js behavior to avoid the browser default action on\x0a\x09ctrl+d/ctrl+p.\x0a\x09\x0a\x09See https://github.com/amber-smalltalk/amber/issues/882\x22\x0a\x0a\x09^ self \x0a\x09\x09try: [ self environment eval: aString on: self receiver ]\x0a\x09\x09catch: [ :e | \x0a\x09\x09\x09ErrorHandler handleError: e.\x0a\x09\x09\x09nil ]",
  67. messageSends: ["try:catch:", "eval:on:", "environment", "receiver", "handleError:"],
  68. referencedClasses: ["ErrorHandler"]
  69. }),
  70. globals.HLCodeModel);
  71. smalltalk.addMethod(
  72. smalltalk.method({
  73. selector: "environment",
  74. protocol: 'accessing',
  75. fn: function (){
  76. var self=this;
  77. function $HLManager(){return globals.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
  78. return smalltalk.withContext(function($ctx1) {
  79. var $2,$1;
  80. $2=self["@environment"];
  81. if(($receiver = $2) == nil || $receiver == null){
  82. $1=_st(_st($HLManager())._current())._environment();
  83. } else {
  84. $1=$2;
  85. };
  86. return $1;
  87. }, function($ctx1) {$ctx1.fill(self,"environment",{},globals.HLCodeModel)})},
  88. args: [],
  89. source: "environment\x0a\x09^ environment ifNil: [ HLManager current environment ]",
  90. messageSends: ["ifNil:", "environment", "current"],
  91. referencedClasses: ["HLManager"]
  92. }),
  93. globals.HLCodeModel);
  94. smalltalk.addMethod(
  95. smalltalk.method({
  96. selector: "environment:",
  97. protocol: 'accessing',
  98. fn: function (anEnvironment){
  99. var self=this;
  100. self["@environment"]=anEnvironment;
  101. return self},
  102. args: ["anEnvironment"],
  103. source: "environment: anEnvironment\x0a\x09environment := anEnvironment",
  104. messageSends: [],
  105. referencedClasses: []
  106. }),
  107. globals.HLCodeModel);
  108. smalltalk.addMethod(
  109. smalltalk.method({
  110. selector: "inspect:",
  111. protocol: 'actions',
  112. fn: function (anObject){
  113. var self=this;
  114. return smalltalk.withContext(function($ctx1) {
  115. _st(self._environment())._inspect_(anObject);
  116. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},globals.HLCodeModel)})},
  117. args: ["anObject"],
  118. source: "inspect: anObject\x0a\x09self environment inspect: anObject",
  119. messageSends: ["inspect:", "environment"],
  120. referencedClasses: []
  121. }),
  122. globals.HLCodeModel);
  123. smalltalk.addMethod(
  124. smalltalk.method({
  125. selector: "receiver",
  126. protocol: 'accessing',
  127. fn: function (){
  128. var self=this;
  129. return smalltalk.withContext(function($ctx1) {
  130. var $2,$1;
  131. $2=self["@receiver"];
  132. if(($receiver = $2) == nil || $receiver == null){
  133. self["@receiver"]=self._defaultReceiver();
  134. $1=self["@receiver"];
  135. } else {
  136. $1=$2;
  137. };
  138. return $1;
  139. }, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.HLCodeModel)})},
  140. args: [],
  141. source: "receiver\x0a\x09^ receiver ifNil: [ receiver := self defaultReceiver ]",
  142. messageSends: ["ifNil:", "defaultReceiver"],
  143. referencedClasses: []
  144. }),
  145. globals.HLCodeModel);
  146. smalltalk.addMethod(
  147. smalltalk.method({
  148. selector: "receiver:",
  149. protocol: 'accessing',
  150. fn: function (anObject){
  151. var self=this;
  152. self["@receiver"]=anObject;
  153. return self},
  154. args: ["anObject"],
  155. source: "receiver: anObject\x0a\x09receiver := anObject",
  156. messageSends: [],
  157. referencedClasses: []
  158. }),
  159. globals.HLCodeModel);
  160. smalltalk.addMethod(
  161. smalltalk.method({
  162. selector: "on:",
  163. protocol: 'actions',
  164. fn: function (anEnvironment){
  165. var self=this;
  166. return smalltalk.withContext(function($ctx1) {
  167. var $2,$3,$1;
  168. $2=self._new();
  169. _st($2)._environment_(anEnvironment);
  170. $3=_st($2)._yourself();
  171. $1=$3;
  172. return $1;
  173. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment},globals.HLCodeModel.klass)})},
  174. args: ["anEnvironment"],
  175. source: "on: anEnvironment\x0a\x0a\x09^ self new\x0a \x09environment: anEnvironment;\x0a yourself",
  176. messageSends: ["environment:", "new", "yourself"],
  177. referencedClasses: []
  178. }),
  179. globals.HLCodeModel.klass);
  180. smalltalk.addClass('HLCodeWidget', globals.HLWidget, ['model', 'wrapper', 'code', 'editor', 'state'], 'Helios-Workspace');
  181. smalltalk.addMethod(
  182. smalltalk.method({
  183. selector: "announcer",
  184. protocol: 'accessing',
  185. fn: function (){
  186. var self=this;
  187. return smalltalk.withContext(function($ctx1) {
  188. var $1;
  189. $1=_st(self._model())._announcer();
  190. return $1;
  191. }, function($ctx1) {$ctx1.fill(self,"announcer",{},globals.HLCodeWidget)})},
  192. args: [],
  193. source: "announcer\x0a\x09^ self model announcer",
  194. messageSends: ["announcer", "model"],
  195. referencedClasses: []
  196. }),
  197. globals.HLCodeWidget);
  198. smalltalk.addMethod(
  199. smalltalk.method({
  200. selector: "canHaveFocus",
  201. protocol: 'testing',
  202. fn: function (){
  203. var self=this;
  204. return true;
  205. },
  206. args: [],
  207. source: "canHaveFocus\x0a\x09^ true",
  208. messageSends: [],
  209. referencedClasses: []
  210. }),
  211. globals.HLCodeWidget);
  212. smalltalk.addMethod(
  213. smalltalk.method({
  214. selector: "clear",
  215. protocol: 'actions',
  216. fn: function (){
  217. var self=this;
  218. return smalltalk.withContext(function($ctx1) {
  219. self._contents_("");
  220. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},globals.HLCodeWidget)})},
  221. args: [],
  222. source: "clear\x0a\x09self contents: ''",
  223. messageSends: ["contents:"],
  224. referencedClasses: []
  225. }),
  226. globals.HLCodeWidget);
  227. smalltalk.addMethod(
  228. smalltalk.method({
  229. selector: "configureEditor",
  230. protocol: 'actions',
  231. fn: function (){
  232. var self=this;
  233. return smalltalk.withContext(function($ctx1) {
  234. var $1,$2,$3,$4;
  235. $1=self._editor();
  236. $ctx1.sendIdx["editor"]=1;
  237. _st($1)._at_put_("amberCodeWidget",self);
  238. $2=self._editor();
  239. $ctx1.sendIdx["editor"]=2;
  240. _st($2)._on_do_("change",(function(){
  241. return smalltalk.withContext(function($ctx2) {
  242. return self._onChange();
  243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  244. $ctx1.sendIdx["on:do:"]=1;
  245. $3=self._editor();
  246. $ctx1.sendIdx["editor"]=3;
  247. _st($3)._on_do_("mousedown",(function(cm,event){
  248. var position,node;
  249. return smalltalk.withContext(function($ctx2) {
  250. $4=_st(event)._at_("ctrlKey");
  251. if(smalltalk.assert($4)){
  252. position=_st(self._editor())._coordsChar_(globals.HashedCollection._newFromPairs_(["left",_st(event)._clientX(),"top",_st(event)._clientY()]));
  253. position;
  254. self._onCtrlClickAt_(_st(_st(_st(position)._line()).__at(_st(position)._ch())).__plus((1)));
  255. return _st(event)._preventDefault();
  256. };
  257. }, function($ctx2) {$ctx2.fillBlock({cm:cm,event:event,position:position,node:node},$ctx1,2)})}));
  258. return self}, function($ctx1) {$ctx1.fill(self,"configureEditor",{},globals.HLCodeWidget)})},
  259. args: [],
  260. source: "configureEditor\x0a\x09self editor at: 'amberCodeWidget' put: self.\x0a\x09self editor on: 'change' do: [ self onChange ].\x0a\x09self editor on: 'mousedown' do: [ :cm :event | | position node |\x0a\x09\x09(event at: 'ctrlKey') ifTrue: [\x0a\x09\x09\x09position := self editor coordsChar: #{ \x0a\x09\x09\x09\x09'left' -> event clientX.\x0a\x09\x09\x09\x09'top' -> event clientY\x0a\x09\x09\x09}.\x0a\x09\x09\x09self onCtrlClickAt: (position line @ position ch) + 1.\x0a\x09\x09\x09event preventDefault ] ]",
  261. messageSends: ["at:put:", "editor", "on:do:", "onChange", "ifTrue:", "at:", "coordsChar:", "clientX", "clientY", "onCtrlClickAt:", "+", "@", "line", "ch", "preventDefault"],
  262. referencedClasses: []
  263. }),
  264. globals.HLCodeWidget);
  265. smalltalk.addMethod(
  266. smalltalk.method({
  267. selector: "contents",
  268. protocol: 'accessing',
  269. fn: function (){
  270. var self=this;
  271. return smalltalk.withContext(function($ctx1) {
  272. var $1;
  273. $1=_st(self["@editor"])._getValue();
  274. return $1;
  275. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.HLCodeWidget)})},
  276. args: [],
  277. source: "contents\x0a\x09^ editor getValue",
  278. messageSends: ["getValue"],
  279. referencedClasses: []
  280. }),
  281. globals.HLCodeWidget);
  282. smalltalk.addMethod(
  283. smalltalk.method({
  284. selector: "contents:",
  285. protocol: 'accessing',
  286. fn: function (aString){
  287. var self=this;
  288. return smalltalk.withContext(function($ctx1) {
  289. var $1;
  290. _st(self["@editor"])._setValue_(aString);
  291. $1=self["@state"];
  292. if(($receiver = $1) == nil || $receiver == null){
  293. $1;
  294. } else {
  295. self._updateState();
  296. };
  297. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},globals.HLCodeWidget)})},
  298. args: ["aString"],
  299. source: "contents: aString\x0a\x09editor setValue: aString.\x0a\x09state ifNotNil: [ self updateState ]",
  300. messageSends: ["setValue:", "ifNotNil:", "updateState"],
  301. referencedClasses: []
  302. }),
  303. globals.HLCodeWidget);
  304. smalltalk.addMethod(
  305. smalltalk.method({
  306. selector: "currentLine",
  307. protocol: 'accessing',
  308. fn: function (){
  309. var self=this;
  310. return smalltalk.withContext(function($ctx1) {
  311. var $1;
  312. $1=_st(self["@editor"])._getLine_(_st(_st(self["@editor"])._getCursor())._line());
  313. return $1;
  314. }, function($ctx1) {$ctx1.fill(self,"currentLine",{},globals.HLCodeWidget)})},
  315. args: [],
  316. source: "currentLine\x0a ^editor getLine: (editor getCursor line)",
  317. messageSends: ["getLine:", "line", "getCursor"],
  318. referencedClasses: []
  319. }),
  320. globals.HLCodeWidget);
  321. smalltalk.addMethod(
  322. smalltalk.method({
  323. selector: "currentLineOrSelection",
  324. protocol: 'accessing',
  325. fn: function (){
  326. var self=this;
  327. return smalltalk.withContext(function($ctx1) {
  328. var $2,$1;
  329. $2=_st(self["@editor"])._somethingSelected();
  330. if(smalltalk.assert($2)){
  331. $1=self._selection();
  332. } else {
  333. $1=self._currentLine();
  334. };
  335. return $1;
  336. }, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{},globals.HLCodeWidget)})},
  337. args: [],
  338. source: "currentLineOrSelection\x0a ^editor somethingSelected\x0a\x09\x09ifFalse: [ self currentLine ]\x0a\x09\x09ifTrue: [ self selection ]",
  339. messageSends: ["ifFalse:ifTrue:", "somethingSelected", "currentLine", "selection"],
  340. referencedClasses: []
  341. }),
  342. globals.HLCodeWidget);
  343. smalltalk.addMethod(
  344. smalltalk.method({
  345. selector: "doIt",
  346. protocol: 'actions',
  347. fn: function (){
  348. var self=this;
  349. var result;
  350. function $HLDoItRequested(){return globals.HLDoItRequested||(typeof HLDoItRequested=="undefined"?nil:HLDoItRequested)}
  351. function $HLDoItExecuted(){return globals.HLDoItExecuted||(typeof HLDoItExecuted=="undefined"?nil:HLDoItExecuted)}
  352. return smalltalk.withContext(function($ctx1) {
  353. var $2,$1,$3,$4;
  354. $2=self._model();
  355. $ctx1.sendIdx["model"]=1;
  356. $1=_st($2)._announcer();
  357. $ctx1.sendIdx["announcer"]=1;
  358. $3=_st($HLDoItRequested())._on_(self["@model"]);
  359. $ctx1.sendIdx["on:"]=1;
  360. _st($1)._announce_($3);
  361. $ctx1.sendIdx["announce:"]=1;
  362. result=_st(self["@model"])._doIt_(self._currentLineOrSelection());
  363. _st(_st(self._model())._announcer())._announce_(_st($HLDoItExecuted())._on_(self["@model"]));
  364. $4=result;
  365. return $4;
  366. }, function($ctx1) {$ctx1.fill(self,"doIt",{result:result},globals.HLCodeWidget)})},
  367. args: [],
  368. source: "doIt\x0a\x09| result |\x0a\x0a\x09self model announcer announce: (HLDoItRequested on: model).\x0a\x09result := model doIt: self currentLineOrSelection.\x0a\x09self model announcer announce: (HLDoItExecuted on: model).\x0a\x0a\x09^ result",
  369. messageSends: ["announce:", "announcer", "model", "on:", "doIt:", "currentLineOrSelection"],
  370. referencedClasses: ["HLDoItRequested", "HLDoItExecuted"]
  371. }),
  372. globals.HLCodeWidget);
  373. smalltalk.addMethod(
  374. smalltalk.method({
  375. selector: "editor",
  376. protocol: 'actions',
  377. fn: function (){
  378. var self=this;
  379. var $1;
  380. $1=self["@editor"];
  381. return $1;
  382. },
  383. args: [],
  384. source: "editor\x0a\x09^ editor",
  385. messageSends: [],
  386. referencedClasses: []
  387. }),
  388. globals.HLCodeWidget);
  389. smalltalk.addMethod(
  390. smalltalk.method({
  391. selector: "editorOptions",
  392. protocol: 'accessing',
  393. fn: function (){
  394. var self=this;
  395. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  396. return smalltalk.withContext(function($ctx1) {
  397. var $2,$1;
  398. $2="helios.codeMirrorTheme"._settingValueIfAbsent_("default helios");
  399. $ctx1.sendIdx["settingValueIfAbsent:"]=1;
  400. $1=globals.HashedCollection._newFromPairs_(["theme",$2,"mode","text/x-stsrc","lineNumbers",true,"enterMode","flat","indentWithTabs",true,"indentUnit",(4),"matchBrackets",true,"electricChars",false,"keyMap","Amber","extraKeys",_st($HashedCollection())._with_(_st("helios.completionKey"._settingValueIfAbsent_("Shift-Space")).__minus_gt("autocomplete"))]);
  401. return $1;
  402. }, function($ctx1) {$ctx1.fill(self,"editorOptions",{},globals.HLCodeWidget)})},
  403. args: [],
  404. source: "editorOptions\x0a\x09^ #{\x0a\x09\x09'theme' -> ('helios.codeMirrorTheme' settingValueIfAbsent: 'default helios').\x0a\x09\x09'mode' -> 'text/x-stsrc'.\x0a 'lineNumbers' -> true.\x0a 'enterMode' -> 'flat'.\x0a 'indentWithTabs' -> true.\x0a\x09\x09'indentUnit' -> 4.\x0a 'matchBrackets' -> true.\x0a 'electricChars' -> false.\x0a\x09\x09'keyMap' -> 'Amber'.\x0a\x09\x09'extraKeys' -> (HashedCollection with: ('helios.completionKey' settingValueIfAbsent: 'Shift-Space') -> 'autocomplete')\x0a\x09}",
  405. messageSends: ["settingValueIfAbsent:", "with:", "->"],
  406. referencedClasses: ["HashedCollection"]
  407. }),
  408. globals.HLCodeWidget);
  409. smalltalk.addMethod(
  410. smalltalk.method({
  411. selector: "focus",
  412. protocol: 'actions',
  413. fn: function (){
  414. var self=this;
  415. return smalltalk.withContext(function($ctx1) {
  416. _st(self["@editor"])._focus();
  417. return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLCodeWidget)})},
  418. args: [],
  419. source: "focus\x0a\x09editor focus",
  420. messageSends: ["focus"],
  421. referencedClasses: []
  422. }),
  423. globals.HLCodeWidget);
  424. smalltalk.addMethod(
  425. smalltalk.method({
  426. selector: "hasFocus",
  427. protocol: 'testing',
  428. fn: function (){
  429. var self=this;
  430. return smalltalk.withContext(function($ctx1) {
  431. var $1;
  432. $1=_st(_st(self["@code"])._asJQuery())._is_(":active");
  433. return $1;
  434. }, function($ctx1) {$ctx1.fill(self,"hasFocus",{},globals.HLCodeWidget)})},
  435. args: [],
  436. source: "hasFocus\x0a\x09^ code asJQuery is: ':active'",
  437. messageSends: ["is:", "asJQuery"],
  438. referencedClasses: []
  439. }),
  440. globals.HLCodeWidget);
  441. smalltalk.addMethod(
  442. smalltalk.method({
  443. selector: "hasModification",
  444. protocol: 'testing',
  445. fn: function (){
  446. var self=this;
  447. return false;
  448. },
  449. args: [],
  450. source: "hasModification\x0a\x09^ false",
  451. messageSends: [],
  452. referencedClasses: []
  453. }),
  454. globals.HLCodeWidget);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "inspectIt",
  458. protocol: 'actions',
  459. fn: function (){
  460. var self=this;
  461. var newInspector;
  462. function $HLInspectItRequested(){return globals.HLInspectItRequested||(typeof HLInspectItRequested=="undefined"?nil:HLInspectItRequested)}
  463. return smalltalk.withContext(function($ctx1) {
  464. var $2,$1;
  465. $2=self._model();
  466. $ctx1.sendIdx["model"]=1;
  467. $1=_st($2)._announcer();
  468. _st($1)._announce_(_st($HLInspectItRequested())._on_(self["@model"]));
  469. _st(self._model())._inspect_(self._doIt());
  470. return self}, function($ctx1) {$ctx1.fill(self,"inspectIt",{newInspector:newInspector},globals.HLCodeWidget)})},
  471. args: [],
  472. source: "inspectIt\x0a\x09| newInspector |\x0a \x0a\x09self model announcer announce: (HLInspectItRequested on: model).\x0a\x09self model inspect: self doIt",
  473. messageSends: ["announce:", "announcer", "model", "on:", "inspect:", "doIt"],
  474. referencedClasses: ["HLInspectItRequested"]
  475. }),
  476. globals.HLCodeWidget);
  477. smalltalk.addMethod(
  478. smalltalk.method({
  479. selector: "messageHintFor:token:",
  480. protocol: 'hints',
  481. fn: function (anEditor,aToken){
  482. var self=this;
  483. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  484. return smalltalk.withContext(function($ctx1) {
  485. var $2,$1;
  486. $1=_st(_st(_st(_st(_st($Smalltalk())._vm())._allSelectors())._asArray())._select_((function(each){
  487. return smalltalk.withContext(function($ctx2) {
  488. $2=_st(aToken)._string();
  489. $ctx2.sendIdx["string"]=1;
  490. return _st(each)._includesSubString_($2);
  491. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})))._reject_((function(each){
  492. return smalltalk.withContext(function($ctx2) {
  493. return _st(each).__eq(_st(aToken)._string());
  494. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  495. return $1;
  496. }, function($ctx1) {$ctx1.fill(self,"messageHintFor:token:",{anEditor:anEditor,aToken:aToken},globals.HLCodeWidget)})},
  497. args: ["anEditor", "aToken"],
  498. source: "messageHintFor: anEditor token: aToken\x0a\x09^ (Smalltalk vm allSelectors asArray \x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
  499. messageSends: ["reject:", "select:", "asArray", "allSelectors", "vm", "includesSubString:", "string", "="],
  500. referencedClasses: ["Smalltalk"]
  501. }),
  502. globals.HLCodeWidget);
  503. smalltalk.addMethod(
  504. smalltalk.method({
  505. selector: "model",
  506. protocol: 'accessing',
  507. fn: function (){
  508. var self=this;
  509. function $HLCodeModel(){return globals.HLCodeModel||(typeof HLCodeModel=="undefined"?nil:HLCodeModel)}
  510. return smalltalk.withContext(function($ctx1) {
  511. var $2,$1;
  512. $2=self["@model"];
  513. if(($receiver = $2) == nil || $receiver == null){
  514. self["@model"]=_st($HLCodeModel())._new();
  515. $1=self["@model"];
  516. } else {
  517. $1=$2;
  518. };
  519. return $1;
  520. }, function($ctx1) {$ctx1.fill(self,"model",{},globals.HLCodeWidget)})},
  521. args: [],
  522. source: "model\x0a\x09^ model ifNil: [ model := HLCodeModel new ]",
  523. messageSends: ["ifNil:", "new"],
  524. referencedClasses: ["HLCodeModel"]
  525. }),
  526. globals.HLCodeWidget);
  527. smalltalk.addMethod(
  528. smalltalk.method({
  529. selector: "model:",
  530. protocol: 'accessing',
  531. fn: function (aModel){
  532. var self=this;
  533. self["@model"]=aModel;
  534. return self},
  535. args: ["aModel"],
  536. source: "model: aModel\x0a\x09model := aModel",
  537. messageSends: [],
  538. referencedClasses: []
  539. }),
  540. globals.HLCodeWidget);
  541. smalltalk.addMethod(
  542. smalltalk.method({
  543. selector: "navigateTo:",
  544. protocol: 'actions',
  545. fn: function (aString){
  546. var self=this;
  547. var navigationClass;
  548. return smalltalk.withContext(function($ctx1) {
  549. var $1;
  550. navigationClass=_st(_st(_st(self._model())._environment())._classes())._detect_ifNone_((function(each){
  551. return smalltalk.withContext(function($ctx2) {
  552. return _st(_st(each)._name()).__eq(aString);
  553. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  554. return nil;
  555. }));
  556. $1=navigationClass;
  557. if(($receiver = $1) == nil || $receiver == null){
  558. self._navigateToReference_(aString);
  559. } else {
  560. self._navigateToClass_(navigationClass);
  561. };
  562. return self}, function($ctx1) {$ctx1.fill(self,"navigateTo:",{aString:aString,navigationClass:navigationClass},globals.HLCodeWidget)})},
  563. args: ["aString"],
  564. source: "navigateTo: aString\x0a\x09| navigationClass |\x0a\x09\x0a\x09navigationClass := self model environment classes \x0a\x09\x09detect: [ :each | each name = aString ]\x0a\x09\x09ifNone: [ nil ].\x0a\x09\x09\x0a\x09navigationClass \x0a\x09\x09ifNil: [ self navigateToReference: aString ]\x0a\x09\x09ifNotNil: [ self navigateToClass: navigationClass ]",
  565. messageSends: ["detect:ifNone:", "classes", "environment", "model", "=", "name", "ifNil:ifNotNil:", "navigateToReference:", "navigateToClass:"],
  566. referencedClasses: []
  567. }),
  568. globals.HLCodeWidget);
  569. smalltalk.addMethod(
  570. smalltalk.method({
  571. selector: "navigateToClass:",
  572. protocol: 'actions',
  573. fn: function (aClass){
  574. var self=this;
  575. function $HLBrowser(){return globals.HLBrowser||(typeof HLBrowser=="undefined"?nil:HLBrowser)}
  576. return smalltalk.withContext(function($ctx1) {
  577. _st(_st($HLBrowser())._openAsTab())._browseClass_(aClass);
  578. return self}, function($ctx1) {$ctx1.fill(self,"navigateToClass:",{aClass:aClass},globals.HLCodeWidget)})},
  579. args: ["aClass"],
  580. source: "navigateToClass: aClass\x0a\x09(HLBrowser openAsTab)\x0a\x09\x09browseClass: aClass",
  581. messageSends: ["browseClass:", "openAsTab"],
  582. referencedClasses: ["HLBrowser"]
  583. }),
  584. globals.HLCodeWidget);
  585. smalltalk.addMethod(
  586. smalltalk.method({
  587. selector: "navigateToReference:",
  588. protocol: 'actions',
  589. fn: function (aString){
  590. var self=this;
  591. function $HLReferences(){return globals.HLReferences||(typeof HLReferences=="undefined"?nil:HLReferences)}
  592. return smalltalk.withContext(function($ctx1) {
  593. _st(_st($HLReferences())._openAsTab())._search_(aString);
  594. return self}, function($ctx1) {$ctx1.fill(self,"navigateToReference:",{aString:aString},globals.HLCodeWidget)})},
  595. args: ["aString"],
  596. source: "navigateToReference: aString\x0a\x09(HLReferences openAsTab)\x0a\x09\x09search: aString",
  597. messageSends: ["search:", "openAsTab"],
  598. referencedClasses: ["HLReferences"]
  599. }),
  600. globals.HLCodeWidget);
  601. smalltalk.addMethod(
  602. smalltalk.method({
  603. selector: "onChange",
  604. protocol: 'reactions',
  605. fn: function (){
  606. var self=this;
  607. return smalltalk.withContext(function($ctx1) {
  608. self._updateState();
  609. return self}, function($ctx1) {$ctx1.fill(self,"onChange",{},globals.HLCodeWidget)})},
  610. args: [],
  611. source: "onChange\x0a\x09self updateState",
  612. messageSends: ["updateState"],
  613. referencedClasses: []
  614. }),
  615. globals.HLCodeWidget);
  616. smalltalk.addMethod(
  617. smalltalk.method({
  618. selector: "onCtrlClickAt:",
  619. protocol: 'reactions',
  620. fn: function (aPosition){
  621. var self=this;
  622. var ast,node;
  623. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  624. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  625. return smalltalk.withContext(function($ctx1) {
  626. var $1,$2;
  627. var $early={};
  628. try {
  629. ast=_st((function(){
  630. return smalltalk.withContext(function($ctx2) {
  631. return _st($Smalltalk())._parse_(_st(self._editor())._getValue());
  632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  633. throw $early=[self];
  634. }));
  635. node=_st(ast)._atPosition_(aPosition);
  636. _st(console)._log_(node);
  637. $1=node;
  638. if(($receiver = $1) == nil || $receiver == null){
  639. return self;
  640. } else {
  641. $1;
  642. };
  643. $2=_st(node)._isNavigationNode();
  644. if(smalltalk.assert($2)){
  645. self._navigateTo_(_st(node)._navigationLink());
  646. };
  647. return self}
  648. catch(e) {if(e===$early)return e[0]; throw e}
  649. }, function($ctx1) {$ctx1.fill(self,"onCtrlClickAt:",{aPosition:aPosition,ast:ast,node:node},globals.HLCodeWidget)})},
  650. args: ["aPosition"],
  651. source: "onCtrlClickAt: aPosition\x0a\x09| ast node |\x0a\x09\x0a\x09ast := [ Smalltalk parse: self editor getValue ] \x0a\x09\x09on: Error \x0a\x09\x09do: [ :error | ^ self ].\x0a\x09\x0a\x09node := (ast atPosition: aPosition).\x0a\x09console log: node.\x0a\x09node ifNil: [ ^ self ].\x0a\x09\x0a\x09node isNavigationNode ifTrue: [ \x0a\x09\x09self navigateTo: node navigationLink ]",
  652. messageSends: ["on:do:", "parse:", "getValue", "editor", "atPosition:", "log:", "ifNil:", "ifTrue:", "isNavigationNode", "navigateTo:", "navigationLink"],
  653. referencedClasses: ["Smalltalk", "Error"]
  654. }),
  655. globals.HLCodeWidget);
  656. smalltalk.addMethod(
  657. smalltalk.method({
  658. selector: "onDoIt",
  659. protocol: 'reactions',
  660. fn: function (){
  661. var self=this;
  662. return smalltalk.withContext(function($ctx1) {
  663. self._doIt();
  664. return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{},globals.HLCodeWidget)})},
  665. args: [],
  666. source: "onDoIt\x0a\x09\x0a\x09self doIt",
  667. messageSends: ["doIt"],
  668. referencedClasses: []
  669. }),
  670. globals.HLCodeWidget);
  671. smalltalk.addMethod(
  672. smalltalk.method({
  673. selector: "onInspectIt",
  674. protocol: 'reactions',
  675. fn: function (){
  676. var self=this;
  677. return smalltalk.withContext(function($ctx1) {
  678. self._inspectIt();
  679. return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{},globals.HLCodeWidget)})},
  680. args: [],
  681. source: "onInspectIt\x0a\x0a\x09self inspectIt",
  682. messageSends: ["inspectIt"],
  683. referencedClasses: []
  684. }),
  685. globals.HLCodeWidget);
  686. smalltalk.addMethod(
  687. smalltalk.method({
  688. selector: "onPrintIt",
  689. protocol: 'reactions',
  690. fn: function (){
  691. var self=this;
  692. return smalltalk.withContext(function($ctx1) {
  693. self._printIt();
  694. return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{},globals.HLCodeWidget)})},
  695. args: [],
  696. source: "onPrintIt\x0a\x0a\x09self printIt",
  697. messageSends: ["printIt"],
  698. referencedClasses: []
  699. }),
  700. globals.HLCodeWidget);
  701. smalltalk.addMethod(
  702. smalltalk.method({
  703. selector: "onSaveIt",
  704. protocol: 'reactions',
  705. fn: function (){
  706. var self=this;
  707. return self},
  708. args: [],
  709. source: "onSaveIt\x0a\x09\x22I do not do anything\x22",
  710. messageSends: [],
  711. referencedClasses: []
  712. }),
  713. globals.HLCodeWidget);
  714. smalltalk.addMethod(
  715. smalltalk.method({
  716. selector: "print:",
  717. protocol: 'actions',
  718. fn: function (aString){
  719. var self=this;
  720. var start,stop,currentLine;
  721. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  722. return smalltalk.withContext(function($ctx1) {
  723. var $1,$2,$4,$3,$5,$6,$7,$8,$9,$10,$12,$11;
  724. $1=_st(self["@editor"])._getCursor_(false);
  725. $ctx1.sendIdx["getCursor:"]=1;
  726. currentLine=_st($1)._line();
  727. start=_st($HashedCollection())._new();
  728. $ctx1.sendIdx["new"]=1;
  729. _st(start)._at_put_("line",currentLine);
  730. $ctx1.sendIdx["at:put:"]=1;
  731. $2=start;
  732. $4=_st(self["@editor"])._getCursor_(false);
  733. $ctx1.sendIdx["getCursor:"]=2;
  734. $3=_st($4)._ch();
  735. _st($2)._at_put_("ch",$3);
  736. $ctx1.sendIdx["at:put:"]=2;
  737. $5=_st(self["@editor"])._getSelection();
  738. $ctx1.sendIdx["getSelection"]=1;
  739. _st($5)._ifEmpty_((function(){
  740. return smalltalk.withContext(function($ctx2) {
  741. $6=start;
  742. $7=_st(_st(self["@editor"])._getLine_(currentLine))._size();
  743. $ctx2.sendIdx["size"]=1;
  744. _st($6)._at_put_("ch",$7);
  745. $ctx2.sendIdx["at:put:"]=3;
  746. return _st(self["@editor"])._setSelection_end_(globals.HashedCollection._newFromPairs_(["line",currentLine,"ch",(0)]),start);
  747. $ctx2.sendIdx["setSelection:end:"]=1;
  748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  749. stop=_st($HashedCollection())._new();
  750. _st(stop)._at_put_("line",currentLine);
  751. $ctx1.sendIdx["at:put:"]=4;
  752. $8=stop;
  753. $9=_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2));
  754. $ctx1.sendIdx["+"]=1;
  755. _st($8)._at_put_("ch",$9);
  756. $10=self["@editor"];
  757. $12=_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString);
  758. $ctx1.sendIdx[","]=2;
  759. $11=_st($12).__comma(" ");
  760. $ctx1.sendIdx[","]=1;
  761. _st($10)._replaceSelection_($11);
  762. _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
  763. _st(self["@editor"])._setSelection_end_(stop,start);
  764. return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine},globals.HLCodeWidget)})},
  765. args: ["aString"],
  766. source: "print: aString\x0a\x09| start stop currentLine |\x0a currentLine := (editor getCursor: false) line.\x0a\x09start := HashedCollection new.\x0a\x09start at: 'line' put: currentLine.\x0a\x09start at: 'ch' put: (editor getCursor: false) ch.\x0a (editor getSelection) ifEmpty: [\x0a \x09\x22select current line if selection is empty\x22\x0a \x09start at: 'ch' put: (editor getLine: currentLine) size.\x0a editor setSelection: #{'line' -> currentLine. 'ch' -> 0} end: start.\x0a ].\x0a\x09stop := HashedCollection new.\x0a\x09stop at: 'line' put: currentLine.\x0a\x09stop at: 'ch' put: ((start at: 'ch') + aString size + 2).\x0a\x0a\x09editor replaceSelection: (editor getSelection, ' ', aString, ' ').\x0a\x09editor setCursor: (editor getCursor: true).\x0a\x09editor setSelection: stop end: start",
  767. messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "getSelection", "size", "getLine:", "setSelection:end:", "+", "at:", "replaceSelection:", ",", "setCursor:"],
  768. referencedClasses: ["HashedCollection"]
  769. }),
  770. globals.HLCodeWidget);
  771. smalltalk.addMethod(
  772. smalltalk.method({
  773. selector: "printIt",
  774. protocol: 'actions',
  775. fn: function (){
  776. var self=this;
  777. var result;
  778. function $HLPrintItRequested(){return globals.HLPrintItRequested||(typeof HLPrintItRequested=="undefined"?nil:HLPrintItRequested)}
  779. return smalltalk.withContext(function($ctx1) {
  780. result=self._doIt();
  781. _st(_st(self._model())._announcer())._announce_(_st($HLPrintItRequested())._on_(self["@model"]));
  782. self._print_(_st(result)._printString());
  783. self._focus();
  784. return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result},globals.HLCodeWidget)})},
  785. args: [],
  786. source: "printIt\x0a\x09| result |\x0a\x0a\x09result := self doIt. \x0a\x09self model announcer announce: (HLPrintItRequested on: model).\x0a\x09self print: result printString.\x0a\x09\x0a\x09self focus.",
  787. messageSends: ["doIt", "announce:", "announcer", "model", "on:", "print:", "printString", "focus"],
  788. referencedClasses: ["HLPrintItRequested"]
  789. }),
  790. globals.HLCodeWidget);
  791. smalltalk.addMethod(
  792. smalltalk.method({
  793. selector: "receiver",
  794. protocol: 'accessing',
  795. fn: function (){
  796. var self=this;
  797. return smalltalk.withContext(function($ctx1) {
  798. var $1;
  799. $1=_st(self._model())._receiver();
  800. return $1;
  801. }, function($ctx1) {$ctx1.fill(self,"receiver",{},globals.HLCodeWidget)})},
  802. args: [],
  803. source: "receiver\x0a\x09^ self model receiver",
  804. messageSends: ["receiver", "model"],
  805. referencedClasses: []
  806. }),
  807. globals.HLCodeWidget);
  808. smalltalk.addMethod(
  809. smalltalk.method({
  810. selector: "receiver:",
  811. protocol: 'accessing',
  812. fn: function (anObject){
  813. var self=this;
  814. return smalltalk.withContext(function($ctx1) {
  815. _st(self._model())._receiver_(anObject);
  816. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},globals.HLCodeWidget)})},
  817. args: ["anObject"],
  818. source: "receiver: anObject\x0a\x09self model receiver: anObject",
  819. messageSends: ["receiver:", "model"],
  820. referencedClasses: []
  821. }),
  822. globals.HLCodeWidget);
  823. smalltalk.addMethod(
  824. smalltalk.method({
  825. selector: "renderButtonsOn:",
  826. protocol: 'rendering',
  827. fn: function (html){
  828. var self=this;
  829. return smalltalk.withContext(function($ctx1) {
  830. var $1,$2,$3,$4,$5,$6;
  831. $1=_st(html)._button();
  832. $ctx1.sendIdx["button"]=1;
  833. _st($1)._class_("button");
  834. $ctx1.sendIdx["class:"]=1;
  835. _st($1)._with_("DoIt");
  836. $ctx1.sendIdx["with:"]=1;
  837. $2=_st($1)._onClick_((function(){
  838. return smalltalk.withContext(function($ctx2) {
  839. return self._doIt();
  840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  841. $ctx1.sendIdx["onClick:"]=1;
  842. $3=_st(html)._button();
  843. $ctx1.sendIdx["button"]=2;
  844. _st($3)._class_("button");
  845. $ctx1.sendIdx["class:"]=2;
  846. _st($3)._with_("PrintIt");
  847. $ctx1.sendIdx["with:"]=2;
  848. $4=_st($3)._onClick_((function(){
  849. return smalltalk.withContext(function($ctx2) {
  850. return self._printIt();
  851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  852. $ctx1.sendIdx["onClick:"]=2;
  853. $5=_st(html)._button();
  854. _st($5)._class_("button");
  855. _st($5)._with_("InspectIt");
  856. $6=_st($5)._onClick_((function(){
  857. return smalltalk.withContext(function($ctx2) {
  858. return self._inspectIt();
  859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  860. return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},globals.HLCodeWidget)})},
  861. args: ["html"],
  862. source: "renderButtonsOn: html\x0a\x09html button \x0a\x09\x09class: 'button';\x0a\x09\x09with: 'DoIt';\x0a\x09\x09onClick: [ self doIt ].\x0a\x09html button \x0a\x09\x09class: 'button';\x0a\x09\x09with: 'PrintIt';\x0a\x09\x09onClick: [ self printIt ].\x0a\x09html button \x0a\x09\x09class: 'button';\x0a\x09\x09with: 'InspectIt';\x0a\x09\x09onClick: [ self inspectIt ]",
  863. messageSends: ["class:", "button", "with:", "onClick:", "doIt", "printIt", "inspectIt"],
  864. referencedClasses: []
  865. }),
  866. globals.HLCodeWidget);
  867. smalltalk.addMethod(
  868. smalltalk.method({
  869. selector: "renderContentOn:",
  870. protocol: 'rendering',
  871. fn: function (html){
  872. var self=this;
  873. return smalltalk.withContext(function($ctx1) {
  874. var $1,$2,$3,$4,$5,$6;
  875. $1=_st(html)._div();
  876. $ctx1.sendIdx["div"]=1;
  877. _st($1)._class_("editor");
  878. $ctx1.sendIdx["class:"]=1;
  879. $2=_st($1)._with_((function(){
  880. return smalltalk.withContext(function($ctx2) {
  881. self["@code"]=_st(html)._textarea();
  882. return self["@code"];
  883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  884. $ctx1.sendIdx["with:"]=1;
  885. $3=_st(html)._div();
  886. $ctx1.sendIdx["div"]=2;
  887. self["@state"]=_st($3)._class_("state");
  888. $ctx1.sendIdx["class:"]=2;
  889. $4=_st(html)._div();
  890. _st($4)._class_("buttons_bar");
  891. $5=_st($4)._with_((function(){
  892. return smalltalk.withContext(function($ctx2) {
  893. return self._renderButtonsOn_(html);
  894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  895. self._setEditorOn_(_st(self["@code"])._element());
  896. self._configureEditor();
  897. $6=self._updateState();
  898. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLCodeWidget)})},
  899. args: ["html"],
  900. source: "renderContentOn: html\x0a\x09html div class: 'editor'; with: [\x0a\x09\x09code := html textarea ].\x0a\x09state := html div class: 'state'.\x0a\x09\x0a\x09html div \x0a\x09\x09class: 'buttons_bar';\x0a\x09\x09with: [ self renderButtonsOn: html ].\x0a\x09\x0a\x09self \x0a\x09\x09setEditorOn: code element;\x0a\x09\x09configureEditor;\x0a\x09\x09updateState",
  901. messageSends: ["class:", "div", "with:", "textarea", "renderButtonsOn:", "setEditorOn:", "element", "configureEditor", "updateState"],
  902. referencedClasses: []
  903. }),
  904. globals.HLCodeWidget);
  905. smalltalk.addMethod(
  906. smalltalk.method({
  907. selector: "saveIt",
  908. protocol: 'actions',
  909. fn: function (){
  910. var self=this;
  911. return self},
  912. args: [],
  913. source: "saveIt\x0a\x09\x22I do not do anything\x22",
  914. messageSends: [],
  915. referencedClasses: []
  916. }),
  917. globals.HLCodeWidget);
  918. smalltalk.addMethod(
  919. smalltalk.method({
  920. selector: "selection",
  921. protocol: 'accessing',
  922. fn: function (){
  923. var self=this;
  924. return smalltalk.withContext(function($ctx1) {
  925. var $1;
  926. $1=_st(self["@editor"])._getSelection();
  927. return $1;
  928. }, function($ctx1) {$ctx1.fill(self,"selection",{},globals.HLCodeWidget)})},
  929. args: [],
  930. source: "selection\x0a\x09^editor getSelection",
  931. messageSends: ["getSelection"],
  932. referencedClasses: []
  933. }),
  934. globals.HLCodeWidget);
  935. smalltalk.addMethod(
  936. smalltalk.method({
  937. selector: "selectionEnd",
  938. protocol: 'accessing',
  939. fn: function (){
  940. var self=this;
  941. return smalltalk.withContext(function($ctx1) {
  942. var $1;
  943. $1=_st(_st(self["@code"])._element())._selectionEnd();
  944. return $1;
  945. }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{},globals.HLCodeWidget)})},
  946. args: [],
  947. source: "selectionEnd\x0a ^code element selectionEnd",
  948. messageSends: ["selectionEnd", "element"],
  949. referencedClasses: []
  950. }),
  951. globals.HLCodeWidget);
  952. smalltalk.addMethod(
  953. smalltalk.method({
  954. selector: "selectionEnd:",
  955. protocol: 'accessing',
  956. fn: function (anInteger){
  957. var self=this;
  958. return smalltalk.withContext(function($ctx1) {
  959. _st(_st(self["@code"])._element())._selectionEnd_(anInteger);
  960. return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger},globals.HLCodeWidget)})},
  961. args: ["anInteger"],
  962. source: "selectionEnd: anInteger\x0a code element selectionEnd: anInteger",
  963. messageSends: ["selectionEnd:", "element"],
  964. referencedClasses: []
  965. }),
  966. globals.HLCodeWidget);
  967. smalltalk.addMethod(
  968. smalltalk.method({
  969. selector: "selectionStart",
  970. protocol: 'accessing',
  971. fn: function (){
  972. var self=this;
  973. return smalltalk.withContext(function($ctx1) {
  974. var $1;
  975. $1=_st(_st(self["@code"])._element())._selectionStart();
  976. return $1;
  977. }, function($ctx1) {$ctx1.fill(self,"selectionStart",{},globals.HLCodeWidget)})},
  978. args: [],
  979. source: "selectionStart\x0a ^code element selectionStart",
  980. messageSends: ["selectionStart", "element"],
  981. referencedClasses: []
  982. }),
  983. globals.HLCodeWidget);
  984. smalltalk.addMethod(
  985. smalltalk.method({
  986. selector: "selectionStart:",
  987. protocol: 'accessing',
  988. fn: function (anInteger){
  989. var self=this;
  990. return smalltalk.withContext(function($ctx1) {
  991. _st(_st(self["@code"])._element())._selectionStart_(anInteger);
  992. return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger},globals.HLCodeWidget)})},
  993. args: ["anInteger"],
  994. source: "selectionStart: anInteger\x0a code element selectionStart: anInteger",
  995. messageSends: ["selectionStart:", "element"],
  996. referencedClasses: []
  997. }),
  998. globals.HLCodeWidget);
  999. smalltalk.addMethod(
  1000. smalltalk.method({
  1001. selector: "setEditorOn:",
  1002. protocol: 'actions',
  1003. fn: function (aTextarea){
  1004. var self=this;
  1005. return smalltalk.withContext(function($ctx1) {
  1006. self['@editor'] = CodeMirror.fromTextArea(aTextarea, self._editorOptions());
  1007. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea},globals.HLCodeWidget)})},
  1008. args: ["aTextarea"],
  1009. source: "setEditorOn: aTextarea\x0a\x09<self['@editor'] = CodeMirror.fromTextArea(aTextarea, self._editorOptions())>",
  1010. messageSends: [],
  1011. referencedClasses: []
  1012. }),
  1013. globals.HLCodeWidget);
  1014. smalltalk.addMethod(
  1015. smalltalk.method({
  1016. selector: "updateState",
  1017. protocol: 'updating',
  1018. fn: function (){
  1019. var self=this;
  1020. return smalltalk.withContext(function($ctx1) {
  1021. var $1,$2;
  1022. $1=self._hasModification();
  1023. if(smalltalk.assert($1)){
  1024. $2=_st(self["@state"])._asJQuery();
  1025. $ctx1.sendIdx["asJQuery"]=1;
  1026. _st($2)._addClass_("modified");
  1027. } else {
  1028. _st(_st(self["@state"])._asJQuery())._removeClass_("modified");
  1029. };
  1030. return self}, function($ctx1) {$ctx1.fill(self,"updateState",{},globals.HLCodeWidget)})},
  1031. args: [],
  1032. source: "updateState\x0a\x09self hasModification \x0a\x09\x09ifTrue: [ state asJQuery addClass: 'modified' ]\x0a\x09\x09ifFalse: [ state asJQuery removeClass: 'modified' ]",
  1033. messageSends: ["ifTrue:ifFalse:", "hasModification", "addClass:", "asJQuery", "removeClass:"],
  1034. referencedClasses: []
  1035. }),
  1036. globals.HLCodeWidget);
  1037. smalltalk.addMethod(
  1038. smalltalk.method({
  1039. selector: "variableHintFor:token:",
  1040. protocol: 'hints',
  1041. fn: function (anEditor,aToken){
  1042. var self=this;
  1043. var variables,classNames,pseudoVariables;
  1044. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1045. return smalltalk.withContext(function($ctx1) {
  1046. var $3,$2,$1,$9,$8,$7,$6,$10,$5,$4;
  1047. $3=_st(_st(_st(anEditor)._display())._wrapper())._asJQuery();
  1048. $ctx1.sendIdx["asJQuery"]=1;
  1049. $2=_st($3)._find_("span.cm-variable");
  1050. $1=_st($2)._get();
  1051. variables=_st($1)._collect_((function(each){
  1052. return smalltalk.withContext(function($ctx2) {
  1053. return _st(_st(each)._asJQuery())._html();
  1054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1055. $ctx1.sendIdx["collect:"]=1;
  1056. classNames=_st(_st($Smalltalk())._classes())._collect_((function(each){
  1057. return smalltalk.withContext(function($ctx2) {
  1058. return _st(each)._name();
  1059. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1060. pseudoVariables=_st($Smalltalk())._pseudoVariableNames();
  1061. $9=_st(_st(variables).__comma(classNames)).__comma(pseudoVariables);
  1062. $ctx1.sendIdx[","]=1;
  1063. $8=_st($9)._asSet();
  1064. $7=_st($8)._asArray();
  1065. $6=_st($7)._sort();
  1066. $5=_st($6)._select_((function(each){
  1067. return smalltalk.withContext(function($ctx2) {
  1068. $10=_st(aToken)._string();
  1069. $ctx2.sendIdx["string"]=1;
  1070. return _st(each)._includesSubString_($10);
  1071. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1072. $4=_st($5)._reject_((function(each){
  1073. return smalltalk.withContext(function($ctx2) {
  1074. return _st(each).__eq(_st(aToken)._string());
  1075. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  1076. return $4;
  1077. }, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken,variables:variables,classNames:classNames,pseudoVariables:pseudoVariables},globals.HLCodeWidget)})},
  1078. args: ["anEditor", "aToken"],
  1079. source: "variableHintFor: anEditor token: aToken\x0a\x09| variables classNames pseudoVariables |\x0a\x09\x0a\x09variables := (anEditor display wrapper asJQuery find: 'span.cm-variable') get\x0a\x09\x09collect: [ :each | each asJQuery html ].\x0a\x09\x0a\x09classNames := Smalltalk classes collect: [ :each | each name ].\x0a\x09pseudoVariables := Smalltalk pseudoVariableNames.\x0a\x09\x0a\x09^ ((variables, classNames, pseudoVariables) asSet asArray sort\x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
  1080. messageSends: ["collect:", "get", "find:", "asJQuery", "wrapper", "display", "html", "classes", "name", "pseudoVariableNames", "reject:", "select:", "sort", "asArray", "asSet", ",", "includesSubString:", "string", "="],
  1081. referencedClasses: ["Smalltalk"]
  1082. }),
  1083. globals.HLCodeWidget);
  1084. smalltalk.addMethod(
  1085. smalltalk.method({
  1086. selector: "hintFor:options:",
  1087. protocol: 'hints',
  1088. fn: function (anEditor,options){
  1089. var self=this;
  1090. var cursor,token,completions;
  1091. function $CodeMirror(){return globals.CodeMirror||(typeof CodeMirror=="undefined"?nil:CodeMirror)}
  1092. function $HLCodeWidget(){return globals.HLCodeWidget||(typeof HLCodeWidget=="undefined"?nil:HLCodeWidget)}
  1093. return smalltalk.withContext(function($ctx1) {
  1094. var $1,$4,$3,$2,$5,$7,$9,$10,$8,$6;
  1095. cursor=_st(anEditor)._getCursor();
  1096. token=_st(anEditor)._getTokenAt_(cursor);
  1097. $1=token;
  1098. $4=_st($CodeMirror())._basicAt_("innerMode");
  1099. $ctx1.sendIdx["basicAt:"]=1;
  1100. $3=_st($4)._value_value_(_st(anEditor)._getMode(),_st(token)._at_("state"));
  1101. $ctx1.sendIdx["value:value:"]=1;
  1102. $2=_st($3)._state();
  1103. _st($1)._at_put_("state",$2);
  1104. $5=_st(_st(token)._type()).__eq("variable");
  1105. if(smalltalk.assert($5)){
  1106. completions=_st($HLCodeWidget())._variableHintFor_token_(anEditor,token);
  1107. } else {
  1108. completions=_st($HLCodeWidget())._messageHintFor_token_(anEditor,token);
  1109. };
  1110. $7=completions;
  1111. $9=_st($CodeMirror())._basicAt_("Pos");
  1112. $ctx1.sendIdx["basicAt:"]=2;
  1113. $10=_st(cursor)._line();
  1114. $ctx1.sendIdx["line"]=1;
  1115. $8=_st($9)._value_value_($10,_st(token)._end());
  1116. $ctx1.sendIdx["value:value:"]=2;
  1117. $6=globals.HashedCollection._newFromPairs_(["list",$7,"from",$8,"to",_st(_st($CodeMirror())._basicAt_("Pos"))._value_value_(_st(cursor)._line(),_st(token)._start())]);
  1118. return $6;
  1119. }, function($ctx1) {$ctx1.fill(self,"hintFor:options:",{anEditor:anEditor,options:options,cursor:cursor,token:token,completions:completions},globals.HLCodeWidget.klass)})},
  1120. args: ["anEditor", "options"],
  1121. source: "hintFor: anEditor options: options\x0a\x09| cursor token completions |\x0a\x09\x0a\x09cursor := anEditor getCursor.\x0a\x09token := anEditor getTokenAt: cursor.\x0a\x09token at: 'state' put: ((CodeMirror basicAt: 'innerMode')\x0a\x09\x09value: anEditor getMode value: (token at: 'state')) state.\x0a\x09\x0a\x09completions := token type = 'variable' \x0a\x09\x09ifTrue: [ HLCodeWidget variableHintFor: anEditor token: token ]\x0a\x09\x09ifFalse: [ HLCodeWidget messageHintFor: anEditor token: token ].\x0a\x09\x0a\x09^ #{\x0a\x09\x09'list' -> completions.\x0a\x09\x09'from' -> ((CodeMirror basicAt: 'Pos') value: cursor line value: token end).\x0a\x09\x09'to' -> ((CodeMirror basicAt: 'Pos') value: cursor line value: token start)\x0a\x09}",
  1122. messageSends: ["getCursor", "getTokenAt:", "at:put:", "state", "value:value:", "basicAt:", "getMode", "at:", "ifTrue:ifFalse:", "=", "type", "variableHintFor:token:", "messageHintFor:token:", "line", "end", "start"],
  1123. referencedClasses: ["CodeMirror", "HLCodeWidget"]
  1124. }),
  1125. globals.HLCodeWidget.klass);
  1126. smalltalk.addMethod(
  1127. smalltalk.method({
  1128. selector: "initialize",
  1129. protocol: 'initialization',
  1130. fn: function (){
  1131. var self=this;
  1132. return smalltalk.withContext(function($ctx1) {
  1133. var $1;
  1134. globals.HLCodeWidget.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  1135. self._setupCodeMirror();
  1136. self._setupCommands();
  1137. $1=self._setupKeyMaps();
  1138. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.HLCodeWidget.klass)})},
  1139. args: [],
  1140. source: "initialize\x0a\x09super initialize.\x0a\x09self \x0a\x09\x09setupCodeMirror;\x0a\x09\x09setupCommands;\x0a\x09\x09setupKeyMaps.",
  1141. messageSends: ["initialize", "setupCodeMirror", "setupCommands", "setupKeyMaps"],
  1142. referencedClasses: []
  1143. }),
  1144. globals.HLCodeWidget.klass);
  1145. smalltalk.addMethod(
  1146. smalltalk.method({
  1147. selector: "keyMap",
  1148. protocol: 'accessing',
  1149. fn: function (){
  1150. var self=this;
  1151. function $HLManager(){return globals.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
  1152. return smalltalk.withContext(function($ctx1) {
  1153. var $2,$1;
  1154. $2=_st(_st(_st($HLManager())._current())._keyBinder())._systemIsMac();
  1155. if(smalltalk.assert($2)){
  1156. $1=self._macKeyMap();
  1157. } else {
  1158. $1=self._pcKeyMap();
  1159. };
  1160. return $1;
  1161. }, function($ctx1) {$ctx1.fill(self,"keyMap",{},globals.HLCodeWidget.klass)})},
  1162. args: [],
  1163. source: "keyMap\x0a\x09^ HLManager current keyBinder systemIsMac\x0a\x09\x09ifTrue: [ self macKeyMap ]\x0a\x09\x09ifFalse: [ self pcKeyMap ]",
  1164. messageSends: ["ifTrue:ifFalse:", "systemIsMac", "keyBinder", "current", "macKeyMap", "pcKeyMap"],
  1165. referencedClasses: ["HLManager"]
  1166. }),
  1167. globals.HLCodeWidget.klass);
  1168. smalltalk.addMethod(
  1169. smalltalk.method({
  1170. selector: "macKeyMap",
  1171. protocol: 'accessing',
  1172. fn: function (){
  1173. var self=this;
  1174. var $1;
  1175. $1=globals.HashedCollection._newFromPairs_(["Alt-Backspace","delWordBefore","Alt-Delete","delWordAfter","Alt-Left","goWordLeft","Alt-Right","goWordRight","Cmd-A","selectAll","Cmd-Alt-F","replace","Cmd-D","doIt","Cmd-Down","goDocEnd","Cmd-End","goDocEnd","Cmd-F","find","Cmd-G","findNext","Cmd-I","inspectIt","Cmd-Left","goLineStart","Cmd-P","printIt","Cmd-Right","goLineEnd","Cmd-S","saveIt","Cmd-Up","goDocStart","Cmd-Y","redo","Cmd-Z","undo","Cmd-[","indentLess","Cmd-]","indentMore","Ctrl-Alt-Backspace","delWordAfter","Shift-Cmd-Alt-F","replaceAll","Shift-Cmd-G","findPrev","Shift-Cmd-Z","redo","fallthrough",["basic","emacsy"]]);
  1176. return $1;
  1177. },
  1178. args: [],
  1179. source: "macKeyMap\x0a\x09^ #{\x0a\x09\x09'Alt-Backspace'\x09\x09\x09-> 'delWordBefore'.\x0a\x09\x09'Alt-Delete'\x09\x09\x09-> 'delWordAfter'. \x0a\x09\x09'Alt-Left'\x09\x09\x09\x09-> 'goWordLeft'.\x0a\x09\x09'Alt-Right'\x09\x09\x09\x09-> 'goWordRight'. \x0a\x09\x09'Cmd-A'\x09\x09\x09\x09\x09-> 'selectAll'. \x0a\x09\x09'Cmd-Alt-F'\x09\x09\x09\x09-> 'replace'. \x0a\x09\x09'Cmd-D'\x09\x09\x09\x09\x09-> 'doIt'. \x0a\x09\x09'Cmd-Down'\x09\x09\x09\x09-> 'goDocEnd'. \x0a\x09\x09'Cmd-End'\x09\x09\x09\x09-> 'goDocEnd'. \x0a\x09\x09'Cmd-F'\x09\x09\x09\x09\x09-> 'find'.\x0a\x09\x09'Cmd-G'\x09\x09\x09\x09\x09-> 'findNext'. \x0a\x09\x09'Cmd-I'\x09\x09\x09\x09\x09-> 'inspectIt'. \x0a\x09\x09'Cmd-Left'\x09\x09\x09\x09-> 'goLineStart'. \x0a\x09\x09'Cmd-P'\x09\x09\x09\x09\x09-> 'printIt'. \x0a\x09\x09'Cmd-Right'\x09\x09\x09\x09-> 'goLineEnd'. \x0a\x09\x09'Cmd-S'\x09\x09\x09\x09\x09-> 'saveIt'. \x0a\x09\x09'Cmd-Up'\x09\x09\x09\x09-> 'goDocStart'. \x0a\x09\x09'Cmd-Y'\x09\x09\x09\x09\x09-> 'redo'.\x0a\x09\x09'Cmd-Z'\x09\x09\x09\x09\x09-> 'undo'. \x0a\x09\x09'Cmd-['\x09\x09\x09\x09\x09-> 'indentLess'. \x0a\x09\x09'Cmd-]'\x09\x09\x09\x09\x09-> 'indentMore'.\x0a\x09\x09'Ctrl-Alt-Backspace'\x09-> 'delWordAfter'. \x0a\x09\x09'Shift-Cmd-Alt-F'\x09\x09-> 'replaceAll'.\x0a\x09\x09'Shift-Cmd-G'\x09\x09\x09-> 'findPrev'. \x0a\x09\x09'Shift-Cmd-Z'\x09\x09\x09-> 'redo'. \x0a \x09'fallthrough' \x09\x09\x09-> { 'basic'. 'emacsy' }\x0a }",
  1180. messageSends: [],
  1181. referencedClasses: []
  1182. }),
  1183. globals.HLCodeWidget.klass);
  1184. smalltalk.addMethod(
  1185. smalltalk.method({
  1186. selector: "messageHintFor:token:",
  1187. protocol: 'hints',
  1188. fn: function (anEditor,aToken){
  1189. var self=this;
  1190. return smalltalk.withContext(function($ctx1) {
  1191. var $1;
  1192. $1=_st(_st(anEditor)._at_("amberCodeWidget"))._messageHintFor_token_(anEditor,aToken);
  1193. return $1;
  1194. }, function($ctx1) {$ctx1.fill(self,"messageHintFor:token:",{anEditor:anEditor,aToken:aToken},globals.HLCodeWidget.klass)})},
  1195. args: ["anEditor", "aToken"],
  1196. source: "messageHintFor: anEditor token: aToken\x0a\x09^ (anEditor at: 'amberCodeWidget')\x0a\x09\x09messageHintFor: anEditor token: aToken",
  1197. messageSends: ["messageHintFor:token:", "at:"],
  1198. referencedClasses: []
  1199. }),
  1200. globals.HLCodeWidget.klass);
  1201. smalltalk.addMethod(
  1202. smalltalk.method({
  1203. selector: "pcKeyMap",
  1204. protocol: 'accessing',
  1205. fn: function (){
  1206. var self=this;
  1207. var $1;
  1208. $1=globals.HashedCollection._newFromPairs_(["Alt-Left","goLineStart","Alt-Right","goLineEnd","Alt-Up","goDocStart","Ctrl-A","selectAll","Ctrl-Backspace","delWordBefore","Ctrl-D","doIt","Ctrl-Delete","delWordAfter","Ctrl-Down","goDocEnd","Ctrl-End","goDocEnd","Ctrl-F","find","Ctrl-G","findNext","Ctrl-I","inspectIt","Ctrl-Home","goDocStart","Ctrl-Left","goWordLeft","Ctrl-P","printIt","Ctrl-Right","goWordRight","Ctrl-S","saveIt","Ctrl-Y","redo","Ctrl-Z","undo","Ctrl-[","indentLess","Ctrl-]","indentMore","Shift-Ctrl-F","replace","Shift-Ctrl-G","findPrev","Shift-Ctrl-R","replaceAll","Shift-Ctrl-Z","redo","fallthrough",["basic"]]);
  1209. return $1;
  1210. },
  1211. args: [],
  1212. source: "pcKeyMap\x0a\x09^ #{\x0a\x09\x09'Alt-Left' -> \x09\x09'goLineStart'. \x0a\x09\x09'Alt-Right' -> \x09\x09'goLineEnd'.\x0a\x09\x09'Alt-Up' -> \x09\x09'goDocStart'. \x0a\x09\x09'Ctrl-A' -> \x09\x09'selectAll'. \x0a\x09\x09'Ctrl-Backspace' -> 'delWordBefore'. \x0a\x09\x09'Ctrl-D' -> \x09\x09'doIt'. \x0a\x09\x09'Ctrl-Delete' -> \x09\x09'delWordAfter'. \x0a\x09\x09'Ctrl-Down' -> \x09\x09'goDocEnd'.\x0a\x09\x09'Ctrl-End' -> \x09\x09'goDocEnd'. \x0a\x09\x09'Ctrl-F' -> \x09\x09'find'.\x0a\x09\x09'Ctrl-G' -> \x09\x09'findNext'. \x0a\x09\x09'Ctrl-I' -> \x09\x09'inspectIt'.\x0a\x09\x09'Ctrl-Home' -> \x09\x09'goDocStart'. \x0a\x09\x09'Ctrl-Left' -> \x09\x09'goWordLeft'. \x0a\x09\x09'Ctrl-P' -> \x09\x09'printIt'.\x0a\x09\x09'Ctrl-Right' -> \x09'goWordRight'. \x0a\x09\x09'Ctrl-S' -> \x09\x09'saveIt'. \x0a\x09\x09'Ctrl-Y' -> \x09\x09'redo'.\x0a\x09\x09'Ctrl-Z' -> \x09\x09'undo'. \x0a\x09\x09'Ctrl-[' -> \x09\x09'indentLess'. \x0a\x09\x09'Ctrl-]' -> \x09\x09'indentMore'.\x0a\x09\x09'Shift-Ctrl-F' -> \x09'replace'. \x0a\x09\x09'Shift-Ctrl-G' -> \x09'findPrev'. \x0a\x09\x09'Shift-Ctrl-R' -> \x09'replaceAll'.\x0a\x09\x09'Shift-Ctrl-Z' -> \x09'redo'. \x0a\x09\x09'fallthrough' -> \x09#('basic')\x0a}",
  1213. messageSends: [],
  1214. referencedClasses: []
  1215. }),
  1216. globals.HLCodeWidget.klass);
  1217. smalltalk.addMethod(
  1218. smalltalk.method({
  1219. selector: "setupCodeMirror",
  1220. protocol: 'initialization',
  1221. fn: function (){
  1222. var self=this;
  1223. return smalltalk.withContext(function($ctx1) {
  1224. CodeMirror.keyMap.default.fallthrough = ["basic"];
  1225. CodeMirror.commands.autocomplete = function(cm) {
  1226. CodeMirror.showHint(cm, self._hintFor_options_);
  1227. }
  1228. ;
  1229. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{},globals.HLCodeWidget.klass)})},
  1230. args: [],
  1231. source: "setupCodeMirror\x0a\x09< \x0a\x09\x09CodeMirror.keyMap.default.fallthrough = [\x22basic\x22];\x0a\x09\x09CodeMirror.commands.autocomplete = function(cm) {\x0a\x09\x09\x09CodeMirror.showHint(cm, self._hintFor_options_);\x0a\x09\x09}\x0a\x09>",
  1232. messageSends: [],
  1233. referencedClasses: []
  1234. }),
  1235. globals.HLCodeWidget.klass);
  1236. smalltalk.addMethod(
  1237. smalltalk.method({
  1238. selector: "setupCommands",
  1239. protocol: 'initialization',
  1240. fn: function (){
  1241. var self=this;
  1242. function $CodeMirror(){return globals.CodeMirror||(typeof CodeMirror=="undefined"?nil:CodeMirror)}
  1243. return smalltalk.withContext(function($ctx1) {
  1244. var $1,$2,$3,$4,$5;
  1245. $1=_st($CodeMirror())._basicAt_("commands");
  1246. _st($1)._at_put_("doIt",(function(cm){
  1247. return smalltalk.withContext(function($ctx2) {
  1248. $2=_st(cm)._amberCodeWidget();
  1249. $ctx2.sendIdx["amberCodeWidget"]=1;
  1250. return _st($2)._doIt();
  1251. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1,1)})}));
  1252. $ctx1.sendIdx["at:put:"]=1;
  1253. _st($1)._at_put_("inspectIt",(function(cm){
  1254. return smalltalk.withContext(function($ctx2) {
  1255. $3=_st(cm)._amberCodeWidget();
  1256. $ctx2.sendIdx["amberCodeWidget"]=2;
  1257. return _st($3)._inspectIt();
  1258. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1,2)})}));
  1259. $ctx1.sendIdx["at:put:"]=2;
  1260. _st($1)._at_put_("printIt",(function(cm){
  1261. return smalltalk.withContext(function($ctx2) {
  1262. $4=_st(cm)._amberCodeWidget();
  1263. $ctx2.sendIdx["amberCodeWidget"]=3;
  1264. return _st($4)._printIt();
  1265. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1,3)})}));
  1266. $ctx1.sendIdx["at:put:"]=3;
  1267. $5=_st($1)._at_put_("saveIt",(function(cm){
  1268. return smalltalk.withContext(function($ctx2) {
  1269. return _st(_st(cm)._amberCodeWidget())._saveIt();
  1270. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1,4)})}));
  1271. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{},globals.HLCodeWidget.klass)})},
  1272. args: [],
  1273. source: "setupCommands\x0a\x09(CodeMirror basicAt: 'commands') \x0a\x09\x09at: 'doIt' put: [ :cm | cm amberCodeWidget doIt ];\x0a\x09\x09at: 'inspectIt' put: [ :cm | cm amberCodeWidget inspectIt ];\x0a\x09\x09at: 'printIt' put: [ :cm | cm amberCodeWidget printIt ];\x0a\x09\x09at: 'saveIt' put: [ :cm | cm amberCodeWidget saveIt ]",
  1274. messageSends: ["at:put:", "basicAt:", "doIt", "amberCodeWidget", "inspectIt", "printIt", "saveIt"],
  1275. referencedClasses: ["CodeMirror"]
  1276. }),
  1277. globals.HLCodeWidget.klass);
  1278. smalltalk.addMethod(
  1279. smalltalk.method({
  1280. selector: "setupKeyMaps",
  1281. protocol: 'initialization',
  1282. fn: function (){
  1283. var self=this;
  1284. return smalltalk.withContext(function($ctx1) {
  1285. CodeMirror.keyMap['Amber'] = self._keyMap();
  1286. return self}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{},globals.HLCodeWidget.klass)})},
  1287. args: [],
  1288. source: "setupKeyMaps\x0a\x09<CodeMirror.keyMap['Amber'] = self._keyMap()>",
  1289. messageSends: [],
  1290. referencedClasses: []
  1291. }),
  1292. globals.HLCodeWidget.klass);
  1293. smalltalk.addMethod(
  1294. smalltalk.method({
  1295. selector: "variableHintFor:token:",
  1296. protocol: 'hints',
  1297. fn: function (anEditor,aToken){
  1298. var self=this;
  1299. return smalltalk.withContext(function($ctx1) {
  1300. var $1;
  1301. $1=_st(_st(anEditor)._at_("amberCodeWidget"))._variableHintFor_token_(anEditor,aToken);
  1302. return $1;
  1303. }, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken},globals.HLCodeWidget.klass)})},
  1304. args: ["anEditor", "aToken"],
  1305. source: "variableHintFor: anEditor token: aToken\x0a\x09^ (anEditor at: 'amberCodeWidget')\x0a\x09\x09variableHintFor: anEditor token: aToken",
  1306. messageSends: ["variableHintFor:token:", "at:"],
  1307. referencedClasses: []
  1308. }),
  1309. globals.HLCodeWidget.klass);
  1310. smalltalk.addClass('HLNavigationCodeWidget', globals.HLCodeWidget, ['methodContents'], 'Helios-Workspace');
  1311. smalltalk.addMethod(
  1312. smalltalk.method({
  1313. selector: "configureEditor",
  1314. protocol: 'accessing',
  1315. fn: function (){
  1316. var self=this;
  1317. return smalltalk.withContext(function($ctx1) {
  1318. globals.HLNavigationCodeWidget.superclass.fn.prototype._configureEditor.apply(_st(self), []);
  1319. self._contents_(self._methodContents());
  1320. return self}, function($ctx1) {$ctx1.fill(self,"configureEditor",{},globals.HLNavigationCodeWidget)})},
  1321. args: [],
  1322. source: "configureEditor\x0a\x09super configureEditor.\x0a\x09self contents: self methodContents",
  1323. messageSends: ["configureEditor", "contents:", "methodContents"],
  1324. referencedClasses: []
  1325. }),
  1326. globals.HLNavigationCodeWidget);
  1327. smalltalk.addMethod(
  1328. smalltalk.method({
  1329. selector: "contents:",
  1330. protocol: 'accessing',
  1331. fn: function (aString){
  1332. var self=this;
  1333. return smalltalk.withContext(function($ctx1) {
  1334. self._methodContents_(aString);
  1335. globals.HLNavigationCodeWidget.superclass.fn.prototype._contents_.apply(_st(self), [aString]);
  1336. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},globals.HLNavigationCodeWidget)})},
  1337. args: ["aString"],
  1338. source: "contents: aString\x0a\x09self methodContents: aString.\x0a\x09super contents: aString",
  1339. messageSends: ["methodContents:", "contents:"],
  1340. referencedClasses: []
  1341. }),
  1342. globals.HLNavigationCodeWidget);
  1343. smalltalk.addMethod(
  1344. smalltalk.method({
  1345. selector: "hasModification",
  1346. protocol: 'testing',
  1347. fn: function (){
  1348. var self=this;
  1349. return smalltalk.withContext(function($ctx1) {
  1350. var $1;
  1351. $1=_st(_st(self._methodContents()).__eq(self._contents()))._not();
  1352. return $1;
  1353. }, function($ctx1) {$ctx1.fill(self,"hasModification",{},globals.HLNavigationCodeWidget)})},
  1354. args: [],
  1355. source: "hasModification\x0a\x09^ (self methodContents = self contents) not",
  1356. messageSends: ["not", "=", "methodContents", "contents"],
  1357. referencedClasses: []
  1358. }),
  1359. globals.HLNavigationCodeWidget);
  1360. smalltalk.addMethod(
  1361. smalltalk.method({
  1362. selector: "methodContents",
  1363. protocol: 'accessing',
  1364. fn: function (){
  1365. var self=this;
  1366. return smalltalk.withContext(function($ctx1) {
  1367. var $2,$1;
  1368. $2=self["@methodContents"];
  1369. if(($receiver = $2) == nil || $receiver == null){
  1370. $1="";
  1371. } else {
  1372. $1=$2;
  1373. };
  1374. return $1;
  1375. }, function($ctx1) {$ctx1.fill(self,"methodContents",{},globals.HLNavigationCodeWidget)})},
  1376. args: [],
  1377. source: "methodContents\x0a\x09^ methodContents ifNil: [ '' ]",
  1378. messageSends: ["ifNil:"],
  1379. referencedClasses: []
  1380. }),
  1381. globals.HLNavigationCodeWidget);
  1382. smalltalk.addMethod(
  1383. smalltalk.method({
  1384. selector: "methodContents:",
  1385. protocol: 'accessing',
  1386. fn: function (aString){
  1387. var self=this;
  1388. var $1;
  1389. self["@methodContents"]=aString;
  1390. $1=self["@methodContents"];
  1391. return $1;
  1392. },
  1393. args: ["aString"],
  1394. source: "methodContents: aString\x0a\x09^ methodContents := aString",
  1395. messageSends: [],
  1396. referencedClasses: []
  1397. }),
  1398. globals.HLNavigationCodeWidget);
  1399. smalltalk.addMethod(
  1400. smalltalk.method({
  1401. selector: "previous",
  1402. protocol: 'accessing',
  1403. fn: function (){
  1404. var self=this;
  1405. return self},
  1406. args: [],
  1407. source: "previous\x0a\x09\x22for browser lists widget\x22",
  1408. messageSends: [],
  1409. referencedClasses: []
  1410. }),
  1411. globals.HLNavigationCodeWidget);
  1412. smalltalk.addMethod(
  1413. smalltalk.method({
  1414. selector: "previous:",
  1415. protocol: 'accessing',
  1416. fn: function (aWidget){
  1417. var self=this;
  1418. return self},
  1419. args: ["aWidget"],
  1420. source: "previous: aWidget\x0a\x09\x22for browser lists widget\x22",
  1421. messageSends: [],
  1422. referencedClasses: []
  1423. }),
  1424. globals.HLNavigationCodeWidget);
  1425. smalltalk.addMethod(
  1426. smalltalk.method({
  1427. selector: "canBeOpenAsTab",
  1428. protocol: 'testing',
  1429. fn: function (){
  1430. var self=this;
  1431. return false;
  1432. },
  1433. args: [],
  1434. source: "canBeOpenAsTab\x0a\x09^ false",
  1435. messageSends: [],
  1436. referencedClasses: []
  1437. }),
  1438. globals.HLNavigationCodeWidget.klass);
  1439. smalltalk.addMethod(
  1440. smalltalk.method({
  1441. selector: "on:",
  1442. protocol: 'instance creation',
  1443. fn: function (aBrowserModel){
  1444. var self=this;
  1445. return smalltalk.withContext(function($ctx1) {
  1446. var $2,$3,$1;
  1447. $2=self._new();
  1448. _st($2)._browserModel_(aBrowserModel);
  1449. $3=_st($2)._yourself();
  1450. $1=$3;
  1451. return $1;
  1452. }, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel},globals.HLNavigationCodeWidget.klass)})},
  1453. args: ["aBrowserModel"],
  1454. source: "on: aBrowserModel\x0a\x09^ self new\x0a\x09\x09browserModel: aBrowserModel;\x0a\x09\x09yourself",
  1455. messageSends: ["browserModel:", "new", "yourself"],
  1456. referencedClasses: []
  1457. }),
  1458. globals.HLNavigationCodeWidget.klass);
  1459. smalltalk.addClass('HLBrowserCodeWidget', globals.HLNavigationCodeWidget, ['browserModel'], 'Helios-Workspace');
  1460. smalltalk.addMethod(
  1461. smalltalk.method({
  1462. selector: "browserModel",
  1463. protocol: 'accessing',
  1464. fn: function (){
  1465. var self=this;
  1466. var $1;
  1467. $1=self["@browserModel"];
  1468. return $1;
  1469. },
  1470. args: [],
  1471. source: "browserModel\x0a\x09^ browserModel",
  1472. messageSends: [],
  1473. referencedClasses: []
  1474. }),
  1475. globals.HLBrowserCodeWidget);
  1476. smalltalk.addMethod(
  1477. smalltalk.method({
  1478. selector: "browserModel:",
  1479. protocol: 'accessing',
  1480. fn: function (aBrowserModel){
  1481. var self=this;
  1482. return smalltalk.withContext(function($ctx1) {
  1483. var $1;
  1484. self["@browserModel"]=aBrowserModel;
  1485. self._observeSystem();
  1486. $1=self._observeBrowserModel();
  1487. return self}, function($ctx1) {$ctx1.fill(self,"browserModel:",{aBrowserModel:aBrowserModel},globals.HLBrowserCodeWidget)})},
  1488. args: ["aBrowserModel"],
  1489. source: "browserModel: aBrowserModel\x0a\x09browserModel := aBrowserModel.\x0a\x09self \x0a\x09\x09observeSystem;\x0a\x09\x09observeBrowserModel",
  1490. messageSends: ["observeSystem", "observeBrowserModel"],
  1491. referencedClasses: []
  1492. }),
  1493. globals.HLBrowserCodeWidget);
  1494. smalltalk.addMethod(
  1495. smalltalk.method({
  1496. selector: "navigateToClass:",
  1497. protocol: 'actions',
  1498. fn: function (aClass){
  1499. var self=this;
  1500. return smalltalk.withContext(function($ctx1) {
  1501. _st(self._browserModel())._openClassNamed_(_st(aClass)._name());
  1502. return self}, function($ctx1) {$ctx1.fill(self,"navigateToClass:",{aClass:aClass},globals.HLBrowserCodeWidget)})},
  1503. args: ["aClass"],
  1504. source: "navigateToClass: aClass\x0a\x09self browserModel openClassNamed: aClass name",
  1505. messageSends: ["openClassNamed:", "browserModel", "name"],
  1506. referencedClasses: []
  1507. }),
  1508. globals.HLBrowserCodeWidget);
  1509. smalltalk.addMethod(
  1510. smalltalk.method({
  1511. selector: "observeBrowserModel",
  1512. protocol: 'actions',
  1513. fn: function (){
  1514. var self=this;
  1515. function $HLSaveSourceCode(){return globals.HLSaveSourceCode||(typeof HLSaveSourceCode=="undefined"?nil:HLSaveSourceCode)}
  1516. function $HLShowInstanceToggled(){return globals.HLShowInstanceToggled||(typeof HLShowInstanceToggled=="undefined"?nil:HLShowInstanceToggled)}
  1517. function $HLSourceCodeSaved(){return globals.HLSourceCodeSaved||(typeof HLSourceCodeSaved=="undefined"?nil:HLSourceCodeSaved)}
  1518. function $HLAboutToChange(){return globals.HLAboutToChange||(typeof HLAboutToChange=="undefined"?nil:HLAboutToChange)}
  1519. function $HLParseErrorRaised(){return globals.HLParseErrorRaised||(typeof HLParseErrorRaised=="undefined"?nil:HLParseErrorRaised)}
  1520. function $HLCompileErrorRaised(){return globals.HLCompileErrorRaised||(typeof HLCompileErrorRaised=="undefined"?nil:HLCompileErrorRaised)}
  1521. function $HLUnknownVariableErrorRaised(){return globals.HLUnknownVariableErrorRaised||(typeof HLUnknownVariableErrorRaised=="undefined"?nil:HLUnknownVariableErrorRaised)}
  1522. function $HLInstVarAdded(){return globals.HLInstVarAdded||(typeof HLInstVarAdded=="undefined"?nil:HLInstVarAdded)}
  1523. function $HLMethodSelected(){return globals.HLMethodSelected||(typeof HLMethodSelected=="undefined"?nil:HLMethodSelected)}
  1524. function $HLClassSelected(){return globals.HLClassSelected||(typeof HLClassSelected=="undefined"?nil:HLClassSelected)}
  1525. function $HLPackageSelected(){return globals.HLPackageSelected||(typeof HLPackageSelected=="undefined"?nil:HLPackageSelected)}
  1526. function $HLProtocolSelected(){return globals.HLProtocolSelected||(typeof HLProtocolSelected=="undefined"?nil:HLProtocolSelected)}
  1527. function $HLSourceCodeFocusRequested(){return globals.HLSourceCodeFocusRequested||(typeof HLSourceCodeFocusRequested=="undefined"?nil:HLSourceCodeFocusRequested)}
  1528. function $HLShowTemplate(){return globals.HLShowTemplate||(typeof HLShowTemplate=="undefined"?nil:HLShowTemplate)}
  1529. return smalltalk.withContext(function($ctx1) {
  1530. var $1,$2;
  1531. $1=_st(self._browserModel())._announcer();
  1532. _st($1)._on_send_to_($HLSaveSourceCode(),"onSaveIt",self);
  1533. $ctx1.sendIdx["on:send:to:"]=1;
  1534. _st($1)._on_send_to_($HLShowInstanceToggled(),"onShowInstanceToggled",self);
  1535. $ctx1.sendIdx["on:send:to:"]=2;
  1536. _st($1)._on_send_to_($HLSourceCodeSaved(),"onSourceCodeSaved",self);
  1537. $ctx1.sendIdx["on:send:to:"]=3;
  1538. _st($1)._on_send_to_($HLAboutToChange(),"onBrowserAboutToChange:",self);
  1539. $ctx1.sendIdx["on:send:to:"]=4;
  1540. _st($1)._on_send_to_($HLParseErrorRaised(),"onParseError:",self);
  1541. $ctx1.sendIdx["on:send:to:"]=5;
  1542. _st($1)._on_send_to_($HLCompileErrorRaised(),"onCompileError:",self);
  1543. $ctx1.sendIdx["on:send:to:"]=6;
  1544. _st($1)._on_send_to_($HLUnknownVariableErrorRaised(),"onUnknownVariableError:",self);
  1545. $ctx1.sendIdx["on:send:to:"]=7;
  1546. _st($1)._on_send_to_($HLInstVarAdded(),"onInstVarAdded",self);
  1547. $ctx1.sendIdx["on:send:to:"]=8;
  1548. _st($1)._on_send_to_($HLMethodSelected(),"onMethodSelected:",self);
  1549. $ctx1.sendIdx["on:send:to:"]=9;
  1550. _st($1)._on_send_to_($HLClassSelected(),"onClassSelected:",self);
  1551. $ctx1.sendIdx["on:send:to:"]=10;
  1552. _st($1)._on_send_to_($HLPackageSelected(),"onPackageSelected:",self);
  1553. $ctx1.sendIdx["on:send:to:"]=11;
  1554. _st($1)._on_send_to_($HLProtocolSelected(),"onProtocolSelected:",self);
  1555. $ctx1.sendIdx["on:send:to:"]=12;
  1556. _st($1)._on_send_to_($HLSourceCodeFocusRequested(),"onSourceCodeFocusRequested",self);
  1557. $ctx1.sendIdx["on:send:to:"]=13;
  1558. $2=_st($1)._on_send_to_($HLShowTemplate(),"onShowTemplate:",self);
  1559. return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{},globals.HLBrowserCodeWidget)})},
  1560. args: [],
  1561. source: "observeBrowserModel\x0a\x09self browserModel announcer\x0a\x09\x09on: HLSaveSourceCode\x0a\x09\x09send: #onSaveIt\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLShowInstanceToggled\x0a\x09\x09send: #onShowInstanceToggled\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLSourceCodeSaved\x0a\x09\x09send: #onSourceCodeSaved\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLAboutToChange\x0a\x09\x09send: #onBrowserAboutToChange:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLParseErrorRaised\x0a\x09\x09send: #onParseError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLCompileErrorRaised\x0a\x09\x09send: #onCompileError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLUnknownVariableErrorRaised\x0a\x09\x09send: #onUnknownVariableError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLInstVarAdded \x0a\x09\x09send: #onInstVarAdded\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLMethodSelected \x0a\x09\x09send: #onMethodSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a \x09on: HLClassSelected \x0a\x09\x09send: #onClassSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLPackageSelected \x0a\x09\x09send: #onPackageSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a \x09on: HLProtocolSelected \x0a\x09\x09send: #onProtocolSelected: \x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLSourceCodeFocusRequested \x0a\x09\x09send: #onSourceCodeFocusRequested\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLShowTemplate\x0a\x09\x09send: #onShowTemplate:\x0a\x09\x09to: self",
  1562. messageSends: ["on:send:to:", "announcer", "browserModel"],
  1563. referencedClasses: ["HLSaveSourceCode", "HLShowInstanceToggled", "HLSourceCodeSaved", "HLAboutToChange", "HLParseErrorRaised", "HLCompileErrorRaised", "HLUnknownVariableErrorRaised", "HLInstVarAdded", "HLMethodSelected", "HLClassSelected", "HLPackageSelected", "HLProtocolSelected", "HLSourceCodeFocusRequested", "HLShowTemplate"]
  1564. }),
  1565. globals.HLBrowserCodeWidget);
  1566. smalltalk.addMethod(
  1567. smalltalk.method({
  1568. selector: "observeSystem",
  1569. protocol: 'actions',
  1570. fn: function (){
  1571. var self=this;
  1572. function $MethodModified(){return globals.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  1573. return smalltalk.withContext(function($ctx1) {
  1574. _st(_st(self._browserModel())._systemAnnouncer())._on_send_to_($MethodModified(),"onMethodModified:",self);
  1575. return self}, function($ctx1) {$ctx1.fill(self,"observeSystem",{},globals.HLBrowserCodeWidget)})},
  1576. args: [],
  1577. source: "observeSystem\x0a\x09self browserModel systemAnnouncer\x0a \x09on: MethodModified\x0a send: #onMethodModified:\x0a\x09\x09to: self",
  1578. messageSends: ["on:send:to:", "systemAnnouncer", "browserModel"],
  1579. referencedClasses: ["MethodModified"]
  1580. }),
  1581. globals.HLBrowserCodeWidget);
  1582. smalltalk.addMethod(
  1583. smalltalk.method({
  1584. selector: "onBrowserAboutToChange:",
  1585. protocol: 'reactions',
  1586. fn: function (anAnnouncement){
  1587. var self=this;
  1588. var block;
  1589. function $HLChangeForbidden(){return globals.HLChangeForbidden||(typeof HLChangeForbidden=="undefined"?nil:HLChangeForbidden)}
  1590. return smalltalk.withContext(function($ctx1) {
  1591. var $1;
  1592. block=_st(anAnnouncement)._actionBlock();
  1593. $1=self._hasModification();
  1594. if(smalltalk.assert($1)){
  1595. self._confirm_ifTrue_("Changes have not been saved. Do you want to discard these changes?",(function(){
  1596. return smalltalk.withContext(function($ctx2) {
  1597. self._methodContents_(self._contents());
  1598. return _st(block)._value();
  1599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1600. _st($HLChangeForbidden())._signal();
  1601. };
  1602. return self}, function($ctx1) {$ctx1.fill(self,"onBrowserAboutToChange:",{anAnnouncement:anAnnouncement,block:block},globals.HLBrowserCodeWidget)})},
  1603. args: ["anAnnouncement"],
  1604. source: "onBrowserAboutToChange: anAnnouncement\x0a\x09| block |\x0a\x09\x0a\x09block := anAnnouncement actionBlock.\x0a\x09\x0a\x09self hasModification\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self \x0a\x09\x09\x09\x09confirm: 'Changes have not been saved. Do you want to discard these changes?' \x0a\x09\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09\x09\x22Don't ask twice\x22\x0a\x09\x09\x09\x09\x09self methodContents: self contents.\x0a\x09\x09\x09\x09\x09block value ].\x0a\x09\x09\x09\x0a\x09\x09\x09\x0a\x09\x09\x09HLChangeForbidden signal ]",
  1605. messageSends: ["actionBlock", "ifTrue:", "hasModification", "confirm:ifTrue:", "methodContents:", "contents", "value", "signal"],
  1606. referencedClasses: ["HLChangeForbidden"]
  1607. }),
  1608. globals.HLBrowserCodeWidget);
  1609. smalltalk.addMethod(
  1610. smalltalk.method({
  1611. selector: "onClassSelected:",
  1612. protocol: 'reactions',
  1613. fn: function (anAnnouncement){
  1614. var self=this;
  1615. var class_;
  1616. return smalltalk.withContext(function($ctx1) {
  1617. var $1,$2;
  1618. class_=_st(anAnnouncement)._item();
  1619. $1=class_;
  1620. if(($receiver = $1) == nil || $receiver == null){
  1621. $2=self._contents_("");
  1622. $ctx1.sendIdx["contents:"]=1;
  1623. return $2;
  1624. } else {
  1625. $1;
  1626. };
  1627. self._contents_(_st(class_)._definition());
  1628. return self}, function($ctx1) {$ctx1.fill(self,"onClassSelected:",{anAnnouncement:anAnnouncement,class_:class_},globals.HLBrowserCodeWidget)})},
  1629. args: ["anAnnouncement"],
  1630. source: "onClassSelected: anAnnouncement\x0a\x09| class |\x0a\x09\x0a\x09class:= anAnnouncement item.\x0a\x09\x0a\x09class ifNil: [ ^ self contents: '' ].\x0a\x09self contents: class definition",
  1631. messageSends: ["item", "ifNil:", "contents:", "definition"],
  1632. referencedClasses: []
  1633. }),
  1634. globals.HLBrowserCodeWidget);
  1635. smalltalk.addMethod(
  1636. smalltalk.method({
  1637. selector: "onCompileError:",
  1638. protocol: 'reactions',
  1639. fn: function (anAnnouncement){
  1640. var self=this;
  1641. return smalltalk.withContext(function($ctx1) {
  1642. self._alert_(_st(_st(anAnnouncement)._error())._messageText());
  1643. return self}, function($ctx1) {$ctx1.fill(self,"onCompileError:",{anAnnouncement:anAnnouncement},globals.HLBrowserCodeWidget)})},
  1644. args: ["anAnnouncement"],
  1645. source: "onCompileError: anAnnouncement\x0a\x09self alert: anAnnouncement error messageText",
  1646. messageSends: ["alert:", "messageText", "error"],
  1647. referencedClasses: []
  1648. }),
  1649. globals.HLBrowserCodeWidget);
  1650. smalltalk.addMethod(
  1651. smalltalk.method({
  1652. selector: "onInstVarAdded",
  1653. protocol: 'reactions',
  1654. fn: function (){
  1655. var self=this;
  1656. return smalltalk.withContext(function($ctx1) {
  1657. _st(self._browserModel())._save_(self._contents());
  1658. return self}, function($ctx1) {$ctx1.fill(self,"onInstVarAdded",{},globals.HLBrowserCodeWidget)})},
  1659. args: [],
  1660. source: "onInstVarAdded\x0a\x09self browserModel save: self contents",
  1661. messageSends: ["save:", "browserModel", "contents"],
  1662. referencedClasses: []
  1663. }),
  1664. globals.HLBrowserCodeWidget);
  1665. smalltalk.addMethod(
  1666. smalltalk.method({
  1667. selector: "onMethodModified:",
  1668. protocol: 'reactions',
  1669. fn: function (anAnnouncement){
  1670. var self=this;
  1671. var method;
  1672. return smalltalk.withContext(function($ctx1) {
  1673. var $3,$2,$1,$5,$4,$7,$6;
  1674. method=_st(anAnnouncement)._method();
  1675. $3=self._browserModel();
  1676. $ctx1.sendIdx["browserModel"]=1;
  1677. $2=_st($3)._selectedClass();
  1678. $1=_st($2).__eq(_st(method)._methodClass());
  1679. $ctx1.sendIdx["="]=1;
  1680. if(! smalltalk.assert($1)){
  1681. return self;
  1682. };
  1683. $5=self._browserModel();
  1684. $ctx1.sendIdx["browserModel"]=2;
  1685. $4=_st($5)._selectedMethod();
  1686. $ctx1.sendIdx["selectedMethod"]=1;
  1687. if(($receiver = $4) == nil || $receiver == null){
  1688. return self;
  1689. } else {
  1690. $4;
  1691. };
  1692. $7=_st(_st(self._browserModel())._selectedMethod())._selector();
  1693. $ctx1.sendIdx["selector"]=1;
  1694. $6=_st($7).__eq(_st(method)._selector());
  1695. if(! smalltalk.assert($6)){
  1696. return self;
  1697. };
  1698. self._refresh();
  1699. return self}, function($ctx1) {$ctx1.fill(self,"onMethodModified:",{anAnnouncement:anAnnouncement,method:method},globals.HLBrowserCodeWidget)})},
  1700. args: ["anAnnouncement"],
  1701. source: "onMethodModified: anAnnouncement\x0a\x09| method |\x0a\x09\x0a\x09method := anAnnouncement method.\x0a\x09\x0a\x09self browserModel selectedClass = method methodClass ifFalse: [ ^ self ].\x0a\x09self browserModel selectedMethod ifNil: [ ^ self ].\x0a\x09self browserModel selectedMethod selector = method selector ifFalse: [ ^ self ].\x0a\x0a\x09self refresh",
  1702. messageSends: ["method", "ifFalse:", "=", "selectedClass", "browserModel", "methodClass", "ifNil:", "selectedMethod", "selector", "refresh"],
  1703. referencedClasses: []
  1704. }),
  1705. globals.HLBrowserCodeWidget);
  1706. smalltalk.addMethod(
  1707. smalltalk.method({
  1708. selector: "onMethodSelected:",
  1709. protocol: 'reactions',
  1710. fn: function (anAnnouncement){
  1711. var self=this;
  1712. var method;
  1713. return smalltalk.withContext(function($ctx1) {
  1714. var $1,$2;
  1715. method=_st(anAnnouncement)._item();
  1716. $1=method;
  1717. if(($receiver = $1) == nil || $receiver == null){
  1718. $2=self._contents_("");
  1719. $ctx1.sendIdx["contents:"]=1;
  1720. return $2;
  1721. } else {
  1722. $1;
  1723. };
  1724. self._contents_(_st(method)._source());
  1725. return self}, function($ctx1) {$ctx1.fill(self,"onMethodSelected:",{anAnnouncement:anAnnouncement,method:method},globals.HLBrowserCodeWidget)})},
  1726. args: ["anAnnouncement"],
  1727. source: "onMethodSelected: anAnnouncement\x0a\x09| method |\x0a\x09\x0a\x09method := anAnnouncement item.\x0a\x09\x0a\x09method ifNil: [ ^ self contents: '' ].\x0a\x09self contents: method source",
  1728. messageSends: ["item", "ifNil:", "contents:", "source"],
  1729. referencedClasses: []
  1730. }),
  1731. globals.HLBrowserCodeWidget);
  1732. smalltalk.addMethod(
  1733. smalltalk.method({
  1734. selector: "onPackageSelected:",
  1735. protocol: 'reactions',
  1736. fn: function (anAnnouncement){
  1737. var self=this;
  1738. var package_;
  1739. return smalltalk.withContext(function($ctx1) {
  1740. var $1,$2;
  1741. package_=_st(anAnnouncement)._item();
  1742. $1=package_;
  1743. if(($receiver = $1) == nil || $receiver == null){
  1744. $2=self._contents_("");
  1745. $ctx1.sendIdx["contents:"]=1;
  1746. return $2;
  1747. } else {
  1748. $1;
  1749. };
  1750. self._contents_(_st(package_)._definition());
  1751. return self}, function($ctx1) {$ctx1.fill(self,"onPackageSelected:",{anAnnouncement:anAnnouncement,package_:package_},globals.HLBrowserCodeWidget)})},
  1752. args: ["anAnnouncement"],
  1753. source: "onPackageSelected: anAnnouncement\x0a\x09| package |\x0a\x09\x0a\x09package := anAnnouncement item.\x0a\x09\x0a\x09package ifNil: [ ^ self contents: '' ].\x0a\x09self contents: package definition",
  1754. messageSends: ["item", "ifNil:", "contents:", "definition"],
  1755. referencedClasses: []
  1756. }),
  1757. globals.HLBrowserCodeWidget);
  1758. smalltalk.addMethod(
  1759. smalltalk.method({
  1760. selector: "onParseError:",
  1761. protocol: 'reactions',
  1762. fn: function (anAnnouncement){
  1763. var self=this;
  1764. var lineIndex,newContents;
  1765. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  1766. return smalltalk.withContext(function($ctx1) {
  1767. var $1,$3,$2,$6,$5,$4;
  1768. lineIndex=(1);
  1769. self._contents_(_st($String())._streamContents_((function(stream){
  1770. return smalltalk.withContext(function($ctx2) {
  1771. return _st(self._contents())._linesDo_((function(each){
  1772. return smalltalk.withContext(function($ctx3) {
  1773. $1=_st(lineIndex).__eq(_st(anAnnouncement)._line());
  1774. if(smalltalk.assert($1)){
  1775. $3=_st(anAnnouncement)._column();
  1776. $ctx3.sendIdx["column"]=1;
  1777. $2=_st(each)._copyFrom_to_((1),$3);
  1778. $ctx3.sendIdx["copyFrom:to:"]=1;
  1779. _st(stream)._nextPutAll_($2);
  1780. $ctx3.sendIdx["nextPutAll:"]=1;
  1781. _st(stream)._nextPutAll_("<- ");
  1782. $ctx3.sendIdx["nextPutAll:"]=2;
  1783. _st(stream)._nextPutAll_(_st(anAnnouncement)._message());
  1784. $ctx3.sendIdx["nextPutAll:"]=3;
  1785. _st(stream)._nextPutAll_(" ");
  1786. $ctx3.sendIdx["nextPutAll:"]=4;
  1787. $6=_st(_st(anAnnouncement)._column()).__plus((1));
  1788. $ctx3.sendIdx["+"]=1;
  1789. $5=_st(each)._copyFrom_to_($6,_st(each)._size());
  1790. $4=_st(stream)._nextPutAll_($5);
  1791. $ctx3.sendIdx["nextPutAll:"]=5;
  1792. $4;
  1793. } else {
  1794. _st(stream)._nextPutAll_(each);
  1795. $ctx3.sendIdx["nextPutAll:"]=6;
  1796. };
  1797. _st(stream)._nextPutAll_(_st($String())._cr());
  1798. lineIndex=_st(lineIndex).__plus((1));
  1799. return lineIndex;
  1800. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
  1801. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})})));
  1802. return self}, function($ctx1) {$ctx1.fill(self,"onParseError:",{anAnnouncement:anAnnouncement,lineIndex:lineIndex,newContents:newContents},globals.HLBrowserCodeWidget)})},
  1803. args: ["anAnnouncement"],
  1804. source: "onParseError: anAnnouncement\x0a\x09| lineIndex newContents |\x0a\x09\x0a\x09lineIndex := 1.\x0a\x09\x0a\x09self contents: (String streamContents: [ :stream |\x0a\x09\x09self contents linesDo: [ :each |\x0a\x09\x09\x09lineIndex = anAnnouncement line \x0a\x09\x09\x09\x09ifTrue: [ \x0a\x09\x09\x09\x09\x09stream \x0a\x09\x09\x09\x09\x09\x09nextPutAll: (each copyFrom: 1 to: anAnnouncement column);\x0a\x09\x09\x09\x09\x09\x09nextPutAll: '<- ';\x0a\x09\x09\x09\x09\x09\x09nextPutAll: anAnnouncement message;\x0a\x09\x09\x09\x09\x09\x09nextPutAll: ' ';\x0a\x09\x09\x09\x09\x09\x09nextPutAll: (each copyFrom: anAnnouncement column + 1 to: each size) ]\x0a\x09\x09\x09\x09ifFalse: [ stream nextPutAll: each ].\x0a\x09\x09\x09stream nextPutAll: String cr.\x0a\x09\x09\x09lineIndex := lineIndex + 1 ] ])",
  1805. messageSends: ["contents:", "streamContents:", "linesDo:", "contents", "ifTrue:ifFalse:", "=", "line", "nextPutAll:", "copyFrom:to:", "column", "message", "+", "size", "cr"],
  1806. referencedClasses: ["String"]
  1807. }),
  1808. globals.HLBrowserCodeWidget);
  1809. smalltalk.addMethod(
  1810. smalltalk.method({
  1811. selector: "onProtocolSelected:",
  1812. protocol: 'reactions',
  1813. fn: function (anAnnouncement){
  1814. var self=this;
  1815. return smalltalk.withContext(function($ctx1) {
  1816. var $2,$1,$3;
  1817. $2=self._browserModel();
  1818. $ctx1.sendIdx["browserModel"]=1;
  1819. $1=_st($2)._selectedClass();
  1820. $ctx1.sendIdx["selectedClass"]=1;
  1821. if(($receiver = $1) == nil || $receiver == null){
  1822. $3=self._contents_("");
  1823. $ctx1.sendIdx["contents:"]=1;
  1824. return $3;
  1825. } else {
  1826. $1;
  1827. };
  1828. self._contents_(_st(_st(self._browserModel())._selectedClass())._definition());
  1829. return self}, function($ctx1) {$ctx1.fill(self,"onProtocolSelected:",{anAnnouncement:anAnnouncement},globals.HLBrowserCodeWidget)})},
  1830. args: ["anAnnouncement"],
  1831. source: "onProtocolSelected: anAnnouncement\x0a\x09self browserModel selectedClass ifNil: [ ^ self contents: '' ].\x0a\x09self contents: self browserModel selectedClass definition",
  1832. messageSends: ["ifNil:", "selectedClass", "browserModel", "contents:", "definition"],
  1833. referencedClasses: []
  1834. }),
  1835. globals.HLBrowserCodeWidget);
  1836. smalltalk.addMethod(
  1837. smalltalk.method({
  1838. selector: "onSaveIt",
  1839. protocol: 'reactions',
  1840. fn: function (){
  1841. var self=this;
  1842. return smalltalk.withContext(function($ctx1) {
  1843. _st(self._browserModel())._save_(self._contents());
  1844. return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{},globals.HLBrowserCodeWidget)})},
  1845. args: [],
  1846. source: "onSaveIt\x0a\x09self browserModel save: self contents",
  1847. messageSends: ["save:", "browserModel", "contents"],
  1848. referencedClasses: []
  1849. }),
  1850. globals.HLBrowserCodeWidget);
  1851. smalltalk.addMethod(
  1852. smalltalk.method({
  1853. selector: "onShowInstanceToggled",
  1854. protocol: 'reactions',
  1855. fn: function (){
  1856. var self=this;
  1857. return smalltalk.withContext(function($ctx1) {
  1858. var $2,$1,$3;
  1859. $2=self._browserModel();
  1860. $ctx1.sendIdx["browserModel"]=1;
  1861. $1=_st($2)._selectedClass();
  1862. $ctx1.sendIdx["selectedClass"]=1;
  1863. if(($receiver = $1) == nil || $receiver == null){
  1864. $3=self._contents_("");
  1865. $ctx1.sendIdx["contents:"]=1;
  1866. return $3;
  1867. } else {
  1868. $1;
  1869. };
  1870. self._contents_(_st(_st(self._browserModel())._selectedClass())._definition());
  1871. return self}, function($ctx1) {$ctx1.fill(self,"onShowInstanceToggled",{},globals.HLBrowserCodeWidget)})},
  1872. args: [],
  1873. source: "onShowInstanceToggled\x0a\x09self browserModel selectedClass ifNil: [ ^ self contents: '' ].\x0a \x0a\x09self contents: self browserModel selectedClass definition",
  1874. messageSends: ["ifNil:", "selectedClass", "browserModel", "contents:", "definition"],
  1875. referencedClasses: []
  1876. }),
  1877. globals.HLBrowserCodeWidget);
  1878. smalltalk.addMethod(
  1879. smalltalk.method({
  1880. selector: "onShowTemplate:",
  1881. protocol: 'reactions',
  1882. fn: function (anAnnouncement){
  1883. var self=this;
  1884. return smalltalk.withContext(function($ctx1) {
  1885. self._contents_(_st(anAnnouncement)._template());
  1886. return self}, function($ctx1) {$ctx1.fill(self,"onShowTemplate:",{anAnnouncement:anAnnouncement},globals.HLBrowserCodeWidget)})},
  1887. args: ["anAnnouncement"],
  1888. source: "onShowTemplate: anAnnouncement\x0a\x09self contents: anAnnouncement template",
  1889. messageSends: ["contents:", "template"],
  1890. referencedClasses: []
  1891. }),
  1892. globals.HLBrowserCodeWidget);
  1893. smalltalk.addMethod(
  1894. smalltalk.method({
  1895. selector: "onSourceCodeFocusRequested",
  1896. protocol: 'reactions',
  1897. fn: function (){
  1898. var self=this;
  1899. return smalltalk.withContext(function($ctx1) {
  1900. self._focus();
  1901. return self}, function($ctx1) {$ctx1.fill(self,"onSourceCodeFocusRequested",{},globals.HLBrowserCodeWidget)})},
  1902. args: [],
  1903. source: "onSourceCodeFocusRequested\x0a\x09self focus",
  1904. messageSends: ["focus"],
  1905. referencedClasses: []
  1906. }),
  1907. globals.HLBrowserCodeWidget);
  1908. smalltalk.addMethod(
  1909. smalltalk.method({
  1910. selector: "onSourceCodeSaved",
  1911. protocol: 'reactions',
  1912. fn: function (){
  1913. var self=this;
  1914. return smalltalk.withContext(function($ctx1) {
  1915. self._methodContents_(self._contents());
  1916. self._updateState();
  1917. return self}, function($ctx1) {$ctx1.fill(self,"onSourceCodeSaved",{},globals.HLBrowserCodeWidget)})},
  1918. args: [],
  1919. source: "onSourceCodeSaved\x0a\x09self methodContents: self contents.\x0a\x09self updateState",
  1920. messageSends: ["methodContents:", "contents", "updateState"],
  1921. referencedClasses: []
  1922. }),
  1923. globals.HLBrowserCodeWidget);
  1924. smalltalk.addMethod(
  1925. smalltalk.method({
  1926. selector: "onUnknownVariableError:",
  1927. protocol: 'reactions',
  1928. fn: function (anAnnouncement){
  1929. var self=this;
  1930. var error;
  1931. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  1932. return smalltalk.withContext(function($ctx1) {
  1933. var $1;
  1934. error=_st(anAnnouncement)._error();
  1935. self._confirm_ifTrue_(_st($String())._streamContents_((function(stream){
  1936. return smalltalk.withContext(function($ctx2) {
  1937. _st(stream)._nextPutAll_(_st(error)._messageText());
  1938. $ctx2.sendIdx["nextPutAll:"]=1;
  1939. _st(stream)._nextPutAll_(_st($String())._cr());
  1940. $ctx2.sendIdx["nextPutAll:"]=2;
  1941. $1=_st(stream)._nextPutAll_("Would you like to define an instance variable?");
  1942. return $1;
  1943. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})})),(function(){
  1944. return smalltalk.withContext(function($ctx2) {
  1945. return _st(self._browserModel())._addInstVarNamed_(_st(error)._variableName());
  1946. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1947. return self}, function($ctx1) {$ctx1.fill(self,"onUnknownVariableError:",{anAnnouncement:anAnnouncement,error:error},globals.HLBrowserCodeWidget)})},
  1948. args: ["anAnnouncement"],
  1949. source: "onUnknownVariableError: anAnnouncement\x0a\x09| error |\x0a\x09\x0a\x09error := anAnnouncement error.\x0a\x09\x0a\x09self \x0a\x09\x09confirm: (String streamContents: [ :stream |\x0a\x09\x09\x09stream \x0a\x09\x09\x09\x09nextPutAll: error messageText;\x0a\x09\x09\x09\x09nextPutAll: String cr;\x0a\x09\x09\x09\x09nextPutAll: 'Would you like to define an instance variable?' ])\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self browserModel addInstVarNamed: error variableName ]",
  1950. messageSends: ["error", "confirm:ifTrue:", "streamContents:", "nextPutAll:", "messageText", "cr", "addInstVarNamed:", "browserModel", "variableName"],
  1951. referencedClasses: ["String"]
  1952. }),
  1953. globals.HLBrowserCodeWidget);
  1954. smalltalk.addMethod(
  1955. smalltalk.method({
  1956. selector: "refresh",
  1957. protocol: 'actions',
  1958. fn: function (){
  1959. var self=this;
  1960. return smalltalk.withContext(function($ctx1) {
  1961. var $1,$2;
  1962. $1=self._hasModification();
  1963. if(smalltalk.assert($1)){
  1964. return self;
  1965. };
  1966. $2=self._hasFocus();
  1967. if(smalltalk.assert($2)){
  1968. return self;
  1969. };
  1970. self._contents_(_st(_st(self._browserModel())._selectedMethod())._source());
  1971. return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},globals.HLBrowserCodeWidget)})},
  1972. args: [],
  1973. source: "refresh\x0a\x09self hasModification ifTrue: [ ^ self ].\x0a self hasFocus ifTrue: [ ^ self ].\x0a\x0a\x09self contents: self browserModel selectedMethod source",
  1974. messageSends: ["ifTrue:", "hasModification", "hasFocus", "contents:", "source", "selectedMethod", "browserModel"],
  1975. referencedClasses: []
  1976. }),
  1977. globals.HLBrowserCodeWidget);
  1978. smalltalk.addMethod(
  1979. smalltalk.method({
  1980. selector: "renderButtonsOn:",
  1981. protocol: 'actions',
  1982. fn: function (html){
  1983. var self=this;
  1984. return smalltalk.withContext(function($ctx1) {
  1985. var $1,$2;
  1986. $1=_st(html)._button();
  1987. _st($1)._class_("button");
  1988. _st($1)._with_("SaveIt");
  1989. $2=_st($1)._onClick_((function(){
  1990. return smalltalk.withContext(function($ctx2) {
  1991. return self._saveIt();
  1992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1993. globals.HLBrowserCodeWidget.superclass.fn.prototype._renderButtonsOn_.apply(_st(self), [html]);
  1994. return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},globals.HLBrowserCodeWidget)})},
  1995. args: ["html"],
  1996. source: "renderButtonsOn: html\x0a\x09html button \x0a\x09\x09class: 'button';\x0a\x09\x09with: 'SaveIt';\x0a\x09\x09onClick: [ self saveIt ].\x0a\x09super renderButtonsOn: html",
  1997. messageSends: ["class:", "button", "with:", "onClick:", "saveIt", "renderButtonsOn:"],
  1998. referencedClasses: []
  1999. }),
  2000. globals.HLBrowserCodeWidget);
  2001. smalltalk.addMethod(
  2002. smalltalk.method({
  2003. selector: "saveIt",
  2004. protocol: 'actions',
  2005. fn: function (){
  2006. var self=this;
  2007. return smalltalk.withContext(function($ctx1) {
  2008. _st(self._browserModel())._saveSourceCode();
  2009. return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{},globals.HLBrowserCodeWidget)})},
  2010. args: [],
  2011. source: "saveIt\x0a\x09self browserModel saveSourceCode",
  2012. messageSends: ["saveSourceCode", "browserModel"],
  2013. referencedClasses: []
  2014. }),
  2015. globals.HLBrowserCodeWidget);
  2016. smalltalk.addMethod(
  2017. smalltalk.method({
  2018. selector: "unregister",
  2019. protocol: 'actions',
  2020. fn: function (){
  2021. var self=this;
  2022. return smalltalk.withContext(function($ctx1) {
  2023. var $2,$1;
  2024. globals.HLBrowserCodeWidget.superclass.fn.prototype._unregsiter.apply(_st(self), []);
  2025. $2=self._browserModel();
  2026. $ctx1.sendIdx["browserModel"]=1;
  2027. $1=_st($2)._announcer();
  2028. _st($1)._unsubscribe_(self);
  2029. $ctx1.sendIdx["unsubscribe:"]=1;
  2030. _st(_st(self._browserModel())._systemAnnouncer())._unsubscribe_(self);
  2031. return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLBrowserCodeWidget)})},
  2032. args: [],
  2033. source: "unregister\x0a\x09super unregsiter.\x0a\x09\x0a\x09self browserModel announcer unsubscribe: self.\x0a\x09self browserModel systemAnnouncer unsubscribe: self",
  2034. messageSends: ["unregsiter", "unsubscribe:", "announcer", "browserModel", "systemAnnouncer"],
  2035. referencedClasses: []
  2036. }),
  2037. globals.HLBrowserCodeWidget);
  2038. smalltalk.addMethod(
  2039. smalltalk.method({
  2040. selector: "canBeOpenAsTab",
  2041. protocol: 'testing',
  2042. fn: function (){
  2043. var self=this;
  2044. return false;
  2045. },
  2046. args: [],
  2047. source: "canBeOpenAsTab\x0a\x09^ false",
  2048. messageSends: [],
  2049. referencedClasses: []
  2050. }),
  2051. globals.HLBrowserCodeWidget.klass);
  2052. smalltalk.addMethod(
  2053. smalltalk.method({
  2054. selector: "on:",
  2055. protocol: 'instance creation',
  2056. fn: function (aBrowserModel){
  2057. var self=this;
  2058. return smalltalk.withContext(function($ctx1) {
  2059. var $2,$3,$1;
  2060. $2=self._new();
  2061. _st($2)._browserModel_(aBrowserModel);
  2062. $3=_st($2)._yourself();
  2063. $1=$3;
  2064. return $1;
  2065. }, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel},globals.HLBrowserCodeWidget.klass)})},
  2066. args: ["aBrowserModel"],
  2067. source: "on: aBrowserModel\x0a\x09^ self new\x0a\x09\x09browserModel: aBrowserModel;\x0a\x09\x09yourself",
  2068. messageSends: ["browserModel:", "new", "yourself"],
  2069. referencedClasses: []
  2070. }),
  2071. globals.HLBrowserCodeWidget.klass);
  2072. smalltalk.addClass('HLWorkspace', globals.HLWidget, ['codeWidget', 'transcript'], 'Helios-Workspace');
  2073. smalltalk.addMethod(
  2074. smalltalk.method({
  2075. selector: "canHaveFocus",
  2076. protocol: 'testing',
  2077. fn: function (){
  2078. var self=this;
  2079. return true;
  2080. },
  2081. args: [],
  2082. source: "canHaveFocus\x0a\x09^ true",
  2083. messageSends: [],
  2084. referencedClasses: []
  2085. }),
  2086. globals.HLWorkspace);
  2087. smalltalk.addMethod(
  2088. smalltalk.method({
  2089. selector: "codeWidget",
  2090. protocol: 'accessing',
  2091. fn: function (){
  2092. var self=this;
  2093. function $HLCodeWidget(){return globals.HLCodeWidget||(typeof HLCodeWidget=="undefined"?nil:HLCodeWidget)}
  2094. return smalltalk.withContext(function($ctx1) {
  2095. var $2,$1;
  2096. $2=self["@codeWidget"];
  2097. if(($receiver = $2) == nil || $receiver == null){
  2098. self["@codeWidget"]=_st($HLCodeWidget())._new();
  2099. $1=self["@codeWidget"];
  2100. } else {
  2101. $1=$2;
  2102. };
  2103. return $1;
  2104. }, function($ctx1) {$ctx1.fill(self,"codeWidget",{},globals.HLWorkspace)})},
  2105. args: [],
  2106. source: "codeWidget\x0a\x09^ codeWidget ifNil: [ codeWidget := HLCodeWidget new ]",
  2107. messageSends: ["ifNil:", "new"],
  2108. referencedClasses: ["HLCodeWidget"]
  2109. }),
  2110. globals.HLWorkspace);
  2111. smalltalk.addMethod(
  2112. smalltalk.method({
  2113. selector: "focus",
  2114. protocol: 'actions',
  2115. fn: function (){
  2116. var self=this;
  2117. return smalltalk.withContext(function($ctx1) {
  2118. var $1;
  2119. $1=_st(self._codeWidget())._focus();
  2120. return $1;
  2121. }, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLWorkspace)})},
  2122. args: [],
  2123. source: "focus\x0a\x09^ self codeWidget focus",
  2124. messageSends: ["focus", "codeWidget"],
  2125. referencedClasses: []
  2126. }),
  2127. globals.HLWorkspace);
  2128. smalltalk.addMethod(
  2129. smalltalk.method({
  2130. selector: "renderContentOn:",
  2131. protocol: 'rendering',
  2132. fn: function (html){
  2133. var self=this;
  2134. function $HLContainer(){return globals.HLContainer||(typeof HLContainer=="undefined"?nil:HLContainer)}
  2135. function $HLHorizontalSplitter(){return globals.HLHorizontalSplitter||(typeof HLHorizontalSplitter=="undefined"?nil:HLHorizontalSplitter)}
  2136. return smalltalk.withContext(function($ctx1) {
  2137. _st(html)._with_(_st($HLContainer())._with_(_st($HLHorizontalSplitter())._with_with_(self._codeWidget(),(function(canvas){
  2138. return smalltalk.withContext(function($ctx2) {
  2139. return self._renderTranscriptOn_(canvas);
  2140. }, function($ctx2) {$ctx2.fillBlock({canvas:canvas},$ctx1,1)})}))));
  2141. $ctx1.sendIdx["with:"]=1;
  2142. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},globals.HLWorkspace)})},
  2143. args: ["html"],
  2144. source: "renderContentOn: html\x0a\x09html with: (HLContainer with: (HLHorizontalSplitter\x0a\x09\x09with: self codeWidget\x0a\x09\x09with: [ :canvas | self renderTranscriptOn: canvas ]))",
  2145. messageSends: ["with:", "with:with:", "codeWidget", "renderTranscriptOn:"],
  2146. referencedClasses: ["HLContainer", "HLHorizontalSplitter"]
  2147. }),
  2148. globals.HLWorkspace);
  2149. smalltalk.addMethod(
  2150. smalltalk.method({
  2151. selector: "renderTranscriptOn:",
  2152. protocol: 'rendering',
  2153. fn: function (html){
  2154. var self=this;
  2155. return smalltalk.withContext(function($ctx1) {
  2156. var $1,$3,$4,$2;
  2157. $1=_st(html)._div();
  2158. $ctx1.sendIdx["div"]=1;
  2159. _st($1)._class_("transcript-container");
  2160. $ctx1.sendIdx["class:"]=1;
  2161. $2=_st($1)._with_((function(){
  2162. return smalltalk.withContext(function($ctx2) {
  2163. $3=_st(html)._div();
  2164. _st($3)._class_("list-label");
  2165. $4=_st($3)._with_("Transcript");
  2166. $4;
  2167. return _st(self._transcript())._renderOn_(html);
  2168. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2169. $ctx1.sendIdx["with:"]=1;
  2170. return self}, function($ctx1) {$ctx1.fill(self,"renderTranscriptOn:",{html:html},globals.HLWorkspace)})},
  2171. args: ["html"],
  2172. source: "renderTranscriptOn: html\x0a\x09html div \x0a\x09\x09class: 'transcript-container';\x0a\x09\x09with: [\x0a\x09\x09\x09html div\x0a\x09\x09\x09\x09class: 'list-label';\x0a\x09\x09\x09\x09with: 'Transcript'.\x0a\x09\x09\x09self transcript renderOn: html ]",
  2173. messageSends: ["class:", "div", "with:", "renderOn:", "transcript"],
  2174. referencedClasses: []
  2175. }),
  2176. globals.HLWorkspace);
  2177. smalltalk.addMethod(
  2178. smalltalk.method({
  2179. selector: "transcript",
  2180. protocol: 'accessing',
  2181. fn: function (){
  2182. var self=this;
  2183. function $HLTranscript(){return globals.HLTranscript||(typeof HLTranscript=="undefined"?nil:HLTranscript)}
  2184. return smalltalk.withContext(function($ctx1) {
  2185. var $2,$1;
  2186. $2=self["@transcript"];
  2187. if(($receiver = $2) == nil || $receiver == null){
  2188. self["@transcript"]=_st($HLTranscript())._new();
  2189. $1=self["@transcript"];
  2190. } else {
  2191. $1=$2;
  2192. };
  2193. return $1;
  2194. }, function($ctx1) {$ctx1.fill(self,"transcript",{},globals.HLWorkspace)})},
  2195. args: [],
  2196. source: "transcript\x0a\x09^ transcript ifNil: [ transcript := HLTranscript new ]",
  2197. messageSends: ["ifNil:", "new"],
  2198. referencedClasses: ["HLTranscript"]
  2199. }),
  2200. globals.HLWorkspace);
  2201. smalltalk.addMethod(
  2202. smalltalk.method({
  2203. selector: "unregister",
  2204. protocol: 'actions',
  2205. fn: function (){
  2206. var self=this;
  2207. return smalltalk.withContext(function($ctx1) {
  2208. globals.HLWorkspace.superclass.fn.prototype._unregister.apply(_st(self), []);
  2209. $ctx1.sendIdx["unregister"]=1;
  2210. _st(self._transcript())._unregister();
  2211. return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLWorkspace)})},
  2212. args: [],
  2213. source: "unregister\x0a\x09super unregister.\x0a\x09self transcript unregister",
  2214. messageSends: ["unregister", "transcript"],
  2215. referencedClasses: []
  2216. }),
  2217. globals.HLWorkspace);
  2218. smalltalk.addMethod(
  2219. smalltalk.method({
  2220. selector: "canBeOpenAsTab",
  2221. protocol: 'testing',
  2222. fn: function (){
  2223. var self=this;
  2224. return true;
  2225. },
  2226. args: [],
  2227. source: "canBeOpenAsTab\x0a\x09^ true",
  2228. messageSends: [],
  2229. referencedClasses: []
  2230. }),
  2231. globals.HLWorkspace.klass);
  2232. smalltalk.addMethod(
  2233. smalltalk.method({
  2234. selector: "tabClass",
  2235. protocol: 'accessing',
  2236. fn: function (){
  2237. var self=this;
  2238. return "workspace";
  2239. },
  2240. args: [],
  2241. source: "tabClass\x0a\x09^ 'workspace'",
  2242. messageSends: [],
  2243. referencedClasses: []
  2244. }),
  2245. globals.HLWorkspace.klass);
  2246. smalltalk.addMethod(
  2247. smalltalk.method({
  2248. selector: "tabLabel",
  2249. protocol: 'accessing',
  2250. fn: function (){
  2251. var self=this;
  2252. return "Workspace";
  2253. },
  2254. args: [],
  2255. source: "tabLabel\x0a\x09^ 'Workspace'",
  2256. messageSends: [],
  2257. referencedClasses: []
  2258. }),
  2259. globals.HLWorkspace.klass);
  2260. smalltalk.addMethod(
  2261. smalltalk.method({
  2262. selector: "tabPriority",
  2263. protocol: 'accessing',
  2264. fn: function (){
  2265. var self=this;
  2266. return (10);
  2267. },
  2268. args: [],
  2269. source: "tabPriority\x0a\x09^ 10",
  2270. messageSends: [],
  2271. referencedClasses: []
  2272. }),
  2273. globals.HLWorkspace.klass);
  2274. });