Helios-Workspace.js 89 KB

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