Helios-Workspace.js 89 KB

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