Helios-Workspace.js 89 KB

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