Helios-Workspace.js 89 KB

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