Helios-Core.js 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003
  1. smalltalk.addPackage('Helios-Core', {});
  2. smalltalk.addClass('HLSourceArea', smalltalk.Widget, ['editor', 'textarea', 'div', 'receiver', 'onDoIt'], 'Helios-Core');
  3. smalltalk.addMethod(
  4. "_clear",
  5. smalltalk.method({
  6. selector: "clear",
  7. category: 'actions',
  8. fn: function (){
  9. var self=this;
  10. smalltalk.send(self,"_contents_",[""]);
  11. return self},
  12. args: [],
  13. source: "clear\x0a self contents: ''",
  14. messageSends: ["contents:"],
  15. referencedClasses: []
  16. }),
  17. smalltalk.HLSourceArea);
  18. smalltalk.addMethod(
  19. "_contents",
  20. smalltalk.method({
  21. selector: "contents",
  22. category: 'accessing',
  23. fn: function (){
  24. var self=this;
  25. var $1;
  26. $1=smalltalk.send(self["@editor"],"_getValue",[]);
  27. return $1;
  28. },
  29. args: [],
  30. source: "contents\x0a ^editor getValue",
  31. messageSends: ["getValue"],
  32. referencedClasses: []
  33. }),
  34. smalltalk.HLSourceArea);
  35. smalltalk.addMethod(
  36. "_contents_",
  37. smalltalk.method({
  38. selector: "contents:",
  39. category: 'accessing',
  40. fn: function (aString){
  41. var self=this;
  42. smalltalk.send(self["@editor"],"_setValue_",[aString]);
  43. return self},
  44. args: ["aString"],
  45. source: "contents: aString\x0a editor setValue: aString",
  46. messageSends: ["setValue:"],
  47. referencedClasses: []
  48. }),
  49. smalltalk.HLSourceArea);
  50. smalltalk.addMethod(
  51. "_currentLine",
  52. smalltalk.method({
  53. selector: "currentLine",
  54. category: 'accessing',
  55. fn: function (){
  56. var self=this;
  57. var $1;
  58. $1=smalltalk.send(self["@editor"],"_getLine_",[smalltalk.send(smalltalk.send(self["@editor"],"_getCursor",[]),"_line",[])]);
  59. return $1;
  60. },
  61. args: [],
  62. source: "currentLine\x0a ^editor getLine: (editor getCursor line)",
  63. messageSends: ["getLine:", "line", "getCursor"],
  64. referencedClasses: []
  65. }),
  66. smalltalk.HLSourceArea);
  67. smalltalk.addMethod(
  68. "_currentLineOrSelection",
  69. smalltalk.method({
  70. selector: "currentLineOrSelection",
  71. category: 'accessing',
  72. fn: function (){
  73. var self=this;
  74. var $2,$1;
  75. $2=smalltalk.send(self["@editor"],"_somethingSelected",[]);
  76. if(smalltalk.assert($2)){
  77. $1=smalltalk.send(self,"_selection",[]);
  78. } else {
  79. $1=smalltalk.send(self,"_currentLine",[]);
  80. };
  81. return $1;
  82. },
  83. args: [],
  84. source: "currentLineOrSelection\x0a ^editor somethingSelected\x0a\x09ifFalse: [self currentLine]\x0a\x09ifTrue: [self selection]",
  85. messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"],
  86. referencedClasses: []
  87. }),
  88. smalltalk.HLSourceArea);
  89. smalltalk.addMethod(
  90. "_doIt",
  91. smalltalk.method({
  92. selector: "doIt",
  93. category: 'actions',
  94. fn: function (){
  95. var self=this;
  96. var $1;
  97. var result;
  98. result=smalltalk.send(self,"_eval_",[smalltalk.send(self,"_currentLineOrSelection",[])]);
  99. $1=smalltalk.send(self,"_onDoIt",[]);
  100. if(($receiver = $1) == nil || $receiver == undefined){
  101. $1;
  102. } else {
  103. smalltalk.send(smalltalk.send(self,"_onDoIt",[]),"_value",[]);
  104. };
  105. return result;
  106. },
  107. args: [],
  108. source: "doIt\x0a | result |\x0a result := self eval: self currentLineOrSelection.\x0a self onDoIt ifNotNil: [self onDoIt value].\x0a ^result",
  109. messageSends: ["eval:", "currentLineOrSelection", "ifNotNil:", "value", "onDoIt"],
  110. referencedClasses: []
  111. }),
  112. smalltalk.HLSourceArea);
  113. smalltalk.addMethod(
  114. "_editor",
  115. smalltalk.method({
  116. selector: "editor",
  117. category: 'accessing',
  118. fn: function (){
  119. var self=this;
  120. return self["@editor"];
  121. },
  122. args: [],
  123. source: "editor\x0a\x09^editor",
  124. messageSends: [],
  125. referencedClasses: []
  126. }),
  127. smalltalk.HLSourceArea);
  128. smalltalk.addMethod(
  129. "_eval_",
  130. smalltalk.method({
  131. selector: "eval:",
  132. category: 'actions',
  133. fn: function (aString){
  134. var self=this;
  135. var $1,$2;
  136. var $early={};
  137. try {
  138. var compiler;
  139. compiler=smalltalk.send((smalltalk.Compiler || Compiler),"_new",[]);
  140. smalltalk.send((function(){
  141. return smalltalk.send(compiler,"_parseExpression_",[aString]);
  142. }),"_on_do_",[(smalltalk.Error || Error),(function(ex){
  143. $1=smalltalk.send(window,"_alert_",[smalltalk.send(ex,"_messageText",[])]);
  144. throw $early=[$1];
  145. })]);
  146. $2=smalltalk.send(smalltalk.send(smalltalk.send(compiler,"_eval_",[smalltalk.send(compiler,"_compile_forClass_",[smalltalk.send(smalltalk.send("doIt ^[","__comma",[aString]),"__comma",["] value"]),(smalltalk.DoIt || DoIt)])]),"_fn",[]),"_applyTo_arguments_",[smalltalk.send(self,"_receiver",[]),[]]);
  147. return $2;
  148. }
  149. catch(e) {if(e===$early)return e[0]; throw e}
  150. },
  151. args: ["aString"],
  152. source: "eval: aString\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09[compiler parseExpression: aString] on: Error do: [:ex |\x0a\x09\x09^window alert: ex messageText].\x0a\x09^(compiler eval: (compiler compile: 'doIt ^[', aString, '] value' forClass: DoIt)) fn applyTo: self receiver arguments: #()",
  153. messageSends: ["new", "on:do:", "alert:", "messageText", "parseExpression:", "applyTo:arguments:", "receiver", "fn", "eval:", "compile:forClass:", ","],
  154. referencedClasses: ["Compiler", "Error", "DoIt"]
  155. }),
  156. smalltalk.HLSourceArea);
  157. smalltalk.addMethod(
  158. "_fileIn",
  159. smalltalk.method({
  160. selector: "fileIn",
  161. category: 'actions',
  162. fn: function (){
  163. var self=this;
  164. smalltalk.send(smalltalk.send((smalltalk.Importer || Importer),"_new",[]),"_import_",[smalltalk.send(smalltalk.send(self,"_currentLineOrSelection",[]),"_readStream",[])]);
  165. return self},
  166. args: [],
  167. source: "fileIn\x0a Importer new import: self currentLineOrSelection readStream",
  168. messageSends: ["import:", "readStream", "currentLineOrSelection", "new"],
  169. referencedClasses: ["Importer"]
  170. }),
  171. smalltalk.HLSourceArea);
  172. smalltalk.addMethod(
  173. "_handleKeyDown_",
  174. smalltalk.method({
  175. selector: "handleKeyDown:",
  176. category: 'actions',
  177. fn: function (anEvent){
  178. var self=this;
  179. if(anEvent.ctrlKey) {
  180. if(anEvent.keyCode === 80) { //ctrl+p
  181. self._printIt();
  182. anEvent.preventDefault();
  183. return false;
  184. }
  185. if(anEvent.keyCode === 68) { //ctrl+d
  186. self._doIt();
  187. anEvent.preventDefault();
  188. return false;
  189. }
  190. if(anEvent.keyCode === 73) { //ctrl+i
  191. self._inspectIt();
  192. anEvent.preventDefault();
  193. return false;
  194. }
  195. };
  196. ;
  197. return self},
  198. args: ["anEvent"],
  199. source: "handleKeyDown: anEvent\x0a <if(anEvent.ctrlKey) {\x0a\x09\x09if(anEvent.keyCode === 80) { //ctrl+p\x0a\x09\x09\x09self._printIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09if(anEvent.keyCode === 68) { //ctrl+d\x0a\x09\x09\x09self._doIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09if(anEvent.keyCode === 73) { //ctrl+i\x0a\x09\x09\x09self._inspectIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09}>",
  200. messageSends: [],
  201. referencedClasses: []
  202. }),
  203. smalltalk.HLSourceArea);
  204. smalltalk.addMethod(
  205. "_inspectIt",
  206. smalltalk.method({
  207. selector: "inspectIt",
  208. category: 'actions',
  209. fn: function (){
  210. var self=this;
  211. smalltalk.send(smalltalk.send(self,"_doIt",[]),"_inspect",[]);
  212. return self},
  213. args: [],
  214. source: "inspectIt\x0a self doIt inspect",
  215. messageSends: ["inspect", "doIt"],
  216. referencedClasses: []
  217. }),
  218. smalltalk.HLSourceArea);
  219. smalltalk.addMethod(
  220. "_onDoIt",
  221. smalltalk.method({
  222. selector: "onDoIt",
  223. category: 'accessing',
  224. fn: function (){
  225. var self=this;
  226. return self["@onDoIt"];
  227. },
  228. args: [],
  229. source: "onDoIt\x0a\x09^onDoIt",
  230. messageSends: [],
  231. referencedClasses: []
  232. }),
  233. smalltalk.HLSourceArea);
  234. smalltalk.addMethod(
  235. "_onDoIt_",
  236. smalltalk.method({
  237. selector: "onDoIt:",
  238. category: 'accessing',
  239. fn: function (aBlock){
  240. var self=this;
  241. self["@onDoIt"]=aBlock;
  242. return self},
  243. args: ["aBlock"],
  244. source: "onDoIt: aBlock\x0a\x09onDoIt := aBlock",
  245. messageSends: [],
  246. referencedClasses: []
  247. }),
  248. smalltalk.HLSourceArea);
  249. smalltalk.addMethod(
  250. "_onKeyDown_",
  251. smalltalk.method({
  252. selector: "onKeyDown:",
  253. category: 'events',
  254. fn: function (aBlock){
  255. var self=this;
  256. smalltalk.send(self["@div"],"_onKeyDown_",[aBlock]);
  257. return self},
  258. args: ["aBlock"],
  259. source: "onKeyDown: aBlock\x0a\x09div onKeyDown: aBlock",
  260. messageSends: ["onKeyDown:"],
  261. referencedClasses: []
  262. }),
  263. smalltalk.HLSourceArea);
  264. smalltalk.addMethod(
  265. "_onKeyUp_",
  266. smalltalk.method({
  267. selector: "onKeyUp:",
  268. category: 'events',
  269. fn: function (aBlock){
  270. var self=this;
  271. smalltalk.send(self["@div"],"_onKeyUp_",[aBlock]);
  272. return self},
  273. args: ["aBlock"],
  274. source: "onKeyUp: aBlock\x0a\x09div onKeyUp: aBlock",
  275. messageSends: ["onKeyUp:"],
  276. referencedClasses: []
  277. }),
  278. smalltalk.HLSourceArea);
  279. smalltalk.addMethod(
  280. "_print_",
  281. smalltalk.method({
  282. selector: "print:",
  283. category: 'actions',
  284. fn: function (aString){
  285. var self=this;
  286. var start;
  287. var stop;
  288. start=smalltalk.send((smalltalk.HashedCollection || HashedCollection),"_new",[]);
  289. stop=smalltalk.send((smalltalk.HashedCollection || HashedCollection),"_new",[]);
  290. smalltalk.send(start,"_at_put_",["line",smalltalk.send(smalltalk.send(self["@editor"],"_getCursor_",[false]),"_line",[])]);
  291. smalltalk.send(start,"_at_put_",["ch",smalltalk.send(smalltalk.send(self["@editor"],"_getCursor_",[false]),"_ch",[])]);
  292. smalltalk.send(stop,"_at_put_",["line",smalltalk.send(start,"_at_",["line"])]);
  293. smalltalk.send(stop,"_at_put_",["ch",smalltalk.send(smalltalk.send(smalltalk.send(start,"_at_",["ch"]),"__plus",[smalltalk.send(aString,"_size",[])]),"__plus",[(2)])]);
  294. smalltalk.send(self["@editor"],"_replaceSelection_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self["@editor"],"_getSelection",[]),"__comma",[" "]),"__comma",[aString]),"__comma",[" "])]);
  295. smalltalk.send(self["@editor"],"_setCursor_",[smalltalk.send(self["@editor"],"_getCursor_",[true])]);
  296. smalltalk.send(self["@editor"],"_setSelection_end_",[stop,start]);
  297. return self},
  298. args: ["aString"],
  299. source: "print: aString\x0a\x09| start stop |\x0a\x09start := HashedCollection new.\x0a\x09stop := HashedCollection new.\x0a\x09start at: 'line' put: (editor getCursor: false) line.\x0a\x09start at: 'ch' put: (editor getCursor: false) ch.\x0a\x09stop at: 'line' put: (start at: 'line').\x0a\x09stop at: 'ch' put: ((start at: 'ch') + aString size + 2).\x0a\x09editor replaceSelection: (editor getSelection, ' ', aString, ' ').\x0a\x09editor setCursor: (editor getCursor: true).\x0a\x09editor setSelection: stop end: start",
  300. messageSends: ["new", "at:put:", "line", "getCursor:", "ch", "at:", "+", "size", "replaceSelection:", ",", "getSelection", "setCursor:", "setSelection:end:"],
  301. referencedClasses: ["HashedCollection"]
  302. }),
  303. smalltalk.HLSourceArea);
  304. smalltalk.addMethod(
  305. "_printIt",
  306. smalltalk.method({
  307. selector: "printIt",
  308. category: 'actions',
  309. fn: function (){
  310. var self=this;
  311. smalltalk.send(self,"_print_",[smalltalk.send(smalltalk.send(self,"_doIt",[]),"_printString",[])]);
  312. return self},
  313. args: [],
  314. source: "printIt\x0a self print: self doIt printString",
  315. messageSends: ["print:", "printString", "doIt"],
  316. referencedClasses: []
  317. }),
  318. smalltalk.HLSourceArea);
  319. smalltalk.addMethod(
  320. "_receiver",
  321. smalltalk.method({
  322. selector: "receiver",
  323. category: 'accessing',
  324. fn: function (){
  325. var self=this;
  326. var $1;
  327. if(($receiver = self["@receiver"]) == nil || $receiver == undefined){
  328. $1=smalltalk.send((smalltalk.DoIt || DoIt),"_new",[]);
  329. } else {
  330. $1=self["@receiver"];
  331. };
  332. return $1;
  333. },
  334. args: [],
  335. source: "receiver\x0a\x09^receiver ifNil: [DoIt new]",
  336. messageSends: ["ifNil:", "new"],
  337. referencedClasses: ["DoIt"]
  338. }),
  339. smalltalk.HLSourceArea);
  340. smalltalk.addMethod(
  341. "_receiver_",
  342. smalltalk.method({
  343. selector: "receiver:",
  344. category: 'accessing',
  345. fn: function (anObject){
  346. var self=this;
  347. self["@receiver"]=anObject;
  348. return self},
  349. args: ["anObject"],
  350. source: "receiver: anObject\x0a\x09receiver := anObject",
  351. messageSends: [],
  352. referencedClasses: []
  353. }),
  354. smalltalk.HLSourceArea);
  355. smalltalk.addMethod(
  356. "_renderOn_",
  357. smalltalk.method({
  358. selector: "renderOn:",
  359. category: 'rendering',
  360. fn: function (html){
  361. var self=this;
  362. self["@div"]=smalltalk.send(smalltalk.send(html,"_div",[]),"_class_",["source"]);
  363. smalltalk.send(self["@div"],"_with_",[(function(){
  364. self["@textarea"]=smalltalk.send(html,"_textarea",[]);
  365. return self["@textarea"];
  366. })]);
  367. smalltalk.send(self,"_setEditorOn_",[smalltalk.send(self["@textarea"],"_element",[])]);
  368. smalltalk.send(self["@div"],"_onKeyDown_",[(function(e){
  369. return smalltalk.send(self,"_handleKeyDown_",[e]);
  370. })]);
  371. return self},
  372. args: ["html"],
  373. source: "renderOn: html\x0a div := html div class: 'source'.\x0a div with: [textarea := html textarea].\x0a self setEditorOn: textarea element.\x0a div onKeyDown: [:e | self handleKeyDown: e]",
  374. messageSends: ["class:", "div", "with:", "textarea", "setEditorOn:", "element", "onKeyDown:", "handleKeyDown:"],
  375. referencedClasses: []
  376. }),
  377. smalltalk.HLSourceArea);
  378. smalltalk.addMethod(
  379. "_selection",
  380. smalltalk.method({
  381. selector: "selection",
  382. category: 'accessing',
  383. fn: function (){
  384. var self=this;
  385. var $1;
  386. $1=smalltalk.send(self["@editor"],"_getSelection",[]);
  387. return $1;
  388. },
  389. args: [],
  390. source: "selection\x0a\x09^editor getSelection",
  391. messageSends: ["getSelection"],
  392. referencedClasses: []
  393. }),
  394. smalltalk.HLSourceArea);
  395. smalltalk.addMethod(
  396. "_selectionEnd",
  397. smalltalk.method({
  398. selector: "selectionEnd",
  399. category: 'accessing',
  400. fn: function (){
  401. var self=this;
  402. var $1;
  403. $1=smalltalk.send(smalltalk.send(self["@textarea"],"_element",[]),"_selectionEnd",[]);
  404. return $1;
  405. },
  406. args: [],
  407. source: "selectionEnd\x0a ^textarea element selectionEnd",
  408. messageSends: ["selectionEnd", "element"],
  409. referencedClasses: []
  410. }),
  411. smalltalk.HLSourceArea);
  412. smalltalk.addMethod(
  413. "_selectionEnd_",
  414. smalltalk.method({
  415. selector: "selectionEnd:",
  416. category: 'accessing',
  417. fn: function (anInteger){
  418. var self=this;
  419. smalltalk.send(smalltalk.send(self["@textarea"],"_element",[]),"_selectionEnd_",[anInteger]);
  420. return self},
  421. args: ["anInteger"],
  422. source: "selectionEnd: anInteger\x0a textarea element selectionEnd: anInteger",
  423. messageSends: ["selectionEnd:", "element"],
  424. referencedClasses: []
  425. }),
  426. smalltalk.HLSourceArea);
  427. smalltalk.addMethod(
  428. "_selectionStart",
  429. smalltalk.method({
  430. selector: "selectionStart",
  431. category: 'accessing',
  432. fn: function (){
  433. var self=this;
  434. var $1;
  435. $1=smalltalk.send(smalltalk.send(self["@textarea"],"_element",[]),"_selectionStart",[]);
  436. return $1;
  437. },
  438. args: [],
  439. source: "selectionStart\x0a ^textarea element selectionStart",
  440. messageSends: ["selectionStart", "element"],
  441. referencedClasses: []
  442. }),
  443. smalltalk.HLSourceArea);
  444. smalltalk.addMethod(
  445. "_selectionStart_",
  446. smalltalk.method({
  447. selector: "selectionStart:",
  448. category: 'accessing',
  449. fn: function (anInteger){
  450. var self=this;
  451. smalltalk.send(smalltalk.send(self["@textarea"],"_element",[]),"_selectionStart_",[anInteger]);
  452. return self},
  453. args: ["anInteger"],
  454. source: "selectionStart: anInteger\x0a textarea element selectionStart: anInteger",
  455. messageSends: ["selectionStart:", "element"],
  456. referencedClasses: []
  457. }),
  458. smalltalk.HLSourceArea);
  459. smalltalk.addMethod(
  460. "_setEditorOn_",
  461. smalltalk.method({
  462. selector: "setEditorOn:",
  463. category: 'accessing',
  464. fn: function (aTextarea){
  465. var self=this;
  466. self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  467. theme: 'amber',
  468. lineNumbers: true,
  469. enterMode: 'flat',
  470. matchBrackets: true,
  471. electricChars: false
  472. });
  473. ;
  474. return self},
  475. args: ["aTextarea"],
  476. source: "setEditorOn: aTextarea\x0a\x09<self['@editor'] = CodeMirror.fromTextArea(aTextarea, {\x0a\x09\x09theme: 'amber',\x0a lineNumbers: true,\x0a enterMode: 'flat',\x0a matchBrackets: true,\x0a electricChars: false\x0a\x09})>",
  477. messageSends: [],
  478. referencedClasses: []
  479. }),
  480. smalltalk.HLSourceArea);
  481. smalltalk.addMethod(
  482. "_val",
  483. smalltalk.method({
  484. selector: "val",
  485. category: 'accessing',
  486. fn: function (){
  487. var self=this;
  488. var $1;
  489. $1=smalltalk.send(self["@editor"],"_getValue",[]);
  490. return $1;
  491. },
  492. args: [],
  493. source: "val\x0a ^editor getValue",
  494. messageSends: ["getValue"],
  495. referencedClasses: []
  496. }),
  497. smalltalk.HLSourceArea);
  498. smalltalk.addMethod(
  499. "_val_",
  500. smalltalk.method({
  501. selector: "val:",
  502. category: 'accessing',
  503. fn: function (aString){
  504. var self=this;
  505. smalltalk.send(self["@editor"],"_setValue_",[aString]);
  506. return self},
  507. args: ["aString"],
  508. source: "val: aString\x0a editor setValue: aString",
  509. messageSends: ["setValue:"],
  510. referencedClasses: []
  511. }),
  512. smalltalk.HLSourceArea);
  513. smalltalk.addClass('HLTab', smalltalk.Object, ['widget', 'label'], 'Helios-Core');
  514. smalltalk.addMethod(
  515. "_activate",
  516. smalltalk.method({
  517. selector: "activate",
  518. category: 'accessing',
  519. fn: function (){
  520. var self=this;
  521. smalltalk.send(smalltalk.send(self,"_manager",[]),"_activate_",[self]);
  522. return self},
  523. args: [],
  524. source: "activate\x0a\x09self manager activate: self",
  525. messageSends: ["activate:", "manager"],
  526. referencedClasses: []
  527. }),
  528. smalltalk.HLTab);
  529. smalltalk.addMethod(
  530. "_add",
  531. smalltalk.method({
  532. selector: "add",
  533. category: 'accessing',
  534. fn: function (){
  535. var self=this;
  536. smalltalk.send(smalltalk.send(self,"_manager",[]),"_addTab_",[self]);
  537. return self},
  538. args: [],
  539. source: "add\x0a\x09self manager addTab: self",
  540. messageSends: ["addTab:", "manager"],
  541. referencedClasses: []
  542. }),
  543. smalltalk.HLTab);
  544. smalltalk.addMethod(
  545. "_isActive",
  546. smalltalk.method({
  547. selector: "isActive",
  548. category: 'testing',
  549. fn: function (){
  550. var self=this;
  551. var $1;
  552. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_manager",[]),"_activeTab",[]),"__eq",[self]);
  553. return $1;
  554. },
  555. args: [],
  556. source: "isActive\x0a\x09^ self manager activeTab = self",
  557. messageSends: ["=", "activeTab", "manager"],
  558. referencedClasses: []
  559. }),
  560. smalltalk.HLTab);
  561. smalltalk.addMethod(
  562. "_label",
  563. smalltalk.method({
  564. selector: "label",
  565. category: 'accessing',
  566. fn: function (){
  567. var self=this;
  568. var $1;
  569. if(($receiver = self["@label"]) == nil || $receiver == undefined){
  570. $1="";
  571. } else {
  572. $1=self["@label"];
  573. };
  574. return $1;
  575. },
  576. args: [],
  577. source: "label\x0a\x09^ label ifNil: [ '' ]",
  578. messageSends: ["ifNil:"],
  579. referencedClasses: []
  580. }),
  581. smalltalk.HLTab);
  582. smalltalk.addMethod(
  583. "_label_",
  584. smalltalk.method({
  585. selector: "label:",
  586. category: 'accessing',
  587. fn: function (aString){
  588. var self=this;
  589. self["@label"]=aString;
  590. return self},
  591. args: ["aString"],
  592. source: "label: aString\x0a\x09label := aString",
  593. messageSends: [],
  594. referencedClasses: []
  595. }),
  596. smalltalk.HLTab);
  597. smalltalk.addMethod(
  598. "_manager",
  599. smalltalk.method({
  600. selector: "manager",
  601. category: 'accessing',
  602. fn: function (){
  603. var self=this;
  604. var $1;
  605. $1=smalltalk.send((smalltalk.HLManager || HLManager),"_current",[]);
  606. return $1;
  607. },
  608. args: [],
  609. source: "manager\x0a\x09^ HLManager current",
  610. messageSends: ["current"],
  611. referencedClasses: ["HLManager"]
  612. }),
  613. smalltalk.HLTab);
  614. smalltalk.addMethod(
  615. "_widget",
  616. smalltalk.method({
  617. selector: "widget",
  618. category: 'accessing',
  619. fn: function (){
  620. var self=this;
  621. return self["@widget"];
  622. },
  623. args: [],
  624. source: "widget\x0a\x09^ widget",
  625. messageSends: [],
  626. referencedClasses: []
  627. }),
  628. smalltalk.HLTab);
  629. smalltalk.addMethod(
  630. "_widget_",
  631. smalltalk.method({
  632. selector: "widget:",
  633. category: 'accessing',
  634. fn: function (aWidget){
  635. var self=this;
  636. self["@widget"]=aWidget;
  637. return self},
  638. args: ["aWidget"],
  639. source: "widget: aWidget\x0a\x09widget := aWidget",
  640. messageSends: [],
  641. referencedClasses: []
  642. }),
  643. smalltalk.HLTab);
  644. smalltalk.addMethod(
  645. "_on_labelled_",
  646. smalltalk.method({
  647. selector: "on:labelled:",
  648. category: 'instance creation',
  649. fn: function (aWidget,aString){
  650. var self=this;
  651. var $2,$3,$1;
  652. $2=smalltalk.send(self,"_new",[]);
  653. smalltalk.send($2,"_widget_",[aWidget]);
  654. smalltalk.send($2,"_label_",[aString]);
  655. $3=smalltalk.send($2,"_yourself",[]);
  656. $1=$3;
  657. return $1;
  658. },
  659. args: ["aWidget", "aString"],
  660. source: "on: aWidget labelled: aString\x0a\x09^ self new\x0a\x09\x09widget: aWidget;\x0a\x09\x09label: aString;\x0a\x09\x09yourself",
  661. messageSends: ["widget:", "new", "label:", "yourself"],
  662. referencedClasses: []
  663. }),
  664. smalltalk.HLTab.klass);
  665. smalltalk.addClass('HLWidget', smalltalk.Widget, ['rootDiv'], 'Helios-Core');
  666. smalltalk.addMethod(
  667. "_manager",
  668. smalltalk.method({
  669. selector: "manager",
  670. category: 'accessing',
  671. fn: function (){
  672. var self=this;
  673. var $1;
  674. $1=smalltalk.send((smalltalk.HLManager || HLManager),"_current",[]);
  675. return $1;
  676. },
  677. args: [],
  678. source: "manager\x0a\x09^ HLManager current",
  679. messageSends: ["current"],
  680. referencedClasses: ["HLManager"]
  681. }),
  682. smalltalk.HLWidget);
  683. smalltalk.addMethod(
  684. "_refresh",
  685. smalltalk.method({
  686. selector: "refresh",
  687. category: 'updating',
  688. fn: function (){
  689. var self=this;
  690. if(($receiver = self["@rootDiv"]) == nil || $receiver == undefined){
  691. return self;
  692. } else {
  693. self["@rootDiv"];
  694. };
  695. smalltalk.send(smalltalk.send(self["@rootDiv"],"_asJQuery",[]),"_empty",[]);
  696. smalltalk.send((function(html){
  697. return smalltalk.send(self,"_renderContentOn_",[html]);
  698. }),"_appendToJQuery_",[smalltalk.send(self["@rootDiv"],"_asJQuery",[])]);
  699. return self},
  700. args: [],
  701. source: "refresh\x0a\x09rootDiv ifNil: [ ^ self ].\x0a \x0a\x09rootDiv asJQuery empty.\x0a [ :html | self renderContentOn: html ] appendToJQuery: rootDiv asJQuery",
  702. messageSends: ["ifNil:", "empty", "asJQuery", "appendToJQuery:", "renderContentOn:"],
  703. referencedClasses: []
  704. }),
  705. smalltalk.HLWidget);
  706. smalltalk.addMethod(
  707. "_registerBindings",
  708. smalltalk.method({
  709. selector: "registerBindings",
  710. category: 'keybindings',
  711. fn: function (){
  712. var self=this;
  713. smalltalk.send(self,"_registerBindingsOn_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_manager",[]),"_keyBinder",[]),"_bindings",[])]);
  714. return self},
  715. args: [],
  716. source: "registerBindings\x0a\x09self registerBindingsOn: self manager keyBinder bindings",
  717. messageSends: ["registerBindingsOn:", "bindings", "keyBinder", "manager"],
  718. referencedClasses: []
  719. }),
  720. smalltalk.HLWidget);
  721. smalltalk.addMethod(
  722. "_registerBindingsOn_",
  723. smalltalk.method({
  724. selector: "registerBindingsOn:",
  725. category: 'keybindings',
  726. fn: function (aBindingGroup){
  727. var self=this;
  728. return self},
  729. args: ["aBindingGroup"],
  730. source: "registerBindingsOn: aBindingGroup",
  731. messageSends: [],
  732. referencedClasses: []
  733. }),
  734. smalltalk.HLWidget);
  735. smalltalk.addMethod(
  736. "_renderContentOn_",
  737. smalltalk.method({
  738. selector: "renderContentOn:",
  739. category: 'rendering',
  740. fn: function (html){
  741. var self=this;
  742. return self},
  743. args: ["html"],
  744. source: "renderContentOn: html\x0a",
  745. messageSends: [],
  746. referencedClasses: []
  747. }),
  748. smalltalk.HLWidget);
  749. smalltalk.addMethod(
  750. "_renderOn_",
  751. smalltalk.method({
  752. selector: "renderOn:",
  753. category: 'rendering',
  754. fn: function (html){
  755. var self=this;
  756. smalltalk.send(self,"_registerBindings",[]);
  757. self["@rootDiv"]=smalltalk.send(smalltalk.send(html,"_div",[]),"_with_",[(function(){
  758. return smalltalk.send(self,"_renderContentOn_",[html]);
  759. })]);
  760. return self},
  761. args: ["html"],
  762. source: "renderOn: html\x0a self registerBindings.\x0a\x0a\x09rootDiv := html div with: [\x0a \x09self renderContentOn: html ]",
  763. messageSends: ["registerBindings", "with:", "renderContentOn:", "div"],
  764. referencedClasses: []
  765. }),
  766. smalltalk.HLWidget);
  767. smalltalk.addMethod(
  768. "_subscribeTo_",
  769. smalltalk.method({
  770. selector: "subscribeTo:",
  771. category: 'announcements',
  772. fn: function (anAnnouncer){
  773. var self=this;
  774. return self},
  775. args: ["anAnnouncer"],
  776. source: "subscribeTo: anAnnouncer",
  777. messageSends: [],
  778. referencedClasses: []
  779. }),
  780. smalltalk.HLWidget);
  781. smalltalk.addMethod(
  782. "_canBeOpenAsTab",
  783. smalltalk.method({
  784. selector: "canBeOpenAsTab",
  785. category: 'testing',
  786. fn: function (){
  787. var self=this;
  788. return false;
  789. },
  790. args: [],
  791. source: "canBeOpenAsTab\x0a\x09^ false",
  792. messageSends: [],
  793. referencedClasses: []
  794. }),
  795. smalltalk.HLWidget.klass);
  796. smalltalk.addMethod(
  797. "_openAsTab",
  798. smalltalk.method({
  799. selector: "openAsTab",
  800. category: 'accessing',
  801. fn: function (){
  802. var self=this;
  803. smalltalk.send(smalltalk.send((smalltalk.HLManager || HLManager),"_current",[]),"_addTab_",[smalltalk.send((smalltalk.HLTab || HLTab),"_on_labelled_",[smalltalk.send(self,"_new",[]),smalltalk.send(self,"_tabLabel",[])])]);
  804. return self},
  805. args: [],
  806. source: "openAsTab\x0a\x09HLManager current addTab: (HLTab on: self new labelled: self tabLabel)",
  807. messageSends: ["addTab:", "on:labelled:", "new", "tabLabel", "current"],
  808. referencedClasses: ["HLTab", "HLManager"]
  809. }),
  810. smalltalk.HLWidget.klass);
  811. smalltalk.addMethod(
  812. "_tabLabel",
  813. smalltalk.method({
  814. selector: "tabLabel",
  815. category: 'accessing',
  816. fn: function (){
  817. var self=this;
  818. return "Tab";
  819. },
  820. args: [],
  821. source: "tabLabel\x0a\x09^ 'Tab'",
  822. messageSends: [],
  823. referencedClasses: []
  824. }),
  825. smalltalk.HLWidget.klass);
  826. smalltalk.addMethod(
  827. "_tabPriority",
  828. smalltalk.method({
  829. selector: "tabPriority",
  830. category: 'accessing',
  831. fn: function (){
  832. var self=this;
  833. return (500);
  834. },
  835. args: [],
  836. source: "tabPriority\x0a\x09^ 500",
  837. messageSends: [],
  838. referencedClasses: []
  839. }),
  840. smalltalk.HLWidget.klass);
  841. smalltalk.addClass('HLDebugger', smalltalk.HLWidget, [], 'Helios-Core');
  842. smalltalk.addClass('HLFocusableWidget', smalltalk.HLWidget, ['hiddenInput'], 'Helios-Core');
  843. smalltalk.addMethod(
  844. "_blur",
  845. smalltalk.method({
  846. selector: "blur",
  847. category: 'events',
  848. fn: function (){
  849. var self=this;
  850. smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_blur",[]);
  851. return self},
  852. args: [],
  853. source: "blur\x0a\x09hiddenInput asJQuery blur",
  854. messageSends: ["blur", "asJQuery"],
  855. referencedClasses: []
  856. }),
  857. smalltalk.HLFocusableWidget);
  858. smalltalk.addMethod(
  859. "_focus",
  860. smalltalk.method({
  861. selector: "focus",
  862. category: 'events',
  863. fn: function (){
  864. var self=this;
  865. smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_focus",[]);
  866. return self},
  867. args: [],
  868. source: "focus\x0a\x09hiddenInput asJQuery focus",
  869. messageSends: ["focus", "asJQuery"],
  870. referencedClasses: []
  871. }),
  872. smalltalk.HLFocusableWidget);
  873. smalltalk.addMethod(
  874. "_focusClass",
  875. smalltalk.method({
  876. selector: "focusClass",
  877. category: 'accessing',
  878. fn: function (){
  879. var self=this;
  880. return "focused";
  881. },
  882. args: [],
  883. source: "focusClass\x0a\x09^ 'focused'",
  884. messageSends: [],
  885. referencedClasses: []
  886. }),
  887. smalltalk.HLFocusableWidget);
  888. smalltalk.addMethod(
  889. "_hasFocus",
  890. smalltalk.method({
  891. selector: "hasFocus",
  892. category: 'events',
  893. fn: function (){
  894. var self=this;
  895. var $1;
  896. $1=smalltalk.send(smalltalk.send(self["@rootDiv"],"_notNil",[]),"_and_",[(function(){
  897. return smalltalk.send(smalltalk.send(self["@rootDiv"],"_asJQuery",[]),"_hasClass_",[smalltalk.send(self,"_focusClass",[])]);
  898. })]);
  899. return $1;
  900. },
  901. args: [],
  902. source: "hasFocus\x0a\x09^ rootDiv notNil and: [ rootDiv asJQuery hasClass: self focusClass ]",
  903. messageSends: ["and:", "hasClass:", "focusClass", "asJQuery", "notNil"],
  904. referencedClasses: []
  905. }),
  906. smalltalk.HLFocusableWidget);
  907. smalltalk.addMethod(
  908. "_renderContentOn_",
  909. smalltalk.method({
  910. selector: "renderContentOn:",
  911. category: 'rendering',
  912. fn: function (html){
  913. var self=this;
  914. return self},
  915. args: ["html"],
  916. source: "renderContentOn: html",
  917. messageSends: [],
  918. referencedClasses: []
  919. }),
  920. smalltalk.HLFocusableWidget);
  921. smalltalk.addMethod(
  922. "_renderHiddenInputOn_",
  923. smalltalk.method({
  924. selector: "renderHiddenInputOn:",
  925. category: 'rendering',
  926. fn: function (html){
  927. var self=this;
  928. var $1,$2;
  929. $1=smalltalk.send(html,"_input",[]);
  930. smalltalk.send($1,"_style_",["position: absolute; left: -100000px;"]);
  931. smalltalk.send($1,"_onBlur_",[(function(){
  932. return smalltalk.send(smalltalk.send(self["@rootDiv"],"_asJQuery",[]),"_removeClass_",[smalltalk.send(self,"_focusClass",[])]);
  933. })]);
  934. $2=smalltalk.send($1,"_onFocus_",[(function(){
  935. return smalltalk.send(smalltalk.send(self["@rootDiv"],"_asJQuery",[]),"_addClass_",[smalltalk.send(self,"_focusClass",[])]);
  936. })]);
  937. self["@hiddenInput"]=$2;
  938. return self},
  939. args: ["html"],
  940. source: "renderHiddenInputOn: html\x0a\x09hiddenInput := html input\x0a \x09style: 'position: absolute; left: -100000px;';\x0a \x09onBlur: [ rootDiv asJQuery removeClass: self focusClass ];\x0a onFocus: [ rootDiv asJQuery addClass: self focusClass ]",
  941. messageSends: ["style:", "input", "onBlur:", "removeClass:", "focusClass", "asJQuery", "onFocus:", "addClass:"],
  942. referencedClasses: []
  943. }),
  944. smalltalk.HLFocusableWidget);
  945. smalltalk.addMethod(
  946. "_renderOn_",
  947. smalltalk.method({
  948. selector: "renderOn:",
  949. category: 'rendering',
  950. fn: function (html){
  951. var self=this;
  952. var $1,$2;
  953. smalltalk.send(self,"_registerBindings",[]);
  954. smalltalk.send(self,"_renderHiddenInputOn_",[html]);
  955. $1=smalltalk.send(html,"_div",[]);
  956. smalltalk.send($1,"_class_",["hl_widget"]);
  957. smalltalk.send($1,"_onClick_",[(function(){
  958. return smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_focus",[]);
  959. })]);
  960. $2=smalltalk.send($1,"_with_",[(function(){
  961. return smalltalk.send(self,"_renderContentOn_",[html]);
  962. })]);
  963. self["@rootDiv"]=$2;
  964. return self},
  965. args: ["html"],
  966. source: "renderOn: html\x0a\x09self registerBindings.\x0a\x09self renderHiddenInputOn: html.\x0a \x0a rootDiv := html div \x0a \x09class: 'hl_widget'; \x0a onClick: [ hiddenInput asJQuery focus ];\x0a with: [\x0a\x09\x09\x09self renderContentOn: html ]",
  967. messageSends: ["registerBindings", "renderHiddenInputOn:", "class:", "div", "onClick:", "focus", "asJQuery", "with:", "renderContentOn:"],
  968. referencedClasses: []
  969. }),
  970. smalltalk.HLFocusableWidget);
  971. smalltalk.addClass('HLListWidget', smalltalk.HLFocusableWidget, ['items', 'selectedItem'], 'Helios-Core');
  972. smalltalk.addMethod(
  973. "_activateListItem_",
  974. smalltalk.method({
  975. selector: "activateListItem:",
  976. category: 'actions',
  977. fn: function (aListItem){
  978. var self=this;
  979. var $1,$2,$3;
  980. var parent;
  981. var position;
  982. $1=smalltalk.send(aListItem,"_get_",[(0)]);
  983. if(($receiver = $1) == nil || $receiver == undefined){
  984. return self;
  985. } else {
  986. $1;
  987. };
  988. position = aListItem.parent().children().get().indexOf(aListItem.get(0)) + 1;
  989. ;
  990. parent=smalltalk.send(aListItem,"_parent",[]);
  991. smalltalk.send(smalltalk.send(parent,"_children",[]),"_removeClass_",["active"]);
  992. smalltalk.send(aListItem,"_addClass_",["active"]);
  993. $2=smalltalk.send(smalltalk.send(smalltalk.send(aListItem,"_position",[]),"_top",[]),"__lt",[(0)]);
  994. if(smalltalk.assert($2)){
  995. smalltalk.send(smalltalk.send(parent,"_get_",[(0)]),"_scrollTop_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(parent,"_get_",[(0)]),"_scrollTop",[]),"__plus",[smalltalk.send(smalltalk.send(aListItem,"_position",[]),"_top",[])]),"__minus",[(10)])]);
  996. };
  997. $3=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aListItem,"_position",[]),"_top",[]),"__plus",[smalltalk.send(aListItem,"_height",[])]),"__gt",[smalltalk.send(parent,"_height",[])]);
  998. if(smalltalk.assert($3)){
  999. smalltalk.send(smalltalk.send(parent,"_get_",[(0)]),"_scrollTop_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(parent,"_get_",[(0)]),"_scrollTop",[]),"__plus",[smalltalk.send(aListItem,"_height",[])]),"__minus",[smalltalk.send(smalltalk.send(parent,"_height",[]),"__minus",[smalltalk.send(smalltalk.send(aListItem,"_position",[]),"_top",[])])]),"__plus",[(10)])]);
  1000. };
  1001. smalltalk.send(self,"_selectItem_",[smalltalk.send(smalltalk.send(self,"_items",[]),"_at_",[smalltalk.send(smalltalk.send(aListItem,"_attr_",["list-data"]),"_asNumber",[])])]);
  1002. return self},
  1003. args: ["aListItem"],
  1004. source: "activateListItem: aListItem\x0a\x09| parent position |\x0a \x0a\x09(aListItem get: 0) ifNil: [ ^self ].\x0a\x0a\x09<position = aListItem.parent().children().get().indexOf(aListItem.get(0)) + 1>.\x0a\x0a parent := aListItem parent.\x0a\x09parent children removeClass: 'active'.\x0a\x09aListItem addClass: 'active'.\x0a \x0a \x22Move the scrollbar to show the active element\x22\x0a aListItem position top < 0 ifTrue: [\x0a\x09\x09(parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem position top - 10) ].\x0a aListItem position top + aListItem height > parent height ifTrue: [ \x0a\x09\x09(parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem height - (parent height - aListItem position top)) +10 ].\x0a \x0a \x22Activate the corresponding item\x22\x0a self selectItem: (self items at: (aListItem attr: 'list-data') asNumber)",
  1005. messageSends: ["ifNil:", "get:", "parent", "removeClass:", "children", "addClass:", "ifTrue:", "scrollTop:", "-", "+", "top", "position", "scrollTop", "<", "height", ">", "selectItem:", "at:", "asNumber", "attr:", "items"],
  1006. referencedClasses: []
  1007. }),
  1008. smalltalk.HLListWidget);
  1009. smalltalk.addMethod(
  1010. "_cssClassForItem_",
  1011. smalltalk.method({
  1012. selector: "cssClassForItem:",
  1013. category: 'accessing',
  1014. fn: function (anObject){
  1015. var self=this;
  1016. var $2,$1;
  1017. $2=smalltalk.send(smalltalk.send(self,"_selectedItem",[]),"__eq",[anObject]);
  1018. if(smalltalk.assert($2)){
  1019. $1="active";
  1020. } else {
  1021. $1="inactive";
  1022. };
  1023. return $1;
  1024. },
  1025. args: ["anObject"],
  1026. source: "cssClassForItem: anObject\x0a\x09^ self selectedItem = anObject\x0a\x09\x09\x09ifTrue: [ 'active' ]\x0a\x09\x09\x09ifFalse: [ 'inactive' ]",
  1027. messageSends: ["ifTrue:ifFalse:", "=", "selectedItem"],
  1028. referencedClasses: []
  1029. }),
  1030. smalltalk.HLListWidget);
  1031. smalltalk.addMethod(
  1032. "_iconForItem_",
  1033. smalltalk.method({
  1034. selector: "iconForItem:",
  1035. category: 'accessing',
  1036. fn: function (anObject){
  1037. var self=this;
  1038. return "";
  1039. },
  1040. args: ["anObject"],
  1041. source: "iconForItem: anObject\x0a\x09^ ''",
  1042. messageSends: [],
  1043. referencedClasses: []
  1044. }),
  1045. smalltalk.HLListWidget);
  1046. smalltalk.addMethod(
  1047. "_items",
  1048. smalltalk.method({
  1049. selector: "items",
  1050. category: 'accessing',
  1051. fn: function (){
  1052. var self=this;
  1053. var $1;
  1054. if(($receiver = self["@items"]) == nil || $receiver == undefined){
  1055. $1=[];
  1056. } else {
  1057. $1=self["@items"];
  1058. };
  1059. return $1;
  1060. },
  1061. args: [],
  1062. source: "items\x0a\x09^ items ifNil: [ #() ]",
  1063. messageSends: ["ifNil:"],
  1064. referencedClasses: []
  1065. }),
  1066. smalltalk.HLListWidget);
  1067. smalltalk.addMethod(
  1068. "_items_",
  1069. smalltalk.method({
  1070. selector: "items:",
  1071. category: 'accessing',
  1072. fn: function (aCollection){
  1073. var self=this;
  1074. self["@items"]=aCollection;
  1075. return self},
  1076. args: ["aCollection"],
  1077. source: "items: aCollection\x0a\x09items := aCollection",
  1078. messageSends: [],
  1079. referencedClasses: []
  1080. }),
  1081. smalltalk.HLListWidget);
  1082. smalltalk.addMethod(
  1083. "_renderButtonsOn_",
  1084. smalltalk.method({
  1085. selector: "renderButtonsOn:",
  1086. category: 'rendering',
  1087. fn: function (html){
  1088. var self=this;
  1089. return self},
  1090. args: ["html"],
  1091. source: "renderButtonsOn: html",
  1092. messageSends: [],
  1093. referencedClasses: []
  1094. }),
  1095. smalltalk.HLListWidget);
  1096. smalltalk.addMethod(
  1097. "_renderContentOn_",
  1098. smalltalk.method({
  1099. selector: "renderContentOn:",
  1100. category: 'rendering',
  1101. fn: function (html){
  1102. var self=this;
  1103. var $1,$2,$3,$4;
  1104. $1=smalltalk.send(html,"_ul",[]);
  1105. smalltalk.send($1,"_class_",["nav nav-pills nav-stacked"]);
  1106. $2=smalltalk.send($1,"_with_",[(function(){
  1107. return smalltalk.send(self,"_renderListOn_",[html]);
  1108. })]);
  1109. $3=smalltalk.send(html,"_div",[]);
  1110. smalltalk.send($3,"_class_",["pane_actions form-actions"]);
  1111. $4=smalltalk.send($3,"_with_",[(function(){
  1112. return smalltalk.send(self,"_renderButtonsOn_",[html]);
  1113. })]);
  1114. smalltalk.send(self,"_setupKeyBindings",[]);
  1115. return self},
  1116. args: ["html"],
  1117. source: "renderContentOn: html\x0a\x09html ul \x0a \x09class: 'nav nav-pills nav-stacked';\x0a with: [ self renderListOn: html ].\x0a html div class: 'pane_actions form-actions'; with: [\x0a \x09self renderButtonsOn: html ].\x0a \x0a self setupKeyBindings",
  1118. messageSends: ["class:", "ul", "with:", "renderListOn:", "div", "renderButtonsOn:", "setupKeyBindings"],
  1119. referencedClasses: []
  1120. }),
  1121. smalltalk.HLListWidget);
  1122. smalltalk.addMethod(
  1123. "_renderItem_on_",
  1124. smalltalk.method({
  1125. selector: "renderItem:on:",
  1126. category: 'rendering',
  1127. fn: function (anObject,html){
  1128. var self=this;
  1129. var $2,$3,$1;
  1130. var li;
  1131. li=smalltalk.send(html,"_li",[]);
  1132. smalltalk.send(li,"_class_",[smalltalk.send(self,"_cssClassForItem_",[anObject])]);
  1133. smalltalk.send(li,"_at_put_",["list-data",smalltalk.send(smalltalk.send(smalltalk.send(self,"_items",[]),"_indexOf_",[anObject]),"_asString",[])]);
  1134. $1=smalltalk.send(li,"_with_",[(function(){
  1135. $2=smalltalk.send(html,"_a",[]);
  1136. smalltalk.send($2,"_with_",[(function(){
  1137. smalltalk.send(smalltalk.send(html,"_tag_",["i"]),"_class_",[smalltalk.send(self,"_iconForItem_",[anObject])]);
  1138. return smalltalk.send(self,"_renderItemLabel_on_",[anObject,html]);
  1139. })]);
  1140. $3=smalltalk.send($2,"_onClick_",[(function(){
  1141. return smalltalk.send(self,"_activateListItem_",[smalltalk.send(li,"_asJQuery",[])]);
  1142. })]);
  1143. return $3;
  1144. })]);
  1145. return self},
  1146. args: ["anObject", "html"],
  1147. source: "renderItem: anObject on: html\x0a\x09| li |\x0a \x0a\x09li := html li.\x0a li\x0a \x09class: (self cssClassForItem: anObject);\x0a at: 'list-data' put: (self items indexOf: anObject) asString;\x0a with: [ \x0a \x09html a\x0a \x09with: [ \x0a \x09\x09(html tag: 'i') class: (self iconForItem: anObject).\x0a \x09\x09\x09\x09\x09self renderItemLabel: anObject on: html ];\x0a\x09\x09\x09\x09onClick: [\x0a \x09self activateListItem: li asJQuery ] ]",
  1148. messageSends: ["li", "class:", "cssClassForItem:", "at:put:", "asString", "indexOf:", "items", "with:", "iconForItem:", "tag:", "renderItemLabel:on:", "a", "onClick:", "activateListItem:", "asJQuery"],
  1149. referencedClasses: []
  1150. }),
  1151. smalltalk.HLListWidget);
  1152. smalltalk.addMethod(
  1153. "_renderItemLabel_on_",
  1154. smalltalk.method({
  1155. selector: "renderItemLabel:on:",
  1156. category: 'rendering',
  1157. fn: function (anObject,html){
  1158. var self=this;
  1159. smalltalk.send(html,"_with_",[smalltalk.send(anObject,"_asString",[])]);
  1160. return self},
  1161. args: ["anObject", "html"],
  1162. source: "renderItemLabel: anObject on: html\x0a\x09html with: anObject asString",
  1163. messageSends: ["with:", "asString"],
  1164. referencedClasses: []
  1165. }),
  1166. smalltalk.HLListWidget);
  1167. smalltalk.addMethod(
  1168. "_renderListOn_",
  1169. smalltalk.method({
  1170. selector: "renderListOn:",
  1171. category: 'rendering',
  1172. fn: function (html){
  1173. var self=this;
  1174. smalltalk.send(smalltalk.send(self,"_items",[]),"_do_",[(function(each){
  1175. return smalltalk.send(self,"_renderItem_on_",[each,html]);
  1176. })]);
  1177. return self},
  1178. args: ["html"],
  1179. source: "renderListOn: html\x0a\x09self items do: [ :each | \x0a \x09self renderItem: each on: html ]",
  1180. messageSends: ["do:", "renderItem:on:", "items"],
  1181. referencedClasses: []
  1182. }),
  1183. smalltalk.HLListWidget);
  1184. smalltalk.addMethod(
  1185. "_selectItem_",
  1186. smalltalk.method({
  1187. selector: "selectItem:",
  1188. category: 'actions',
  1189. fn: function (anObject){
  1190. var self=this;
  1191. smalltalk.send(self,"_selectedItem_",[anObject]);
  1192. return self},
  1193. args: ["anObject"],
  1194. source: "selectItem: anObject\x0a\x09self selectedItem: anObject",
  1195. messageSends: ["selectedItem:"],
  1196. referencedClasses: []
  1197. }),
  1198. smalltalk.HLListWidget);
  1199. smalltalk.addMethod(
  1200. "_selectedItem",
  1201. smalltalk.method({
  1202. selector: "selectedItem",
  1203. category: 'accessing',
  1204. fn: function (){
  1205. var self=this;
  1206. return self["@selectedItem"];
  1207. },
  1208. args: [],
  1209. source: "selectedItem\x0a\x09^ selectedItem",
  1210. messageSends: [],
  1211. referencedClasses: []
  1212. }),
  1213. smalltalk.HLListWidget);
  1214. smalltalk.addMethod(
  1215. "_selectedItem_",
  1216. smalltalk.method({
  1217. selector: "selectedItem:",
  1218. category: 'accessing',
  1219. fn: function (anObject){
  1220. var self=this;
  1221. self["@selectedItem"]=anObject;
  1222. return self},
  1223. args: ["anObject"],
  1224. source: "selectedItem: anObject\x0a\x09selectedItem := anObject",
  1225. messageSends: [],
  1226. referencedClasses: []
  1227. }),
  1228. smalltalk.HLListWidget);
  1229. smalltalk.addMethod(
  1230. "_setupKeyBindings",
  1231. smalltalk.method({
  1232. selector: "setupKeyBindings",
  1233. category: 'events',
  1234. fn: function (){
  1235. var self=this;
  1236. var $1,$2,$3;
  1237. var next;
  1238. smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_unbind_",["keydown"]);
  1239. smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_keydown_",[(function(e){
  1240. var selected;
  1241. selected=smalltalk.send(window,"_jQuery_",[".focused .nav-pills .active"]);
  1242. selected;
  1243. $1=smalltalk.send(smalltalk.send(e,"_which",[]),"__eq",[(38)]);
  1244. if(smalltalk.assert($1)){
  1245. smalltalk.send(self,"_activateListItem_",[smalltalk.send(selected,"_prev",[])]);
  1246. };
  1247. $2=smalltalk.send(smalltalk.send(e,"_which",[]),"__eq",[(40)]);
  1248. if(smalltalk.assert($2)){
  1249. next=smalltalk.send(selected,"_next",[]);
  1250. next;
  1251. $3=smalltalk.send(next,"_get_",[(0)]);
  1252. if(($receiver = $3) == nil || $receiver == undefined){
  1253. next=smalltalk.send(window,"_jQuery_",[".focused .nav-pills li:first-child"]);
  1254. next;
  1255. } else {
  1256. $3;
  1257. };
  1258. return smalltalk.send(self,"_activateListItem_",[next]);
  1259. };
  1260. })]);
  1261. return self},
  1262. args: [],
  1263. source: "setupKeyBindings\x0a\x09| next |\x0a\x09hiddenInput asJQuery unbind: 'keydown'.\x0a\x0a\x09hiddenInput asJQuery keydown: [ :e | | selected |\x0a \x09selected := window jQuery: '.focused .nav-pills .active'.\x0a e which = 38 ifTrue: [ \x0a \x09self activateListItem: selected prev ].\x0a \x09e which = 40 ifTrue: [\x0a \x09next := selected next.\x0a (next get: 0) ifNil: [ next := window jQuery: '.focused .nav-pills li:first-child' ].\x0a\x09\x09\x09self activateListItem: next ] ]",
  1264. messageSends: ["unbind:", "asJQuery", "keydown:", "jQuery:", "ifTrue:", "activateListItem:", "prev", "=", "which", "next", "ifNil:", "get:"],
  1265. referencedClasses: []
  1266. }),
  1267. smalltalk.HLListWidget);
  1268. smalltalk.addClass('HLNavigationListWidget', smalltalk.HLListWidget, ['previous', 'next'], 'Helios-Core');
  1269. smalltalk.addMethod(
  1270. "_next",
  1271. smalltalk.method({
  1272. selector: "next",
  1273. category: 'accessing',
  1274. fn: function (){
  1275. var self=this;
  1276. return self["@next"];
  1277. },
  1278. args: [],
  1279. source: "next\x0a\x09^ next",
  1280. messageSends: [],
  1281. referencedClasses: []
  1282. }),
  1283. smalltalk.HLNavigationListWidget);
  1284. smalltalk.addMethod(
  1285. "_next_",
  1286. smalltalk.method({
  1287. selector: "next:",
  1288. category: 'accessing',
  1289. fn: function (aWidget){
  1290. var self=this;
  1291. var $1;
  1292. self["@next"]=aWidget;
  1293. $1=smalltalk.send(smalltalk.send(aWidget,"_previous",[]),"__eq",[self]);
  1294. if(! smalltalk.assert($1)){
  1295. smalltalk.send(aWidget,"_previous_",[self]);
  1296. };
  1297. return self},
  1298. args: ["aWidget"],
  1299. source: "next: aWidget\x0a\x09next := aWidget.\x0a aWidget previous = self ifFalse: [ aWidget previous: self ]",
  1300. messageSends: ["ifFalse:", "previous:", "=", "previous"],
  1301. referencedClasses: []
  1302. }),
  1303. smalltalk.HLNavigationListWidget);
  1304. smalltalk.addMethod(
  1305. "_nextFocus",
  1306. smalltalk.method({
  1307. selector: "nextFocus",
  1308. category: 'actions',
  1309. fn: function (){
  1310. var self=this;
  1311. var $1;
  1312. $1=smalltalk.send(self,"_next",[]);
  1313. if(($receiver = $1) == nil || $receiver == undefined){
  1314. $1;
  1315. } else {
  1316. smalltalk.send(smalltalk.send(self,"_next",[]),"_focus",[]);
  1317. };
  1318. return self},
  1319. args: [],
  1320. source: "nextFocus\x0a\x09self next ifNotNil: [ self next focus ]",
  1321. messageSends: ["ifNotNil:", "focus", "next"],
  1322. referencedClasses: []
  1323. }),
  1324. smalltalk.HLNavigationListWidget);
  1325. smalltalk.addMethod(
  1326. "_previous",
  1327. smalltalk.method({
  1328. selector: "previous",
  1329. category: 'accessing',
  1330. fn: function (){
  1331. var self=this;
  1332. return self["@previous"];
  1333. },
  1334. args: [],
  1335. source: "previous\x0a\x09^ previous",
  1336. messageSends: [],
  1337. referencedClasses: []
  1338. }),
  1339. smalltalk.HLNavigationListWidget);
  1340. smalltalk.addMethod(
  1341. "_previous_",
  1342. smalltalk.method({
  1343. selector: "previous:",
  1344. category: 'accessing',
  1345. fn: function (aWidget){
  1346. var self=this;
  1347. var $1;
  1348. self["@previous"]=aWidget;
  1349. $1=smalltalk.send(smalltalk.send(aWidget,"_next",[]),"__eq",[self]);
  1350. if(! smalltalk.assert($1)){
  1351. smalltalk.send(aWidget,"_next_",[self]);
  1352. };
  1353. return self},
  1354. args: ["aWidget"],
  1355. source: "previous: aWidget\x0a\x09previous := aWidget.\x0a aWidget next = self ifFalse: [ aWidget next: self ]",
  1356. messageSends: ["ifFalse:", "next:", "=", "next"],
  1357. referencedClasses: []
  1358. }),
  1359. smalltalk.HLNavigationListWidget);
  1360. smalltalk.addMethod(
  1361. "_previousFocus",
  1362. smalltalk.method({
  1363. selector: "previousFocus",
  1364. category: 'actions',
  1365. fn: function (){
  1366. var self=this;
  1367. var $1;
  1368. $1=smalltalk.send(self,"_previous",[]);
  1369. if(($receiver = $1) == nil || $receiver == undefined){
  1370. $1;
  1371. } else {
  1372. smalltalk.send(smalltalk.send(self,"_previous",[]),"_focus",[]);
  1373. };
  1374. return self},
  1375. args: [],
  1376. source: "previousFocus\x0a\x09self previous ifNotNil: [ self previous focus ]",
  1377. messageSends: ["ifNotNil:", "focus", "previous"],
  1378. referencedClasses: []
  1379. }),
  1380. smalltalk.HLNavigationListWidget);
  1381. smalltalk.addMethod(
  1382. "_setupKeyBindings",
  1383. smalltalk.method({
  1384. selector: "setupKeyBindings",
  1385. category: 'events',
  1386. fn: function (){
  1387. var self=this;
  1388. var $1,$2;
  1389. smalltalk.send(self,"_setupKeyBindings",[],smalltalk.HLListWidget);
  1390. smalltalk.send(smalltalk.send(self["@hiddenInput"],"_asJQuery",[]),"_keydown_",[(function(e){
  1391. $1=smalltalk.send(smalltalk.send(e,"_which",[]),"__eq",[(39)]);
  1392. if(smalltalk.assert($1)){
  1393. smalltalk.send(self,"_nextFocus",[]);
  1394. };
  1395. $2=smalltalk.send(smalltalk.send(e,"_which",[]),"__eq",[(37)]);
  1396. if(smalltalk.assert($2)){
  1397. return smalltalk.send(self,"_previousFocus",[]);
  1398. };
  1399. })]);
  1400. return self},
  1401. args: [],
  1402. source: "setupKeyBindings\x0a\x09super setupKeyBindings.\x0a\x0a\x09hiddenInput asJQuery keydown: [ :e |\x0a e which = 39 ifTrue: [ \x0a \x09self nextFocus ].\x0a\x09\x09e which = 37 ifTrue: [ \x0a \x09self previousFocus ] ]",
  1403. messageSends: ["setupKeyBindings", "keydown:", "ifTrue:", "nextFocus", "=", "which", "previousFocus", "asJQuery"],
  1404. referencedClasses: []
  1405. }),
  1406. smalltalk.HLNavigationListWidget);
  1407. smalltalk.addClass('HLInspector', smalltalk.HLWidget, [], 'Helios-Core');
  1408. smalltalk.addClass('HLManager', smalltalk.HLWidget, ['tabs', 'activeTab', 'keyBinder'], 'Helios-Core');
  1409. smalltalk.addMethod(
  1410. "_activate_",
  1411. smalltalk.method({
  1412. selector: "activate:",
  1413. category: 'actions',
  1414. fn: function (aTab){
  1415. var self=this;
  1416. var $1;
  1417. smalltalk.send(smalltalk.send(self,"_keyBinder",[]),"_flushBindings",[]);
  1418. self["@activeTab"]=aTab;
  1419. smalltalk.send(self,"_refresh",[]);
  1420. $1=smalltalk.send(self,"_show_",[aTab]);
  1421. return self},
  1422. args: ["aTab"],
  1423. source: "activate: aTab\x0a\x09self keyBinder flushBindings.\x0a\x09activeTab := aTab.\x0a \x0a\x09self \x0a\x09\x09refresh;\x0a\x09\x09show: aTab",
  1424. messageSends: ["flushBindings", "keyBinder", "refresh", "show:"],
  1425. referencedClasses: []
  1426. }),
  1427. smalltalk.HLManager);
  1428. smalltalk.addMethod(
  1429. "_activeTab",
  1430. smalltalk.method({
  1431. selector: "activeTab",
  1432. category: 'accessing',
  1433. fn: function (){
  1434. var self=this;
  1435. return self["@activeTab"];
  1436. },
  1437. args: [],
  1438. source: "activeTab\x0a\x09^ activeTab",
  1439. messageSends: [],
  1440. referencedClasses: []
  1441. }),
  1442. smalltalk.HLManager);
  1443. smalltalk.addMethod(
  1444. "_addTab_",
  1445. smalltalk.method({
  1446. selector: "addTab:",
  1447. category: 'actions',
  1448. fn: function (aTab){
  1449. var self=this;
  1450. smalltalk.send(smalltalk.send(self,"_tabs",[]),"_add_",[aTab]);
  1451. smalltalk.send(self,"_activate_",[aTab]);
  1452. return self},
  1453. args: ["aTab"],
  1454. source: "addTab: aTab\x0a\x09self tabs add: aTab.\x0a self activate: aTab",
  1455. messageSends: ["add:", "tabs", "activate:"],
  1456. referencedClasses: []
  1457. }),
  1458. smalltalk.HLManager);
  1459. smalltalk.addMethod(
  1460. "_initialize",
  1461. smalltalk.method({
  1462. selector: "initialize",
  1463. category: 'initialization',
  1464. fn: function (){
  1465. var self=this;
  1466. smalltalk.send(self,"_initialize",[],smalltalk.HLWidget);
  1467. smalltalk.send(smalltalk.send(self,"_keyBinder",[]),"_setupEvents",[]);
  1468. return self},
  1469. args: [],
  1470. source: "initialize\x0a\x09super initialize.\x0a self keyBinder setupEvents",
  1471. messageSends: ["initialize", "setupEvents", "keyBinder"],
  1472. referencedClasses: []
  1473. }),
  1474. smalltalk.HLManager);
  1475. smalltalk.addMethod(
  1476. "_keyBinder",
  1477. smalltalk.method({
  1478. selector: "keyBinder",
  1479. category: 'accessing',
  1480. fn: function (){
  1481. var self=this;
  1482. var $1;
  1483. if(($receiver = self["@keyBinder"]) == nil || $receiver == undefined){
  1484. self["@keyBinder"]=smalltalk.send((smalltalk.HLKeyBinder || HLKeyBinder),"_new",[]);
  1485. $1=self["@keyBinder"];
  1486. } else {
  1487. $1=self["@keyBinder"];
  1488. };
  1489. return $1;
  1490. },
  1491. args: [],
  1492. source: "keyBinder\x0a\x09^ keyBinder ifNil: [ keyBinder := HLKeyBinder new ]",
  1493. messageSends: ["ifNil:", "new"],
  1494. referencedClasses: ["HLKeyBinder"]
  1495. }),
  1496. smalltalk.HLManager);
  1497. smalltalk.addMethod(
  1498. "_refresh",
  1499. smalltalk.method({
  1500. selector: "refresh",
  1501. category: 'rendering',
  1502. fn: function (){
  1503. var self=this;
  1504. smalltalk.send(smalltalk.send(window,"_jQuery_",[".navbar"]),"_remove",[]);
  1505. smalltalk.send(smalltalk.send(window,"_jQuery_",["#container"]),"_remove",[]);
  1506. smalltalk.send(self,"_appendToJQuery_",[smalltalk.send("body","_asJQuery",[])]);
  1507. return self},
  1508. args: [],
  1509. source: "refresh\x0a\x09(window jQuery: '.navbar') remove.\x0a\x09(window jQuery: '#container') remove.\x0a\x09self appendToJQuery: 'body' asJQuery",
  1510. messageSends: ["remove", "jQuery:", "appendToJQuery:", "asJQuery"],
  1511. referencedClasses: []
  1512. }),
  1513. smalltalk.HLManager);
  1514. smalltalk.addMethod(
  1515. "_removeTab_",
  1516. smalltalk.method({
  1517. selector: "removeTab:",
  1518. category: 'actions',
  1519. fn: function (aTab){
  1520. var self=this;
  1521. var $1;
  1522. $1=smalltalk.send(smalltalk.send(self,"_tabs",[]),"_includes_",[aTab]);
  1523. if(! smalltalk.assert($1)){
  1524. return self;
  1525. };
  1526. smalltalk.send(smalltalk.send(self,"_tabs",[]),"_remove_",[aTab]);
  1527. smalltalk.send(self,"_refresh",[]);
  1528. return self},
  1529. args: ["aTab"],
  1530. source: "removeTab: aTab\x0a\x09\x22Todo: activate the previously activated tab. Keep a history of tabs selection\x22\x0a\x0a\x09(self tabs includes: aTab) ifFalse: [ ^ self ].\x0a\x0a\x09self tabs remove: aTab.\x0a\x09self refresh",
  1531. messageSends: ["ifFalse:", "includes:", "tabs", "remove:", "refresh"],
  1532. referencedClasses: []
  1533. }),
  1534. smalltalk.HLManager);
  1535. smalltalk.addMethod(
  1536. "_renderAddOn_",
  1537. smalltalk.method({
  1538. selector: "renderAddOn:",
  1539. category: 'rendering',
  1540. fn: function (html){
  1541. var self=this;
  1542. var $1,$3,$4,$5,$7,$8,$6,$2;
  1543. $1=smalltalk.send(html,"_li",[]);
  1544. smalltalk.send($1,"_class_",["dropdown"]);
  1545. $2=smalltalk.send($1,"_with_",[(function(){
  1546. $3=smalltalk.send(html,"_a",[]);
  1547. smalltalk.send($3,"_class_",["dropdown-toggle"]);
  1548. smalltalk.send($3,"_at_put_",["data-toggle","dropdown"]);
  1549. $4=smalltalk.send($3,"_with_",[(function(){
  1550. smalltalk.send(html,"_with_",["Open..."]);
  1551. return smalltalk.send(smalltalk.send(html,"_tag_",["b"]),"_class_",["caret"]);
  1552. })]);
  1553. $4;
  1554. $5=smalltalk.send(html,"_ul",[]);
  1555. smalltalk.send($5,"_class_",["dropdown-menu"]);
  1556. $6=smalltalk.send($5,"_with_",[(function(){
  1557. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send((smalltalk.HLWidget || HLWidget),"_withAllSubclasses",[]),"_select_",[(function(each){
  1558. return smalltalk.send(each,"_canBeOpenAsTab",[]);
  1559. })]),"_sorted_",[(function(a,b){
  1560. return smalltalk.send(smalltalk.send(a,"_tabPriority",[]),"__lt",[smalltalk.send(b,"_tabPriority",[])]);
  1561. })]),"_do_",[(function(each){
  1562. return smalltalk.send(smalltalk.send(html,"_li",[]),"_with_",[(function(){
  1563. $7=smalltalk.send(html,"_a",[]);
  1564. smalltalk.send($7,"_with_",[smalltalk.send(each,"_tabLabel",[])]);
  1565. $8=smalltalk.send($7,"_onClick_",[(function(){
  1566. return smalltalk.send(each,"_openAsTab",[]);
  1567. })]);
  1568. return $8;
  1569. })]);
  1570. })]);
  1571. })]);
  1572. return $6;
  1573. })]);
  1574. return self},
  1575. args: ["html"],
  1576. source: "renderAddOn: html\x0a html li \x0a \x09class: 'dropdown';\x0a with: [ \x0a\x09\x09\x09html a \x0a \x09\x09class: 'dropdown-toggle';\x0a \x09 \x09at: 'data-toggle' put: 'dropdown';\x0a \x09with: [ \x0a \x09\x09html with: 'Open...'.\x0a \x09\x09\x09\x09\x09(html tag: 'b') class: 'caret' ].\x0a html ul \x0a \x09\x09class: 'dropdown-menu';\x0a with: [\x0a \x09((HLWidget withAllSubclasses\x0a \x09select: [ :each | each canBeOpenAsTab ])\x0a sorted: [ :a :b | a tabPriority < b tabPriority ])\x0a do: [ :each |\x0a \x09\x09\x09\x09\x09\x09\x09html li with: [\x0a \x09\x09\x09html a \x0a \x09with: each tabLabel;\x0a \x09\x09\x09\x09\x09\x09\x09\x09onClick: [ each openAsTab ] ] ] ] ]",
  1577. messageSends: ["class:", "li", "with:", "a", "at:put:", "tag:", "ul", "do:", "tabLabel", "onClick:", "openAsTab", "sorted:", "<", "tabPriority", "select:", "canBeOpenAsTab", "withAllSubclasses"],
  1578. referencedClasses: ["HLWidget"]
  1579. }),
  1580. smalltalk.HLManager);
  1581. smalltalk.addMethod(
  1582. "_renderContentOn_",
  1583. smalltalk.method({
  1584. selector: "renderContentOn:",
  1585. category: 'rendering',
  1586. fn: function (html){
  1587. var self=this;
  1588. var $1,$3,$4,$2;
  1589. $1=smalltalk.send(html,"_div",[]);
  1590. smalltalk.send($1,"_class_",["navbar navbar-fixed-top"]);
  1591. $2=smalltalk.send($1,"_with_",[(function(){
  1592. $3=smalltalk.send(html,"_div",[]);
  1593. smalltalk.send($3,"_class_",["navbar-inner"]);
  1594. $4=smalltalk.send($3,"_with_",[(function(){
  1595. return smalltalk.send(self,"_renderTabsOn_",[html]);
  1596. })]);
  1597. return $4;
  1598. })]);
  1599. smalltalk.send(smalltalk.send(html,"_div",[]),"_id_",["container"]);
  1600. return self},
  1601. args: ["html"],
  1602. source: "renderContentOn: html\x0a\x09html div \x0a\x09\x09class: 'navbar navbar-fixed-top';\x0a\x09\x09with: [ html div \x0a\x09\x09\x09class: 'navbar-inner';\x0a\x09\x09\x09with: [ self renderTabsOn: html ] ].\x0a\x09html div id: 'container'",
  1603. messageSends: ["class:", "div", "with:", "renderTabsOn:", "id:"],
  1604. referencedClasses: []
  1605. }),
  1606. smalltalk.HLManager);
  1607. smalltalk.addMethod(
  1608. "_renderTabsOn_",
  1609. smalltalk.method({
  1610. selector: "renderTabsOn:",
  1611. category: 'rendering',
  1612. fn: function (html){
  1613. var self=this;
  1614. var $1,$3,$5,$4,$7,$8,$6,$2;
  1615. $1=smalltalk.send(html,"_ul",[]);
  1616. smalltalk.send($1,"_class_",["nav"]);
  1617. $2=smalltalk.send($1,"_with_",[(function(){
  1618. smalltalk.send(smalltalk.send(self,"_tabs",[]),"_do_",[(function(each){
  1619. $3=smalltalk.send(html,"_li",[]);
  1620. $5=smalltalk.send(each,"_isActive",[]);
  1621. if(smalltalk.assert($5)){
  1622. $4="active";
  1623. } else {
  1624. $4="inactive";
  1625. };
  1626. smalltalk.send($3,"_class_",[$4]);
  1627. $6=smalltalk.send($3,"_with_",[(function(){
  1628. $7=smalltalk.send(html,"_a",[]);
  1629. smalltalk.send($7,"_with_",[(function(){
  1630. smalltalk.send(smalltalk.send(smalltalk.send(html,"_tag_",["i"]),"_class_",["icon-remove-circle"]),"_onClick_",[(function(){
  1631. return smalltalk.send(self,"_removeTab_",[each]);
  1632. })]);
  1633. return smalltalk.send(html,"_with_",[smalltalk.send(each,"_label",[])]);
  1634. })]);
  1635. $8=smalltalk.send($7,"_onClick_",[(function(){
  1636. return smalltalk.send(each,"_activate",[]);
  1637. })]);
  1638. return $8;
  1639. })]);
  1640. return $6;
  1641. })]);
  1642. return smalltalk.send(self,"_renderAddOn_",[html]);
  1643. })]);
  1644. return self},
  1645. args: ["html"],
  1646. source: "renderTabsOn: html\x0a\x09html ul \x0a\x09\x09class: 'nav';\x0a\x09\x09with: [ \x0a \x09self tabs do: [ :each |\x0a\x09\x09\x09\x09html li \x0a\x09\x09\x09\x09\x09class: (each isActive ifTrue: [ 'active' ] ifFalse: [ 'inactive' ]);\x0a\x09\x09\x09\x09\x09with: [\x0a\x09\x09\x09\x09\x09\x09html a\x0a\x09\x09\x09\x09\x09\x09\x09with: [\x0a \x09\x09\x09\x09\x09\x09\x09((html tag: 'i') class: 'icon-remove-circle')\x0a \x09\x09\x09\x09\x09\x09\x09\x09\x09onClick: [ self removeTab: each ].\x0a \x09html with: each label ];\x0a\x09\x09\x09\x09\x09\x09\x09onClick: [ each activate ] ] ].\x0a\x09\x09\x09self renderAddOn: html ]",
  1647. messageSends: ["class:", "ul", "with:", "do:", "ifTrue:ifFalse:", "isActive", "li", "onClick:", "removeTab:", "tag:", "label", "a", "activate", "tabs", "renderAddOn:"],
  1648. referencedClasses: []
  1649. }),
  1650. smalltalk.HLManager);
  1651. smalltalk.addMethod(
  1652. "_show_",
  1653. smalltalk.method({
  1654. selector: "show:",
  1655. category: 'rendering',
  1656. fn: function (aTab){
  1657. var self=this;
  1658. smalltalk.send(smalltalk.send(window,"_jQuery_",["#container"]),"_empty",[]);
  1659. smalltalk.send(smalltalk.send(aTab,"_widget",[]),"_appendToJQuery_",[smalltalk.send("#container","_asJQuery",[])]);
  1660. return self},
  1661. args: ["aTab"],
  1662. source: "show: aTab\x0a\x09(window jQuery: '#container') empty.\x0a\x09aTab widget appendToJQuery: '#container' asJQuery",
  1663. messageSends: ["empty", "jQuery:", "appendToJQuery:", "asJQuery", "widget"],
  1664. referencedClasses: []
  1665. }),
  1666. smalltalk.HLManager);
  1667. smalltalk.addMethod(
  1668. "_tabs",
  1669. smalltalk.method({
  1670. selector: "tabs",
  1671. category: 'accessing',
  1672. fn: function (){
  1673. var self=this;
  1674. var $1;
  1675. if(($receiver = self["@tabs"]) == nil || $receiver == undefined){
  1676. self["@tabs"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  1677. $1=self["@tabs"];
  1678. } else {
  1679. $1=self["@tabs"];
  1680. };
  1681. return $1;
  1682. },
  1683. args: [],
  1684. source: "tabs\x0a\x09^ tabs ifNil: [ tabs := OrderedCollection new ]",
  1685. messageSends: ["ifNil:", "new"],
  1686. referencedClasses: ["OrderedCollection"]
  1687. }),
  1688. smalltalk.HLManager);
  1689. smalltalk.HLManager.klass.iVarNames = ['current'];
  1690. smalltalk.addMethod(
  1691. "_current",
  1692. smalltalk.method({
  1693. selector: "current",
  1694. category: 'accessing',
  1695. fn: function (){
  1696. var self=this;
  1697. var $1;
  1698. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  1699. self["@current"]=smalltalk.send(smalltalk.send(self,"_basicNew",[]),"_initialize",[]);
  1700. $1=self["@current"];
  1701. } else {
  1702. $1=self["@current"];
  1703. };
  1704. return $1;
  1705. },
  1706. args: [],
  1707. source: "current\x0a\x09^ current ifNil: [ current := self basicNew initialize ]",
  1708. messageSends: ["ifNil:", "initialize", "basicNew"],
  1709. referencedClasses: []
  1710. }),
  1711. smalltalk.HLManager.klass);
  1712. smalltalk.addMethod(
  1713. "_initialize",
  1714. smalltalk.method({
  1715. selector: "initialize",
  1716. category: 'initialization',
  1717. fn: function (){
  1718. var self=this;
  1719. smalltalk.send(smalltalk.send(self,"_current",[]),"_appendToJQuery_",[smalltalk.send("body","_asJQuery",[])]);
  1720. return self},
  1721. args: [],
  1722. source: "initialize\x0a\x09self current appendToJQuery: 'body' asJQuery",
  1723. messageSends: ["appendToJQuery:", "asJQuery", "current"],
  1724. referencedClasses: []
  1725. }),
  1726. smalltalk.HLManager.klass);
  1727. smalltalk.addMethod(
  1728. "_new",
  1729. smalltalk.method({
  1730. selector: "new",
  1731. category: 'instance creation',
  1732. fn: function (){
  1733. var self=this;
  1734. smalltalk.send(self,"_shouldNotImplement",[]);
  1735. return self},
  1736. args: [],
  1737. source: "new\x0a\x09\x22Use current instead\x22\x0a\x0a\x09self shouldNotImplement",
  1738. messageSends: ["shouldNotImplement"],
  1739. referencedClasses: []
  1740. }),
  1741. smalltalk.HLManager.klass);
  1742. smalltalk.addClass('HLSUnit', smalltalk.HLWidget, [], 'Helios-Core');
  1743. smalltalk.addMethod(
  1744. "_canBeOpenAsTab",
  1745. smalltalk.method({
  1746. selector: "canBeOpenAsTab",
  1747. category: 'testing',
  1748. fn: function (){
  1749. var self=this;
  1750. return true;
  1751. },
  1752. args: [],
  1753. source: "canBeOpenAsTab\x0a\x09^ true",
  1754. messageSends: [],
  1755. referencedClasses: []
  1756. }),
  1757. smalltalk.HLSUnit.klass);
  1758. smalltalk.addMethod(
  1759. "_tabLabel",
  1760. smalltalk.method({
  1761. selector: "tabLabel",
  1762. category: 'accessing',
  1763. fn: function (){
  1764. var self=this;
  1765. return "SUnit";
  1766. },
  1767. args: [],
  1768. source: "tabLabel\x0a\x09^ 'SUnit'",
  1769. messageSends: [],
  1770. referencedClasses: []
  1771. }),
  1772. smalltalk.HLSUnit.klass);
  1773. smalltalk.addMethod(
  1774. "_tabPriority",
  1775. smalltalk.method({
  1776. selector: "tabPriority",
  1777. category: 'accessing',
  1778. fn: function (){
  1779. var self=this;
  1780. return (1000);
  1781. },
  1782. args: [],
  1783. source: "tabPriority\x0a\x09^ 1000",
  1784. messageSends: [],
  1785. referencedClasses: []
  1786. }),
  1787. smalltalk.HLSUnit.klass);
  1788. smalltalk.addClass('HLTranscript', smalltalk.HLWidget, [], 'Helios-Core');
  1789. smalltalk.addMethod(
  1790. "_canBeOpenAsTab",
  1791. smalltalk.method({
  1792. selector: "canBeOpenAsTab",
  1793. category: 'testing',
  1794. fn: function (){
  1795. var self=this;
  1796. return true;
  1797. },
  1798. args: [],
  1799. source: "canBeOpenAsTab\x0a\x09^ true",
  1800. messageSends: [],
  1801. referencedClasses: []
  1802. }),
  1803. smalltalk.HLTranscript.klass);
  1804. smalltalk.addMethod(
  1805. "_tabLabel",
  1806. smalltalk.method({
  1807. selector: "tabLabel",
  1808. category: 'accessing',
  1809. fn: function (){
  1810. var self=this;
  1811. return "Transcript";
  1812. },
  1813. args: [],
  1814. source: "tabLabel\x0a\x09^ 'Transcript'",
  1815. messageSends: [],
  1816. referencedClasses: []
  1817. }),
  1818. smalltalk.HLTranscript.klass);
  1819. smalltalk.addMethod(
  1820. "_tabPriority",
  1821. smalltalk.method({
  1822. selector: "tabPriority",
  1823. category: 'accessing',
  1824. fn: function (){
  1825. var self=this;
  1826. return (600);
  1827. },
  1828. args: [],
  1829. source: "tabPriority\x0a\x09^ 600",
  1830. messageSends: [],
  1831. referencedClasses: []
  1832. }),
  1833. smalltalk.HLTranscript.klass);
  1834. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, [], 'Helios-Core');
  1835. smalltalk.addMethod(
  1836. "_canBeOpenAsTab",
  1837. smalltalk.method({
  1838. selector: "canBeOpenAsTab",
  1839. category: 'testing',
  1840. fn: function (){
  1841. var self=this;
  1842. return true;
  1843. },
  1844. args: [],
  1845. source: "canBeOpenAsTab\x0a\x09^ true",
  1846. messageSends: [],
  1847. referencedClasses: []
  1848. }),
  1849. smalltalk.HLWorkspace.klass);
  1850. smalltalk.addMethod(
  1851. "_tabLabel",
  1852. smalltalk.method({
  1853. selector: "tabLabel",
  1854. category: 'accessing',
  1855. fn: function (){
  1856. var self=this;
  1857. return "Workspace";
  1858. },
  1859. args: [],
  1860. source: "tabLabel\x0a\x09^ 'Workspace'",
  1861. messageSends: [],
  1862. referencedClasses: []
  1863. }),
  1864. smalltalk.HLWorkspace.klass);
  1865. smalltalk.addMethod(
  1866. "_tabPriority",
  1867. smalltalk.method({
  1868. selector: "tabPriority",
  1869. category: 'accessing',
  1870. fn: function (){
  1871. var self=this;
  1872. return (10);
  1873. },
  1874. args: [],
  1875. source: "tabPriority\x0a\x09^ 10",
  1876. messageSends: [],
  1877. referencedClasses: []
  1878. }),
  1879. smalltalk.HLWorkspace.klass);