Helios-Workspace.js 89 KB

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