Helios-Workspace.deploy.js 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001
  1. smalltalk.addPackage('Helios-Workspace');
  2. smalltalk.addClass('HLCodeModel', smalltalk.Object, ['announcer', 'environment', 'receiver'], 'Helios-Workspace');
  3. smalltalk.addMethod(
  4. "_announcer",
  5. smalltalk.method({
  6. selector: "announcer",
  7. fn: function (){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx1) { var $2,$1;
  10. $2=self["@announcer"];
  11. if(($receiver = $2) == nil || $receiver == undefined){
  12. self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
  13. $1=self["@announcer"];
  14. } else {
  15. $1=$2;
  16. };
  17. return $1;
  18. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLCodeModel)})},
  19. messageSends: ["ifNil:", "new"]}),
  20. smalltalk.HLCodeModel);
  21. smalltalk.addMethod(
  22. "_defaultReceiver",
  23. smalltalk.method({
  24. selector: "defaultReceiver",
  25. fn: function (){
  26. var self=this;
  27. return smalltalk.withContext(function($ctx1) { var $1;
  28. $1=_st((smalltalk.DoIt || DoIt))._new();
  29. return $1;
  30. }, function($ctx1) {$ctx1.fill(self,"defaultReceiver",{}, smalltalk.HLCodeModel)})},
  31. messageSends: ["new"]}),
  32. smalltalk.HLCodeModel);
  33. smalltalk.addMethod(
  34. "_doIt_",
  35. smalltalk.method({
  36. selector: "doIt:",
  37. fn: function (someCode){
  38. var self=this;
  39. return smalltalk.withContext(function($ctx1) { var $1;
  40. $1=_st(_st(self)._environment())._eval_on_(someCode,_st(self)._receiver());
  41. return $1;
  42. }, function($ctx1) {$ctx1.fill(self,"doIt:",{someCode:someCode}, smalltalk.HLCodeModel)})},
  43. messageSends: ["eval:on:", "receiver", "environment"]}),
  44. smalltalk.HLCodeModel);
  45. smalltalk.addMethod(
  46. "_environment",
  47. smalltalk.method({
  48. selector: "environment",
  49. fn: function (){
  50. var self=this;
  51. return smalltalk.withContext(function($ctx1) { var $2,$1;
  52. $2=self["@environment"];
  53. if(($receiver = $2) == nil || $receiver == undefined){
  54. $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
  55. } else {
  56. $1=$2;
  57. };
  58. return $1;
  59. }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLCodeModel)})},
  60. messageSends: ["ifNil:", "environment", "current"]}),
  61. smalltalk.HLCodeModel);
  62. smalltalk.addMethod(
  63. "_environment_",
  64. smalltalk.method({
  65. selector: "environment:",
  66. fn: function (anEnvironment){
  67. var self=this;
  68. return smalltalk.withContext(function($ctx1) { self["@environment"]=anEnvironment;
  69. return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLCodeModel)})},
  70. messageSends: []}),
  71. smalltalk.HLCodeModel);
  72. smalltalk.addMethod(
  73. "_receiver",
  74. smalltalk.method({
  75. selector: "receiver",
  76. fn: function (){
  77. var self=this;
  78. return smalltalk.withContext(function($ctx1) { var $2,$1;
  79. $2=self["@receiver"];
  80. if(($receiver = $2) == nil || $receiver == undefined){
  81. self["@receiver"]=_st(self)._defaultReceiver();
  82. $1=self["@receiver"];
  83. } else {
  84. $1=$2;
  85. };
  86. return $1;
  87. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeModel)})},
  88. messageSends: ["ifNil:", "defaultReceiver"]}),
  89. smalltalk.HLCodeModel);
  90. smalltalk.addMethod(
  91. "_receiver_",
  92. smalltalk.method({
  93. selector: "receiver:",
  94. fn: function (anObject){
  95. var self=this;
  96. return smalltalk.withContext(function($ctx1) { self["@receiver"]=anObject;
  97. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeModel)})},
  98. messageSends: []}),
  99. smalltalk.HLCodeModel);
  100. smalltalk.addMethod(
  101. "_subscribe_",
  102. smalltalk.method({
  103. selector: "subscribe:",
  104. fn: function (aWidget){
  105. var self=this;
  106. return smalltalk.withContext(function($ctx1) { _st(aWidget)._subscribeTo_(_st(self)._announcer());
  107. return self}, function($ctx1) {$ctx1.fill(self,"subscribe:",{aWidget:aWidget}, smalltalk.HLCodeModel)})},
  108. messageSends: ["subscribeTo:", "announcer"]}),
  109. smalltalk.HLCodeModel);
  110. smalltalk.addMethod(
  111. "_on_",
  112. smalltalk.method({
  113. selector: "on:",
  114. fn: function (anEnvironment){
  115. var self=this;
  116. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  117. $2=_st(self)._new();
  118. _st($2)._environment_(anEnvironment);
  119. $3=_st($2)._yourself();
  120. $1=$3;
  121. return $1;
  122. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLCodeModel.klass)})},
  123. messageSends: ["environment:", "new", "yourself"]}),
  124. smalltalk.HLCodeModel.klass);
  125. smalltalk.addClass('HLCodeWidget', smalltalk.HLWidget, ['model', 'wrapper', 'code', 'editor'], 'Helios-Workspace');
  126. smalltalk.addMethod(
  127. "_announcer",
  128. smalltalk.method({
  129. selector: "announcer",
  130. fn: function (){
  131. var self=this;
  132. return smalltalk.withContext(function($ctx1) { var $1;
  133. $1=_st(_st(self)._model())._announcer();
  134. return $1;
  135. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLCodeWidget)})},
  136. messageSends: ["announcer", "model"]}),
  137. smalltalk.HLCodeWidget);
  138. smalltalk.addMethod(
  139. "_canHaveFocus",
  140. smalltalk.method({
  141. selector: "canHaveFocus",
  142. fn: function (){
  143. var self=this;
  144. return smalltalk.withContext(function($ctx1) { return true;
  145. }, function($ctx1) {$ctx1.fill(self,"canHaveFocus",{},smalltalk.HLCodeWidget)})},
  146. messageSends: []}),
  147. smalltalk.HLCodeWidget);
  148. smalltalk.addMethod(
  149. "_clear",
  150. smalltalk.method({
  151. selector: "clear",
  152. fn: function (){
  153. var self=this;
  154. return smalltalk.withContext(function($ctx1) { _st(self)._contents_("");
  155. return self}, function($ctx1) {$ctx1.fill(self,"clear",{}, smalltalk.HLCodeWidget)})},
  156. messageSends: ["contents:"]}),
  157. smalltalk.HLCodeWidget);
  158. smalltalk.addMethod(
  159. "_configureEditor",
  160. smalltalk.method({
  161. selector: "configureEditor",
  162. fn: function (){
  163. var self=this;
  164. return smalltalk.withContext(function($ctx1) { _st(_st(self)._editor())._at_put_("amberCodeWidget",self);
  165. return self}, function($ctx1) {$ctx1.fill(self,"configureEditor",{}, smalltalk.HLCodeWidget)})},
  166. messageSends: ["at:put:", "editor"]}),
  167. smalltalk.HLCodeWidget);
  168. smalltalk.addMethod(
  169. "_contents",
  170. smalltalk.method({
  171. selector: "contents",
  172. fn: function (){
  173. var self=this;
  174. return smalltalk.withContext(function($ctx1) { var $1;
  175. $1=_st(self["@editor"])._getValue();
  176. return $1;
  177. }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.HLCodeWidget)})},
  178. messageSends: ["getValue"]}),
  179. smalltalk.HLCodeWidget);
  180. smalltalk.addMethod(
  181. "_contents_",
  182. smalltalk.method({
  183. selector: "contents:",
  184. fn: function (aString){
  185. var self=this;
  186. return smalltalk.withContext(function($ctx1) { _st(self["@editor"])._setValue_(aString);
  187. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString}, smalltalk.HLCodeWidget)})},
  188. messageSends: ["setValue:"]}),
  189. smalltalk.HLCodeWidget);
  190. smalltalk.addMethod(
  191. "_currentLine",
  192. smalltalk.method({
  193. selector: "currentLine",
  194. fn: function (){
  195. var self=this;
  196. return smalltalk.withContext(function($ctx1) { var $1;
  197. $1=_st(self["@editor"])._getLine_(_st(_st(self["@editor"])._getCursor())._line());
  198. return $1;
  199. }, function($ctx1) {$ctx1.fill(self,"currentLine",{}, smalltalk.HLCodeWidget)})},
  200. messageSends: ["getLine:", "line", "getCursor"]}),
  201. smalltalk.HLCodeWidget);
  202. smalltalk.addMethod(
  203. "_currentLineOrSelection",
  204. smalltalk.method({
  205. selector: "currentLineOrSelection",
  206. fn: function (){
  207. var self=this;
  208. return smalltalk.withContext(function($ctx1) { var $2,$1;
  209. $2=_st(self["@editor"])._somethingSelected();
  210. if(smalltalk.assert($2)){
  211. $1=_st(self)._selection();
  212. } else {
  213. $1=_st(self)._currentLine();
  214. };
  215. return $1;
  216. }, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{}, smalltalk.HLCodeWidget)})},
  217. messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"]}),
  218. smalltalk.HLCodeWidget);
  219. smalltalk.addMethod(
  220. "_doIt",
  221. smalltalk.method({
  222. selector: "doIt",
  223. fn: function (){
  224. var self=this;
  225. var result;
  226. return smalltalk.withContext(function($ctx1) { var $1;
  227. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItRequested || HLDoItRequested))._on_(self["@model"]));
  228. result=_st(self["@model"])._doIt_(_st(self)._currentLineOrSelection());
  229. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItExecuted || HLDoItExecuted))._on_(self["@model"]));
  230. $1=result;
  231. return $1;
  232. }, function($ctx1) {$ctx1.fill(self,"doIt",{result:result}, smalltalk.HLCodeWidget)})},
  233. messageSends: ["announce:", "on:", "announcer", "doIt:", "currentLineOrSelection"]}),
  234. smalltalk.HLCodeWidget);
  235. smalltalk.addMethod(
  236. "_editor",
  237. smalltalk.method({
  238. selector: "editor",
  239. fn: function (){
  240. var self=this;
  241. return smalltalk.withContext(function($ctx1) { var $1;
  242. $1=self["@editor"];
  243. return $1;
  244. }, function($ctx1) {$ctx1.fill(self,"editor",{}, smalltalk.HLCodeWidget)})},
  245. messageSends: []}),
  246. smalltalk.HLCodeWidget);
  247. smalltalk.addMethod(
  248. "_focus",
  249. smalltalk.method({
  250. selector: "focus",
  251. fn: function (){
  252. var self=this;
  253. return smalltalk.withContext(function($ctx1) { _st(self["@editor"])._focus();
  254. return self}, function($ctx1) {$ctx1.fill(self,"focus",{}, smalltalk.HLCodeWidget)})},
  255. messageSends: ["focus"]}),
  256. smalltalk.HLCodeWidget);
  257. smalltalk.addMethod(
  258. "_hasFocus",
  259. smalltalk.method({
  260. selector: "hasFocus",
  261. fn: function (){
  262. var self=this;
  263. return smalltalk.withContext(function($ctx1) { var $1;
  264. $1=_st(_st(self["@code"])._asJQuery())._is_(":active");
  265. return $1;
  266. }, function($ctx1) {$ctx1.fill(self,"hasFocus",{}, smalltalk.HLCodeWidget)})},
  267. messageSends: ["is:", "asJQuery"]}),
  268. smalltalk.HLCodeWidget);
  269. smalltalk.addMethod(
  270. "_inspectIt",
  271. smalltalk.method({
  272. selector: "inspectIt",
  273. fn: function (){
  274. var self=this;
  275. var newInspector;
  276. return smalltalk.withContext(function($ctx1) { _st(_st(self)._announcer())._announce_(_st((smalltalk.HLInspectItRequested || HLInspectItRequested))._on_(self["@model"]));
  277. newInspector=_st(self)._makeInspectorOn_(_st(self)._doIt());
  278. _st(newInspector)._open();
  279. return self}, function($ctx1) {$ctx1.fill(self,"inspectIt",{newInspector:newInspector}, smalltalk.HLCodeWidget)})},
  280. messageSends: ["announce:", "on:", "announcer", "makeInspectorOn:", "doIt", "open"]}),
  281. smalltalk.HLCodeWidget);
  282. smalltalk.addMethod(
  283. "_makeInspectorOn_",
  284. smalltalk.method({
  285. selector: "makeInspectorOn:",
  286. fn: function (anObject){
  287. var self=this;
  288. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  289. $2=_st((smalltalk.HLInspector || HLInspector))._new();
  290. _st($2)._inspect_(anObject);
  291. $3=_st($2)._yourself();
  292. $1=$3;
  293. return $1;
  294. }, function($ctx1) {$ctx1.fill(self,"makeInspectorOn:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  295. messageSends: ["inspect:", "new", "yourself"]}),
  296. smalltalk.HLCodeWidget);
  297. smalltalk.addMethod(
  298. "_messageHintFor_token_",
  299. smalltalk.method({
  300. selector: "messageHintFor:token:",
  301. fn: function (anEditor,aToken){
  302. var self=this;
  303. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  304. return smalltalk.withContext(function($ctx1) {
  305. var $1;
  306. $1=_st(_st(_st(_st(_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value())._asSet())._asArray())._select_((function(each){
  307. return smalltalk.withContext(function($ctx2) {
  308. return _st(each)._includesSubString_(_st(aToken)._string());
  309. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._reject_((function(each){
  310. return smalltalk.withContext(function($ctx2) {
  311. return _st(each).__eq(_st(aToken)._string());
  312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  313. return $1;
  314. }, function($ctx1) {$ctx1.fill(self,"messageHintFor:token:",{anEditor:anEditor,aToken:aToken},smalltalk.HLCodeWidget)})},
  315. messageSends: ["reject:", "=", "string", "select:", "includesSubString:", "asArray", "asSet", "value", "at:", "current"]}),
  316. smalltalk.HLCodeWidget);
  317. smalltalk.addMethod(
  318. "_model",
  319. smalltalk.method({
  320. selector: "model",
  321. fn: function (){
  322. var self=this;
  323. return smalltalk.withContext(function($ctx1) { var $2,$1;
  324. $2=self["@model"];
  325. if(($receiver = $2) == nil || $receiver == undefined){
  326. self["@model"]=_st((smalltalk.HLCodeModel || HLCodeModel))._new();
  327. $1=self["@model"];
  328. } else {
  329. $1=$2;
  330. };
  331. return $1;
  332. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLCodeWidget)})},
  333. messageSends: ["ifNil:", "new"]}),
  334. smalltalk.HLCodeWidget);
  335. smalltalk.addMethod(
  336. "_model_",
  337. smalltalk.method({
  338. selector: "model:",
  339. fn: function (aModel){
  340. var self=this;
  341. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  342. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLCodeWidget)})},
  343. messageSends: []}),
  344. smalltalk.HLCodeWidget);
  345. smalltalk.addMethod(
  346. "_onDoIt",
  347. smalltalk.method({
  348. selector: "onDoIt",
  349. fn: function (){
  350. var self=this;
  351. return smalltalk.withContext(function($ctx1) { _st(self)._doIt();
  352. return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLCodeWidget)})},
  353. messageSends: ["doIt"]}),
  354. smalltalk.HLCodeWidget);
  355. smalltalk.addMethod(
  356. "_onInspectIt",
  357. smalltalk.method({
  358. selector: "onInspectIt",
  359. fn: function (){
  360. var self=this;
  361. return smalltalk.withContext(function($ctx1) { _st(self)._inspectIt();
  362. return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLCodeWidget)})},
  363. messageSends: ["inspectIt"]}),
  364. smalltalk.HLCodeWidget);
  365. smalltalk.addMethod(
  366. "_onPrintIt",
  367. smalltalk.method({
  368. selector: "onPrintIt",
  369. fn: function (){
  370. var self=this;
  371. return smalltalk.withContext(function($ctx1) { _st(self)._printIt();
  372. return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLCodeWidget)})},
  373. messageSends: ["printIt"]}),
  374. smalltalk.HLCodeWidget);
  375. smalltalk.addMethod(
  376. "_onSaveIt",
  377. smalltalk.method({
  378. selector: "onSaveIt",
  379. fn: function (){
  380. var self=this;
  381. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLCodeWidget)})},
  382. messageSends: []}),
  383. smalltalk.HLCodeWidget);
  384. smalltalk.addMethod(
  385. "_print_",
  386. smalltalk.method({
  387. selector: "print:",
  388. fn: function (aString){
  389. var self=this;
  390. var start,stop,currentLine;
  391. return smalltalk.withContext(function($ctx1) { currentLine=_st(_st(self["@editor"])._getCursor_(false))._line();
  392. start=_st((smalltalk.HashedCollection || HashedCollection))._new();
  393. _st(start)._at_put_("line",currentLine);
  394. _st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
  395. _st(_st(self["@editor"])._getSelection())._ifEmpty_((function(){
  396. return smalltalk.withContext(function($ctx2) { _st(start)._at_put_("ch",_st(_st(self["@editor"])._getLine_(currentLine))._size());
  397. return _st(self["@editor"])._setSelection_end_(smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(currentLine),_st("ch").__minus_gt((0))]),start);
  398. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  399. stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
  400. _st(stop)._at_put_("line",currentLine);
  401. _st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
  402. _st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
  403. _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
  404. _st(self["@editor"])._setSelection_end_(stop,start);
  405. return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine}, smalltalk.HLCodeWidget)})},
  406. messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "size", "getLine:", "setSelection:end:", "->", "getSelection", "+", "at:", "replaceSelection:", ",", "setCursor:"]}),
  407. smalltalk.HLCodeWidget);
  408. smalltalk.addMethod(
  409. "_printIt",
  410. smalltalk.method({
  411. selector: "printIt",
  412. fn: function (){
  413. var self=this;
  414. var result;
  415. return smalltalk.withContext(function($ctx1) { result=_st(self)._doIt();
  416. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLPrintItRequested || HLPrintItRequested))._on_(self["@model"]));
  417. _st(self)._print_(_st(result)._printString());
  418. _st(self)._focus();
  419. return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result}, smalltalk.HLCodeWidget)})},
  420. messageSends: ["doIt", "announce:", "on:", "announcer", "print:", "printString", "focus"]}),
  421. smalltalk.HLCodeWidget);
  422. smalltalk.addMethod(
  423. "_receiver",
  424. smalltalk.method({
  425. selector: "receiver",
  426. fn: function (){
  427. var self=this;
  428. return smalltalk.withContext(function($ctx1) { var $1;
  429. $1=_st(_st(self)._model())._receiver();
  430. return $1;
  431. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeWidget)})},
  432. messageSends: ["receiver", "model"]}),
  433. smalltalk.HLCodeWidget);
  434. smalltalk.addMethod(
  435. "_receiver_",
  436. smalltalk.method({
  437. selector: "receiver:",
  438. fn: function (anObject){
  439. var self=this;
  440. return smalltalk.withContext(function($ctx1) { _st(_st(self)._model())._receiver_(anObject);
  441. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  442. messageSends: ["receiver:", "model"]}),
  443. smalltalk.HLCodeWidget);
  444. smalltalk.addMethod(
  445. "_renderContentOn_",
  446. smalltalk.method({
  447. selector: "renderContentOn:",
  448. fn: function (html){
  449. var self=this;
  450. return smalltalk.withContext(function($ctx1) { self["@code"]=_st(html)._textarea();
  451. _st(self)._setEditorOn_(_st(self["@code"])._element());
  452. _st(self)._configureEditor();
  453. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLCodeWidget)})},
  454. messageSends: ["textarea", "setEditorOn:", "element", "configureEditor"]}),
  455. smalltalk.HLCodeWidget);
  456. smalltalk.addMethod(
  457. "_saveIt",
  458. smalltalk.method({
  459. selector: "saveIt",
  460. fn: function (){
  461. var self=this;
  462. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLCodeWidget)})},
  463. messageSends: []}),
  464. smalltalk.HLCodeWidget);
  465. smalltalk.addMethod(
  466. "_selection",
  467. smalltalk.method({
  468. selector: "selection",
  469. fn: function (){
  470. var self=this;
  471. return smalltalk.withContext(function($ctx1) { var $1;
  472. $1=_st(self["@editor"])._getSelection();
  473. return $1;
  474. }, function($ctx1) {$ctx1.fill(self,"selection",{}, smalltalk.HLCodeWidget)})},
  475. messageSends: ["getSelection"]}),
  476. smalltalk.HLCodeWidget);
  477. smalltalk.addMethod(
  478. "_selectionEnd",
  479. smalltalk.method({
  480. selector: "selectionEnd",
  481. fn: function (){
  482. var self=this;
  483. return smalltalk.withContext(function($ctx1) { var $1;
  484. $1=_st(_st(self["@code"])._element())._selectionEnd();
  485. return $1;
  486. }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{}, smalltalk.HLCodeWidget)})},
  487. messageSends: ["selectionEnd", "element"]}),
  488. smalltalk.HLCodeWidget);
  489. smalltalk.addMethod(
  490. "_selectionEnd_",
  491. smalltalk.method({
  492. selector: "selectionEnd:",
  493. fn: function (anInteger){
  494. var self=this;
  495. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionEnd_(anInteger);
  496. return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  497. messageSends: ["selectionEnd:", "element"]}),
  498. smalltalk.HLCodeWidget);
  499. smalltalk.addMethod(
  500. "_selectionStart",
  501. smalltalk.method({
  502. selector: "selectionStart",
  503. fn: function (){
  504. var self=this;
  505. return smalltalk.withContext(function($ctx1) { var $1;
  506. $1=_st(_st(self["@code"])._element())._selectionStart();
  507. return $1;
  508. }, function($ctx1) {$ctx1.fill(self,"selectionStart",{}, smalltalk.HLCodeWidget)})},
  509. messageSends: ["selectionStart", "element"]}),
  510. smalltalk.HLCodeWidget);
  511. smalltalk.addMethod(
  512. "_selectionStart_",
  513. smalltalk.method({
  514. selector: "selectionStart:",
  515. fn: function (anInteger){
  516. var self=this;
  517. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionStart_(anInteger);
  518. return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  519. messageSends: ["selectionStart:", "element"]}),
  520. smalltalk.HLCodeWidget);
  521. smalltalk.addMethod(
  522. "_setEditorOn_",
  523. smalltalk.method({
  524. selector: "setEditorOn:",
  525. fn: function (aTextarea){
  526. var self=this;
  527. return smalltalk.withContext(function($ctx1) {
  528. self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  529. theme: 'amber',
  530. lineNumbers: true,
  531. enterMode: 'flat',
  532. indentWithTabs: true,
  533. indentUnit: 4,
  534. matchBrackets: true,
  535. electricChars: false,
  536. keyMap: 'Amber',
  537. extraKeys: {"Shift-Space": "autocomplete"}
  538. });
  539. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea},smalltalk.HLCodeWidget)})},
  540. messageSends: []}),
  541. smalltalk.HLCodeWidget);
  542. smalltalk.addMethod(
  543. "_variableHintFor_token_",
  544. smalltalk.method({
  545. selector: "variableHintFor:token:",
  546. fn: function (anEditor,aToken){
  547. var self=this;
  548. var variables,classNames,pseudoVariables;
  549. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  550. return smalltalk.withContext(function($ctx1) {
  551. var $1;
  552. variables=_st(_st(_st(_st(window)._jQuery_(_st(_st(anEditor)._display())._wrapper()))._find_("span.cm-variable"))._get())._collect_((function(each){
  553. return smalltalk.withContext(function($ctx2) {
  554. return _st(_st(window)._jQuery_(each))._html();
  555. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  556. classNames=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
  557. return smalltalk.withContext(function($ctx2) {
  558. return _st(each)._name();
  559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  560. pseudoVariables=_st(_st($Smalltalk())._current())._pseudoVariableNames();
  561. $1=_st(_st(_st(_st(_st(_st(variables).__comma(classNames)).__comma(pseudoVariables))._asSet())._asArray())._select_((function(each){
  562. return smalltalk.withContext(function($ctx2) {
  563. return _st(each)._includesSubString_(_st(aToken)._string());
  564. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._reject_((function(each){
  565. return smalltalk.withContext(function($ctx2) {
  566. return _st(each).__eq(_st(aToken)._string());
  567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  568. return $1;
  569. }, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken,variables:variables,classNames:classNames,pseudoVariables:pseudoVariables},smalltalk.HLCodeWidget)})},
  570. messageSends: ["collect:", "html", "jQuery:", "get", "find:", "wrapper", "display", "name", "classes", "current", "pseudoVariableNames", "reject:", "=", "string", "select:", "includesSubString:", "asArray", "asSet", ","]}),
  571. smalltalk.HLCodeWidget);
  572. smalltalk.addMethod(
  573. "_canBeOpenAsTab",
  574. smalltalk.method({
  575. selector: "canBeOpenAsTab",
  576. fn: function (){
  577. var self=this;
  578. return smalltalk.withContext(function($ctx1) { return true;
  579. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLCodeWidget.klass)})},
  580. messageSends: []}),
  581. smalltalk.HLCodeWidget.klass);
  582. smalltalk.addMethod(
  583. "_hintFor_options_",
  584. smalltalk.method({
  585. selector: "hintFor:options:",
  586. fn: function (anEditor,options){
  587. var self=this;
  588. var cursor,token,completions;
  589. function $CodeMirror(){return smalltalk.CodeMirror||(typeof CodeMirror=="undefined"?nil:CodeMirror)}
  590. function $HLCodeWidget(){return smalltalk.HLCodeWidget||(typeof HLCodeWidget=="undefined"?nil:HLCodeWidget)}
  591. return smalltalk.withContext(function($ctx1) {
  592. var $1,$2;
  593. cursor=_st(anEditor)._getCursor();
  594. token=_st(anEditor)._getTokenAt_(cursor);
  595. _st(token)._at_put_("state",_st(_st(_st($CodeMirror())._basicAt_("innerMode"))._value_value_(_st(anEditor)._getMode(),_st(token)._at_("state")))._state());
  596. $1=_st(_st(token)._type()).__eq("variable");
  597. if(smalltalk.assert($1)){
  598. completions=_st($HLCodeWidget())._variableHintFor_token_(anEditor,token);
  599. } else {
  600. completions=_st($HLCodeWidget())._messageHintFor_token_(anEditor,token);
  601. };
  602. $2=smalltalk.HashedCollection._fromPairs_([_st("list").__minus_gt(completions),_st("from").__minus_gt(_st(_st($CodeMirror())._basicAt_("Pos"))._value_value_(_st(cursor)._line(),_st(token)._end())),_st("to").__minus_gt(_st(_st($CodeMirror())._basicAt_("Pos"))._value_value_(_st(cursor)._line(),_st(token)._start()))]);
  603. return $2;
  604. }, function($ctx1) {$ctx1.fill(self,"hintFor:options:",{anEditor:anEditor,options:options,cursor:cursor,token:token,completions:completions},smalltalk.HLCodeWidget.klass)})},
  605. messageSends: ["getCursor", "getTokenAt:", "at:put:", "state", "value:value:", "getMode", "at:", "basicAt:", "ifTrue:ifFalse:", "variableHintFor:token:", "messageHintFor:token:", "=", "type", "->", "line", "end", "start"]}),
  606. smalltalk.HLCodeWidget.klass);
  607. smalltalk.addMethod(
  608. "_initialize",
  609. smalltalk.method({
  610. selector: "initialize",
  611. fn: function (){
  612. var self=this;
  613. return smalltalk.withContext(function($ctx1) { var $1,$2;
  614. smalltalk.HLWidget.klass.fn.prototype._initialize.apply(_st(self), []);
  615. $1=self;
  616. _st($1)._setupCodeMirror();
  617. _st($1)._setupCommands();
  618. $2=_st($1)._setupKeyMaps();
  619. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLCodeWidget.klass)})},
  620. messageSends: ["initialize", "setupCodeMirror", "setupCommands", "setupKeyMaps"]}),
  621. smalltalk.HLCodeWidget.klass);
  622. smalltalk.addMethod(
  623. "_keyMap",
  624. smalltalk.method({
  625. selector: "keyMap",
  626. fn: function (){
  627. var self=this;
  628. return smalltalk.withContext(function($ctx1) { var $2,$1;
  629. $2=_st(_st(_st((smalltalk.HLManager || HLManager))._current())._keyBinder())._systemIsMac();
  630. if(smalltalk.assert($2)){
  631. $1=_st(self)._macKeyMap();
  632. } else {
  633. $1=_st(self)._pcKeyMap();
  634. };
  635. return $1;
  636. }, function($ctx1) {$ctx1.fill(self,"keyMap",{}, smalltalk.HLCodeWidget.klass)})},
  637. messageSends: ["ifTrue:ifFalse:", "macKeyMap", "pcKeyMap", "systemIsMac", "keyBinder", "current"]}),
  638. smalltalk.HLCodeWidget.klass);
  639. smalltalk.addMethod(
  640. "_macKeyMap",
  641. smalltalk.method({
  642. selector: "macKeyMap",
  643. fn: function (){
  644. var self=this;
  645. return smalltalk.withContext(function($ctx1) {
  646. var $1;
  647. $1=smalltalk.HashedCollection._fromPairs_([_st("Alt-Backspace").__minus_gt("delWordBefore"),_st("Alt-Delete").__minus_gt("delWordAfter"),_st("Alt-Left").__minus_gt("goWordBoundaryLeft"),_st("Alt-Right").__minus_gt("goWordBoundaryRight"),_st("Cmd-A").__minus_gt("selectAll"),_st("Cmd-Alt-F").__minus_gt("replace"),_st("Cmd-D").__minus_gt("doIt"),_st("Cmd-Down").__minus_gt("goDocEnd"),_st("Cmd-End").__minus_gt("goDocEnd"),_st("Cmd-F").__minus_gt("find"),_st("Cmd-G").__minus_gt("findNext"),_st("Cmd-I").__minus_gt("inspectIt"),_st("Cmd-Left").__minus_gt("goLineStart"),_st("Cmd-P").__minus_gt("printIt"),_st("Cmd-Right").__minus_gt("goLineEnd"),_st("Cmd-S").__minus_gt("saveIt"),_st("Cmd-Up").__minus_gt("goDocStart"),_st("Cmd-Y").__minus_gt("redo"),_st("Cmd-Z").__minus_gt("undo"),_st("Cmd-[").__minus_gt("indentLess"),_st("Cmd-]").__minus_gt("indentMore"),_st("Ctrl-Alt-Backspace").__minus_gt("delWordAfter"),_st("Shift-Cmd-Alt-F").__minus_gt("replaceAll"),_st("Shift-Cmd-G").__minus_gt("findPrev"),_st("Shift-Cmd-Z").__minus_gt("redo"),_st("fallthrough").__minus_gt(["basic","emacsy"])]);
  648. return $1;
  649. }, function($ctx1) {$ctx1.fill(self,"macKeyMap",{},smalltalk.HLCodeWidget.klass)})},
  650. messageSends: ["->"]}),
  651. smalltalk.HLCodeWidget.klass);
  652. smalltalk.addMethod(
  653. "_messageHintFor_token_",
  654. smalltalk.method({
  655. selector: "messageHintFor:token:",
  656. fn: function (anEditor,aToken){
  657. var self=this;
  658. return smalltalk.withContext(function($ctx1) {
  659. var $1;
  660. $1=_st(_st(anEditor)._at_("amberCodeWidget"))._messageHintFor_token_(anEditor,aToken);
  661. return $1;
  662. }, function($ctx1) {$ctx1.fill(self,"messageHintFor:token:",{anEditor:anEditor,aToken:aToken},smalltalk.HLCodeWidget.klass)})},
  663. messageSends: ["messageHintFor:token:", "at:"]}),
  664. smalltalk.HLCodeWidget.klass);
  665. smalltalk.addMethod(
  666. "_pcKeyMap",
  667. smalltalk.method({
  668. selector: "pcKeyMap",
  669. fn: function (){
  670. var self=this;
  671. return smalltalk.withContext(function($ctx1) { var $1;
  672. $1=[_st("Alt-Left").__minus_gt("goLineStart"),_st("Alt-Right").__minus_gt("goLineEnd"),_st("Alt-Up").__minus_gt("goDocStart"),_st("Ctrl-A").__minus_gt("selectAll"),_st("Ctrl-Backspace").__minus_gt("delWordBefore"),_st("Ctrl-D").__minus_gt("doIt"),_st("Ctrl-Delete").__minus_gt("delWordAfter"),_st("Ctrl-Down").__minus_gt("goDocEnd"),_st("Ctrl-End").__minus_gt("goDocEnd"),_st("Ctrl-F").__minus_gt("find"),_st("Ctrl-G").__minus_gt("findNext"),_st("Ctrl-I").__minus_gt("inspectIt"),_st("Ctrl-Home").__minus_gt("goDocStart"),_st("Ctrl-Left").__minus_gt("goWordBoundaryLeft"),_st("Ctrl-P").__minus_gt("printIt"),_st("Ctrl-Right").__minus_gt("goWordBoundaryRight"),_st("Ctrl-S").__minus_gt("saveIt"),_st("Ctrl-Y").__minus_gt("redo"),_st("Ctrl-Z").__minus_gt("undo"),_st("Ctrl-[").__minus_gt("indentLess"),_st("Ctrl-]").__minus_gt("indentMore"),_st("Shift-Ctrl-F").__minus_gt("replace"),_st("Shift-Ctrl-G").__minus_gt("findPrev"),_st("Shift-Ctrl-R").__minus_gt("replaceAll"),_st("Shift-Ctrl-Z").__minus_gt("redo"),_st("fallthrough").__minus_gt(["basic"])];
  673. return $1;
  674. }, function($ctx1) {$ctx1.fill(self,"pcKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  675. messageSends: ["->"]}),
  676. smalltalk.HLCodeWidget.klass);
  677. smalltalk.addMethod(
  678. "_setupCodeMirror",
  679. smalltalk.method({
  680. selector: "setupCodeMirror",
  681. fn: function (){
  682. var self=this;
  683. return smalltalk.withContext(function($ctx1) {
  684. CodeMirror.keyMap.default.fallthrough = ["basic"];
  685. CodeMirror.commands.autocomplete = function(cm) {
  686. CodeMirror.showHint(cm, self._hintFor_options_);
  687. }
  688. ;
  689. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{},smalltalk.HLCodeWidget.klass)})},
  690. messageSends: []}),
  691. smalltalk.HLCodeWidget.klass);
  692. smalltalk.addMethod(
  693. "_setupCommands",
  694. smalltalk.method({
  695. selector: "setupCommands",
  696. fn: function (){
  697. var self=this;
  698. return smalltalk.withContext(function($ctx1) { var $1,$2;
  699. $1=_st((smalltalk.CodeMirror || CodeMirror))._basicAt_("commands");
  700. _st($1)._at_put_("doIt",(function(cm){
  701. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._doIt();
  702. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  703. _st($1)._at_put_("inspectIt",(function(cm){
  704. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._inspectIt();
  705. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  706. _st($1)._at_put_("printIt",(function(cm){
  707. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._printIt();
  708. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  709. $2=_st($1)._at_put_("saveIt",(function(cm){
  710. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._saveIt();
  711. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  712. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{}, smalltalk.HLCodeWidget.klass)})},
  713. messageSends: ["at:put:", "doIt", "amberCodeWidget", "basicAt:", "inspectIt", "printIt", "saveIt"]}),
  714. smalltalk.HLCodeWidget.klass);
  715. smalltalk.addMethod(
  716. "_setupKeyMaps",
  717. smalltalk.method({
  718. selector: "setupKeyMaps",
  719. fn: function (){
  720. var self=this;
  721. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap['Amber'] = self._keyMap();
  722. return self}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{}, smalltalk.HLCodeWidget.klass)})},
  723. messageSends: []}),
  724. smalltalk.HLCodeWidget.klass);
  725. smalltalk.addMethod(
  726. "_tabLabel",
  727. smalltalk.method({
  728. selector: "tabLabel",
  729. fn: function (){
  730. var self=this;
  731. return smalltalk.withContext(function($ctx1) { return "Workspace";
  732. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLCodeWidget.klass)})},
  733. messageSends: []}),
  734. smalltalk.HLCodeWidget.klass);
  735. smalltalk.addMethod(
  736. "_tabPriority",
  737. smalltalk.method({
  738. selector: "tabPriority",
  739. fn: function (){
  740. var self=this;
  741. return smalltalk.withContext(function($ctx1) { return (10);
  742. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLCodeWidget.klass)})},
  743. messageSends: []}),
  744. smalltalk.HLCodeWidget.klass);
  745. smalltalk.addMethod(
  746. "_variableHintFor_token_",
  747. smalltalk.method({
  748. selector: "variableHintFor:token:",
  749. fn: function (anEditor,aToken){
  750. var self=this;
  751. return smalltalk.withContext(function($ctx1) {
  752. var $1;
  753. $1=_st(_st(anEditor)._at_("amberCodeWidget"))._variableHintFor_token_(anEditor,aToken);
  754. return $1;
  755. }, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken},smalltalk.HLCodeWidget.klass)})},
  756. messageSends: ["variableHintFor:token:", "at:"]}),
  757. smalltalk.HLCodeWidget.klass);
  758. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, ['browserModel'], 'Helios-Workspace');
  759. smalltalk.addMethod(
  760. "_browserModel",
  761. smalltalk.method({
  762. selector: "browserModel",
  763. fn: function (){
  764. var self=this;
  765. return smalltalk.withContext(function($ctx1) { var $1;
  766. $1=self["@browserModel"];
  767. return $1;
  768. }, function($ctx1) {$ctx1.fill(self,"browserModel",{}, smalltalk.HLSourceCodeWidget)})},
  769. messageSends: []}),
  770. smalltalk.HLSourceCodeWidget);
  771. smalltalk.addMethod(
  772. "_browserModel_",
  773. smalltalk.method({
  774. selector: "browserModel:",
  775. fn: function (aBrowserModel){
  776. var self=this;
  777. return smalltalk.withContext(function($ctx1) { self["@browserModel"]=aBrowserModel;
  778. _st(self)._observeBrowserModel();
  779. return self}, function($ctx1) {$ctx1.fill(self,"browserModel:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget)})},
  780. messageSends: ["observeBrowserModel"]}),
  781. smalltalk.HLSourceCodeWidget);
  782. smalltalk.addMethod(
  783. "_observeBrowserModel",
  784. smalltalk.method({
  785. selector: "observeBrowserModel",
  786. fn: function (){
  787. var self=this;
  788. return smalltalk.withContext(function($ctx1) { var $1,$2;
  789. $1=_st(_st(self)._browserModel())._announcer();
  790. _st($1)._on_do_((smalltalk.HLSaveSourceCode || HLSaveSourceCode),(function(ann){
  791. return smalltalk.withContext(function($ctx2) { return _st(self)._onSaveIt();
  792. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  793. _st($1)._on_do_((smalltalk.HLParseErrorRaised || HLParseErrorRaised),(function(ann){
  794. return smalltalk.withContext(function($ctx2) { return _st(self)._onParseError_(ann);
  795. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  796. _st($1)._on_do_((smalltalk.HLCompileErrorRaised || HLCompileErrorRaised),(function(ann){
  797. return smalltalk.withContext(function($ctx2) { return _st(self)._onCompileError_(_st(ann)._error());
  798. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  799. _st($1)._on_do_((smalltalk.HLUnknownVariableErrorRaised || HLUnknownVariableErrorRaised),(function(ann){
  800. return smalltalk.withContext(function($ctx2) { return _st(self)._onUnknownVariableError_(_st(ann)._error());
  801. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  802. $2=_st($1)._on_do_((smalltalk.HLInstVarAdded || HLInstVarAdded),(function(ann){
  803. return smalltalk.withContext(function($ctx2) { return _st(self)._onInstVarAdded();
  804. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  805. return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{}, smalltalk.HLSourceCodeWidget)})},
  806. messageSends: ["on:do:", "onSaveIt", "announcer", "browserModel", "onParseError:", "onCompileError:", "error", "onUnknownVariableError:", "onInstVarAdded"]}),
  807. smalltalk.HLSourceCodeWidget);
  808. smalltalk.addMethod(
  809. "_onCompileError_",
  810. smalltalk.method({
  811. selector: "onCompileError:",
  812. fn: function (anError){
  813. var self=this;
  814. return smalltalk.withContext(function($ctx1) { _st(self)._alert_(_st(anError)._messageText());
  815. return self}, function($ctx1) {$ctx1.fill(self,"onCompileError:",{anError:anError}, smalltalk.HLSourceCodeWidget)})},
  816. messageSends: ["alert:", "messageText"]}),
  817. smalltalk.HLSourceCodeWidget);
  818. smalltalk.addMethod(
  819. "_onInstVarAdded",
  820. smalltalk.method({
  821. selector: "onInstVarAdded",
  822. fn: function (){
  823. var self=this;
  824. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  825. return self}, function($ctx1) {$ctx1.fill(self,"onInstVarAdded",{}, smalltalk.HLSourceCodeWidget)})},
  826. messageSends: ["save:", "contents", "browserModel"]}),
  827. smalltalk.HLSourceCodeWidget);
  828. smalltalk.addMethod(
  829. "_onParseError_",
  830. smalltalk.method({
  831. selector: "onParseError:",
  832. fn: function (anAnnouncement){
  833. var self=this;
  834. var lineIndex,newContents;
  835. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  836. lineIndex=(1);
  837. _st(self)._contents_(_st((smalltalk.String || String))._streamContents_((function(stream){
  838. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._contents())._linesDo_((function(each){
  839. return smalltalk.withContext(function($ctx3) { $1=_st(lineIndex).__eq(_st(anAnnouncement)._line());
  840. if(smalltalk.assert($1)){
  841. $2=stream;
  842. _st($2)._nextPutAll_(_st(each)._copyFrom_to_((1),_st(anAnnouncement)._column()));
  843. _st($2)._nextPutAll_("<- ");
  844. _st($2)._nextPutAll_(_st(anAnnouncement)._message());
  845. _st($2)._nextPutAll_(" ");
  846. $3=_st($2)._nextPutAll_(_st(each)._copyFrom_to_(_st(_st(anAnnouncement)._column()).__plus((1)),_st(each)._size()));
  847. $3;
  848. } else {
  849. _st(stream)._nextPutAll_(each);
  850. };
  851. _st(stream)._nextPutAll_(_st((smalltalk.String || String))._cr());
  852. lineIndex=_st(lineIndex).__plus((1));
  853. return lineIndex;
  854. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  855. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  856. return self}, function($ctx1) {$ctx1.fill(self,"onParseError:",{anAnnouncement:anAnnouncement,lineIndex:lineIndex,newContents:newContents}, smalltalk.HLSourceCodeWidget)})},
  857. messageSends: ["contents:", "streamContents:", "linesDo:", "ifTrue:ifFalse:", "nextPutAll:", "copyFrom:to:", "column", "message", "+", "size", "=", "line", "cr", "contents"]}),
  858. smalltalk.HLSourceCodeWidget);
  859. smalltalk.addMethod(
  860. "_onSaveIt",
  861. smalltalk.method({
  862. selector: "onSaveIt",
  863. fn: function (){
  864. var self=this;
  865. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  866. return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLSourceCodeWidget)})},
  867. messageSends: ["save:", "contents", "browserModel"]}),
  868. smalltalk.HLSourceCodeWidget);
  869. smalltalk.addMethod(
  870. "_onUnknownVariableError_",
  871. smalltalk.method({
  872. selector: "onUnknownVariableError:",
  873. fn: function (anError){
  874. var self=this;
  875. var confirm;
  876. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  877. confirm=_st(self)._confirm_(_st((smalltalk.String || String))._streamContents_((function(stream){
  878. return smalltalk.withContext(function($ctx2) { $1=stream;
  879. _st($1)._nextPutAll_(_st(anError)._messageText());
  880. _st($1)._nextPutAll_(_st((smalltalk.String || String))._cr());
  881. $2=_st($1)._nextPutAll_("Would you like to define an instance variable?");
  882. return $2;
  883. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  884. $3=confirm;
  885. if(! smalltalk.assert($3)){
  886. $4=self;
  887. return $4;
  888. };
  889. _st(_st(self)._browserModel())._addInstVarNamed_(_st(anError)._variableName());
  890. return self}, function($ctx1) {$ctx1.fill(self,"onUnknownVariableError:",{anError:anError,confirm:confirm}, smalltalk.HLSourceCodeWidget)})},
  891. messageSends: ["confirm:", "streamContents:", "nextPutAll:", "messageText", "cr", "ifFalse:", "addInstVarNamed:", "variableName", "browserModel"]}),
  892. smalltalk.HLSourceCodeWidget);
  893. smalltalk.addMethod(
  894. "_saveIt",
  895. smalltalk.method({
  896. selector: "saveIt",
  897. fn: function (){
  898. var self=this;
  899. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._saveSourceCode();
  900. return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLSourceCodeWidget)})},
  901. messageSends: ["saveSourceCode", "browserModel"]}),
  902. smalltalk.HLSourceCodeWidget);
  903. smalltalk.addMethod(
  904. "_canBeOpenAsTab",
  905. smalltalk.method({
  906. selector: "canBeOpenAsTab",
  907. fn: function (){
  908. var self=this;
  909. return smalltalk.withContext(function($ctx1) { return false;
  910. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLSourceCodeWidget.klass)})},
  911. messageSends: []}),
  912. smalltalk.HLSourceCodeWidget.klass);
  913. smalltalk.addMethod(
  914. "_on_",
  915. smalltalk.method({
  916. selector: "on:",
  917. fn: function (aBrowserModel){
  918. var self=this;
  919. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  920. $2=_st(self)._new();
  921. _st($2)._browserModel_(aBrowserModel);
  922. $3=_st($2)._yourself();
  923. $1=$3;
  924. return $1;
  925. }, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget.klass)})},
  926. messageSends: ["browserModel:", "new", "yourself"]}),
  927. smalltalk.HLSourceCodeWidget.klass);