Helios-Workspace.deploy.js 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579
  1. define(["smalltalk","nil","_st"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Helios-Workspace');
  3. smalltalk.addClass('HLCodeModel', smalltalk.Object, ['announcer', 'environment', 'receiver'], 'Helios-Workspace');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "announcer",
  7. fn: function (){
  8. var self=this;
  9. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  10. return smalltalk.withContext(function($ctx1) {
  11. var $2,$1;
  12. $2=self["@announcer"];
  13. if(($receiver = $2) == nil || $receiver == undefined){
  14. self["@announcer"]=_st($Announcer())._new();
  15. $1=self["@announcer"];
  16. } else {
  17. $1=$2;
  18. };
  19. return $1;
  20. }, function($ctx1) {$ctx1.fill(self,"announcer",{},smalltalk.HLCodeModel)})},
  21. messageSends: ["ifNil:", "new"]}),
  22. smalltalk.HLCodeModel);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "defaultReceiver",
  26. fn: function (){
  27. var self=this;
  28. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  29. return smalltalk.withContext(function($ctx1) {
  30. var $1;
  31. $1=_st($DoIt())._new();
  32. return $1;
  33. }, function($ctx1) {$ctx1.fill(self,"defaultReceiver",{},smalltalk.HLCodeModel)})},
  34. messageSends: ["new"]}),
  35. smalltalk.HLCodeModel);
  36. smalltalk.addMethod(
  37. smalltalk.method({
  38. selector: "doIt:",
  39. fn: function (aString){
  40. var self=this;
  41. return smalltalk.withContext(function($ctx1) {
  42. var $1;
  43. $1=_st(self._environment())._eval_on_(aString,self._receiver());
  44. return $1;
  45. }, function($ctx1) {$ctx1.fill(self,"doIt:",{aString:aString},smalltalk.HLCodeModel)})},
  46. messageSends: ["eval:on:", "receiver", "environment"]}),
  47. smalltalk.HLCodeModel);
  48. smalltalk.addMethod(
  49. smalltalk.method({
  50. selector: "environment",
  51. fn: function (){
  52. var self=this;
  53. function $HLManager(){return smalltalk.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
  54. return smalltalk.withContext(function($ctx1) {
  55. var $2,$1;
  56. $2=self["@environment"];
  57. if(($receiver = $2) == nil || $receiver == undefined){
  58. $1=_st(_st($HLManager())._current())._environment();
  59. } else {
  60. $1=$2;
  61. };
  62. return $1;
  63. }, function($ctx1) {$ctx1.fill(self,"environment",{},smalltalk.HLCodeModel)})},
  64. messageSends: ["ifNil:", "environment", "current"]}),
  65. smalltalk.HLCodeModel);
  66. smalltalk.addMethod(
  67. smalltalk.method({
  68. selector: "environment:",
  69. fn: function (anEnvironment){
  70. var self=this;
  71. return smalltalk.withContext(function($ctx1) {
  72. self["@environment"]=anEnvironment;
  73. return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment},smalltalk.HLCodeModel)})},
  74. messageSends: []}),
  75. smalltalk.HLCodeModel);
  76. smalltalk.addMethod(
  77. smalltalk.method({
  78. selector: "inspect:",
  79. fn: function (anObject){
  80. var self=this;
  81. return smalltalk.withContext(function($ctx1) {
  82. _st(self._environment())._inspect_(anObject);
  83. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.HLCodeModel)})},
  84. messageSends: ["inspect:", "environment"]}),
  85. smalltalk.HLCodeModel);
  86. smalltalk.addMethod(
  87. smalltalk.method({
  88. selector: "receiver",
  89. fn: function (){
  90. var self=this;
  91. return smalltalk.withContext(function($ctx1) {
  92. var $2,$1;
  93. $2=self["@receiver"];
  94. if(($receiver = $2) == nil || $receiver == undefined){
  95. self["@receiver"]=self._defaultReceiver();
  96. $1=self["@receiver"];
  97. } else {
  98. $1=$2;
  99. };
  100. return $1;
  101. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.HLCodeModel)})},
  102. messageSends: ["ifNil:", "defaultReceiver"]}),
  103. smalltalk.HLCodeModel);
  104. smalltalk.addMethod(
  105. smalltalk.method({
  106. selector: "receiver:",
  107. fn: function (anObject){
  108. var self=this;
  109. return smalltalk.withContext(function($ctx1) {
  110. self["@receiver"]=anObject;
  111. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.HLCodeModel)})},
  112. messageSends: []}),
  113. smalltalk.HLCodeModel);
  114. smalltalk.addMethod(
  115. smalltalk.method({
  116. selector: "on:",
  117. fn: function (anEnvironment){
  118. var self=this;
  119. return smalltalk.withContext(function($ctx1) {
  120. var $2,$3,$1;
  121. $2=self._new();
  122. _st($2)._environment_(anEnvironment);
  123. $3=_st($2)._yourself();
  124. $1=$3;
  125. return $1;
  126. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment},smalltalk.HLCodeModel.klass)})},
  127. messageSends: ["environment:", "new", "yourself"]}),
  128. smalltalk.HLCodeModel.klass);
  129. smalltalk.addClass('HLCodeWidget', smalltalk.HLWidget, ['model', 'wrapper', 'code', 'editor', 'state'], 'Helios-Workspace');
  130. smalltalk.addMethod(
  131. smalltalk.method({
  132. selector: "announcer",
  133. fn: function (){
  134. var self=this;
  135. return smalltalk.withContext(function($ctx1) {
  136. var $1;
  137. $1=_st(self._model())._announcer();
  138. return $1;
  139. }, function($ctx1) {$ctx1.fill(self,"announcer",{},smalltalk.HLCodeWidget)})},
  140. messageSends: ["announcer", "model"]}),
  141. smalltalk.HLCodeWidget);
  142. smalltalk.addMethod(
  143. smalltalk.method({
  144. selector: "canHaveFocus",
  145. fn: function (){
  146. var self=this;
  147. return smalltalk.withContext(function($ctx1) {
  148. return true;
  149. }, function($ctx1) {$ctx1.fill(self,"canHaveFocus",{},smalltalk.HLCodeWidget)})},
  150. messageSends: []}),
  151. smalltalk.HLCodeWidget);
  152. smalltalk.addMethod(
  153. smalltalk.method({
  154. selector: "clear",
  155. fn: function (){
  156. var self=this;
  157. return smalltalk.withContext(function($ctx1) {
  158. self._contents_("");
  159. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.HLCodeWidget)})},
  160. messageSends: ["contents:"]}),
  161. smalltalk.HLCodeWidget);
  162. smalltalk.addMethod(
  163. smalltalk.method({
  164. selector: "configureEditor",
  165. fn: function (){
  166. var self=this;
  167. return smalltalk.withContext(function($ctx1) {
  168. _st(self._editor())._at_put_("amberCodeWidget",self);
  169. _st(self._editor())._on_do_("change",(function(){
  170. return smalltalk.withContext(function($ctx2) {
  171. return self._onChange();
  172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  173. return self}, function($ctx1) {$ctx1.fill(self,"configureEditor",{},smalltalk.HLCodeWidget)})},
  174. messageSends: ["at:put:", "editor", "on:do:", "onChange"]}),
  175. smalltalk.HLCodeWidget);
  176. smalltalk.addMethod(
  177. smalltalk.method({
  178. selector: "contents",
  179. fn: function (){
  180. var self=this;
  181. return smalltalk.withContext(function($ctx1) {
  182. var $1;
  183. $1=_st(self["@editor"])._getValue();
  184. return $1;
  185. }, function($ctx1) {$ctx1.fill(self,"contents",{},smalltalk.HLCodeWidget)})},
  186. messageSends: ["getValue"]}),
  187. smalltalk.HLCodeWidget);
  188. smalltalk.addMethod(
  189. smalltalk.method({
  190. selector: "contents:",
  191. fn: function (aString){
  192. var self=this;
  193. return smalltalk.withContext(function($ctx1) {
  194. var $1;
  195. _st(self["@editor"])._setValue_(aString);
  196. $1=self["@state"];
  197. if(($receiver = $1) == nil || $receiver == undefined){
  198. $1;
  199. } else {
  200. self._updateState();
  201. };
  202. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},smalltalk.HLCodeWidget)})},
  203. messageSends: ["setValue:", "ifNotNil:", "updateState"]}),
  204. smalltalk.HLCodeWidget);
  205. smalltalk.addMethod(
  206. smalltalk.method({
  207. selector: "currentLine",
  208. fn: function (){
  209. var self=this;
  210. return smalltalk.withContext(function($ctx1) {
  211. var $1;
  212. $1=_st(self["@editor"])._getLine_(_st(_st(self["@editor"])._getCursor())._line());
  213. return $1;
  214. }, function($ctx1) {$ctx1.fill(self,"currentLine",{},smalltalk.HLCodeWidget)})},
  215. messageSends: ["getLine:", "line", "getCursor"]}),
  216. smalltalk.HLCodeWidget);
  217. smalltalk.addMethod(
  218. smalltalk.method({
  219. selector: "currentLineOrSelection",
  220. fn: function (){
  221. var self=this;
  222. return smalltalk.withContext(function($ctx1) {
  223. var $2,$1;
  224. $2=_st(self["@editor"])._somethingSelected();
  225. if(smalltalk.assert($2)){
  226. $1=self._selection();
  227. } else {
  228. $1=self._currentLine();
  229. };
  230. return $1;
  231. }, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{},smalltalk.HLCodeWidget)})},
  232. messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"]}),
  233. smalltalk.HLCodeWidget);
  234. smalltalk.addMethod(
  235. smalltalk.method({
  236. selector: "doIt",
  237. fn: function (){
  238. var self=this;
  239. var result;
  240. function $HLDoItRequested(){return smalltalk.HLDoItRequested||(typeof HLDoItRequested=="undefined"?nil:HLDoItRequested)}
  241. function $HLDoItExecuted(){return smalltalk.HLDoItExecuted||(typeof HLDoItExecuted=="undefined"?nil:HLDoItExecuted)}
  242. return smalltalk.withContext(function($ctx1) {
  243. var $1;
  244. _st(_st(self._model())._announcer())._announce_(_st($HLDoItRequested())._on_(self["@model"]));
  245. result=_st(self["@model"])._doIt_(self._currentLineOrSelection());
  246. _st(_st(self._model())._announcer())._announce_(_st($HLDoItExecuted())._on_(self["@model"]));
  247. $1=result;
  248. return $1;
  249. }, function($ctx1) {$ctx1.fill(self,"doIt",{result:result},smalltalk.HLCodeWidget)})},
  250. messageSends: ["announce:", "on:", "announcer", "model", "doIt:", "currentLineOrSelection"]}),
  251. smalltalk.HLCodeWidget);
  252. smalltalk.addMethod(
  253. smalltalk.method({
  254. selector: "editor",
  255. fn: function (){
  256. var self=this;
  257. return smalltalk.withContext(function($ctx1) {
  258. var $1;
  259. $1=self["@editor"];
  260. return $1;
  261. }, function($ctx1) {$ctx1.fill(self,"editor",{},smalltalk.HLCodeWidget)})},
  262. messageSends: []}),
  263. smalltalk.HLCodeWidget);
  264. smalltalk.addMethod(
  265. smalltalk.method({
  266. selector: "editorOptions",
  267. fn: function (){
  268. var self=this;
  269. return smalltalk.withContext(function($ctx1) {
  270. var $1;
  271. $1=smalltalk.HashedCollection._from_(["theme".__minus_gt("amber"),"lineNumbers".__minus_gt(true),"enterMode".__minus_gt("flat"),"indentWithTabs".__minus_gt(true),"indentUnit".__minus_gt((4)),"matchBrackets".__minus_gt(true),"electricChars".__minus_gt(false),"keyMap".__minus_gt("Amber"),"extraKeys".__minus_gt(smalltalk.HashedCollection._from_(["Shift-Space".__minus_gt("autocomplete")]))]);
  272. return $1;
  273. }, function($ctx1) {$ctx1.fill(self,"editorOptions",{},smalltalk.HLCodeWidget)})},
  274. messageSends: ["->"]}),
  275. smalltalk.HLCodeWidget);
  276. smalltalk.addMethod(
  277. smalltalk.method({
  278. selector: "focus",
  279. fn: function (){
  280. var self=this;
  281. return smalltalk.withContext(function($ctx1) {
  282. _st(self["@editor"])._focus();
  283. return self}, function($ctx1) {$ctx1.fill(self,"focus",{},smalltalk.HLCodeWidget)})},
  284. messageSends: ["focus"]}),
  285. smalltalk.HLCodeWidget);
  286. smalltalk.addMethod(
  287. smalltalk.method({
  288. selector: "hasFocus",
  289. fn: function (){
  290. var self=this;
  291. return smalltalk.withContext(function($ctx1) {
  292. var $1;
  293. $1=_st(_st(self["@code"])._asJQuery())._is_(":active");
  294. return $1;
  295. }, function($ctx1) {$ctx1.fill(self,"hasFocus",{},smalltalk.HLCodeWidget)})},
  296. messageSends: ["is:", "asJQuery"]}),
  297. smalltalk.HLCodeWidget);
  298. smalltalk.addMethod(
  299. smalltalk.method({
  300. selector: "hasModification",
  301. fn: function (){
  302. var self=this;
  303. return smalltalk.withContext(function($ctx1) {
  304. return false;
  305. }, function($ctx1) {$ctx1.fill(self,"hasModification",{},smalltalk.HLCodeWidget)})},
  306. messageSends: []}),
  307. smalltalk.HLCodeWidget);
  308. smalltalk.addMethod(
  309. smalltalk.method({
  310. selector: "inspectIt",
  311. fn: function (){
  312. var self=this;
  313. var newInspector;
  314. function $HLInspectItRequested(){return smalltalk.HLInspectItRequested||(typeof HLInspectItRequested=="undefined"?nil:HLInspectItRequested)}
  315. return smalltalk.withContext(function($ctx1) {
  316. _st(_st(self._model())._announcer())._announce_(_st($HLInspectItRequested())._on_(self["@model"]));
  317. _st(self._model())._inspect_(self._doIt());
  318. return self}, function($ctx1) {$ctx1.fill(self,"inspectIt",{newInspector:newInspector},smalltalk.HLCodeWidget)})},
  319. messageSends: ["announce:", "on:", "announcer", "model", "inspect:", "doIt"]}),
  320. smalltalk.HLCodeWidget);
  321. smalltalk.addMethod(
  322. smalltalk.method({
  323. selector: "messageHintFor:token:",
  324. fn: function (anEditor,aToken){
  325. var self=this;
  326. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  327. return smalltalk.withContext(function($ctx1) {
  328. var $1;
  329. $1=_st(_st(_st(_st(_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value())._asSet())._asArray())._select_((function(each){
  330. return smalltalk.withContext(function($ctx2) {
  331. return _st(each)._includesSubString_(_st(aToken)._string());
  332. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._reject_((function(each){
  333. return smalltalk.withContext(function($ctx2) {
  334. return _st(each).__eq(_st(aToken)._string());
  335. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  336. return $1;
  337. }, function($ctx1) {$ctx1.fill(self,"messageHintFor:token:",{anEditor:anEditor,aToken:aToken},smalltalk.HLCodeWidget)})},
  338. messageSends: ["reject:", "=", "string", "select:", "includesSubString:", "asArray", "asSet", "value", "at:", "current"]}),
  339. smalltalk.HLCodeWidget);
  340. smalltalk.addMethod(
  341. smalltalk.method({
  342. selector: "model",
  343. fn: function (){
  344. var self=this;
  345. function $HLCodeModel(){return smalltalk.HLCodeModel||(typeof HLCodeModel=="undefined"?nil:HLCodeModel)}
  346. return smalltalk.withContext(function($ctx1) {
  347. var $2,$1;
  348. $2=self["@model"];
  349. if(($receiver = $2) == nil || $receiver == undefined){
  350. self["@model"]=_st($HLCodeModel())._new();
  351. $1=self["@model"];
  352. } else {
  353. $1=$2;
  354. };
  355. return $1;
  356. }, function($ctx1) {$ctx1.fill(self,"model",{},smalltalk.HLCodeWidget)})},
  357. messageSends: ["ifNil:", "new"]}),
  358. smalltalk.HLCodeWidget);
  359. smalltalk.addMethod(
  360. smalltalk.method({
  361. selector: "model:",
  362. fn: function (aModel){
  363. var self=this;
  364. return smalltalk.withContext(function($ctx1) {
  365. self["@model"]=aModel;
  366. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel},smalltalk.HLCodeWidget)})},
  367. messageSends: []}),
  368. smalltalk.HLCodeWidget);
  369. smalltalk.addMethod(
  370. smalltalk.method({
  371. selector: "onChange",
  372. fn: function (){
  373. var self=this;
  374. return smalltalk.withContext(function($ctx1) {
  375. self._updateState();
  376. return self}, function($ctx1) {$ctx1.fill(self,"onChange",{},smalltalk.HLCodeWidget)})},
  377. messageSends: ["updateState"]}),
  378. smalltalk.HLCodeWidget);
  379. smalltalk.addMethod(
  380. smalltalk.method({
  381. selector: "onDoIt",
  382. fn: function (){
  383. var self=this;
  384. return smalltalk.withContext(function($ctx1) {
  385. self._doIt();
  386. return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{},smalltalk.HLCodeWidget)})},
  387. messageSends: ["doIt"]}),
  388. smalltalk.HLCodeWidget);
  389. smalltalk.addMethod(
  390. smalltalk.method({
  391. selector: "onInspectIt",
  392. fn: function (){
  393. var self=this;
  394. return smalltalk.withContext(function($ctx1) {
  395. self._inspectIt();
  396. return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{},smalltalk.HLCodeWidget)})},
  397. messageSends: ["inspectIt"]}),
  398. smalltalk.HLCodeWidget);
  399. smalltalk.addMethod(
  400. smalltalk.method({
  401. selector: "onPrintIt",
  402. fn: function (){
  403. var self=this;
  404. return smalltalk.withContext(function($ctx1) {
  405. self._printIt();
  406. return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{},smalltalk.HLCodeWidget)})},
  407. messageSends: ["printIt"]}),
  408. smalltalk.HLCodeWidget);
  409. smalltalk.addMethod(
  410. smalltalk.method({
  411. selector: "onSaveIt",
  412. fn: function (){
  413. var self=this;
  414. return smalltalk.withContext(function($ctx1) {
  415. return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{},smalltalk.HLCodeWidget)})},
  416. messageSends: []}),
  417. smalltalk.HLCodeWidget);
  418. smalltalk.addMethod(
  419. smalltalk.method({
  420. selector: "print:",
  421. fn: function (aString){
  422. var self=this;
  423. var start,stop,currentLine;
  424. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  425. return smalltalk.withContext(function($ctx1) {
  426. currentLine=_st(_st(self["@editor"])._getCursor_(false))._line();
  427. start=_st($HashedCollection())._new();
  428. _st(start)._at_put_("line",currentLine);
  429. _st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
  430. _st(_st(self["@editor"])._getSelection())._ifEmpty_((function(){
  431. return smalltalk.withContext(function($ctx2) {
  432. _st(start)._at_put_("ch",_st(_st(self["@editor"])._getLine_(currentLine))._size());
  433. return _st(self["@editor"])._setSelection_end_(smalltalk.HashedCollection._from_(["line".__minus_gt(currentLine),"ch".__minus_gt((0))]),start);
  434. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  435. stop=_st($HashedCollection())._new();
  436. _st(stop)._at_put_("line",currentLine);
  437. _st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
  438. _st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
  439. _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
  440. _st(self["@editor"])._setSelection_end_(stop,start);
  441. return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine},smalltalk.HLCodeWidget)})},
  442. messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "size", "getLine:", "setSelection:end:", "->", "getSelection", "+", "at:", "replaceSelection:", ",", "setCursor:"]}),
  443. smalltalk.HLCodeWidget);
  444. smalltalk.addMethod(
  445. smalltalk.method({
  446. selector: "printIt",
  447. fn: function (){
  448. var self=this;
  449. var result;
  450. function $HLPrintItRequested(){return smalltalk.HLPrintItRequested||(typeof HLPrintItRequested=="undefined"?nil:HLPrintItRequested)}
  451. return smalltalk.withContext(function($ctx1) {
  452. result=self._doIt();
  453. _st(_st(self._model())._announcer())._announce_(_st($HLPrintItRequested())._on_(self["@model"]));
  454. self._print_(_st(result)._printString());
  455. self._focus();
  456. return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result},smalltalk.HLCodeWidget)})},
  457. messageSends: ["doIt", "announce:", "on:", "announcer", "model", "print:", "printString", "focus"]}),
  458. smalltalk.HLCodeWidget);
  459. smalltalk.addMethod(
  460. smalltalk.method({
  461. selector: "receiver",
  462. fn: function (){
  463. var self=this;
  464. return smalltalk.withContext(function($ctx1) {
  465. var $1;
  466. $1=_st(self._model())._receiver();
  467. return $1;
  468. }, function($ctx1) {$ctx1.fill(self,"receiver",{},smalltalk.HLCodeWidget)})},
  469. messageSends: ["receiver", "model"]}),
  470. smalltalk.HLCodeWidget);
  471. smalltalk.addMethod(
  472. smalltalk.method({
  473. selector: "receiver:",
  474. fn: function (anObject){
  475. var self=this;
  476. return smalltalk.withContext(function($ctx1) {
  477. _st(self._model())._receiver_(anObject);
  478. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},smalltalk.HLCodeWidget)})},
  479. messageSends: ["receiver:", "model"]}),
  480. smalltalk.HLCodeWidget);
  481. smalltalk.addMethod(
  482. smalltalk.method({
  483. selector: "renderButtonsOn:",
  484. fn: function (html){
  485. var self=this;
  486. return smalltalk.withContext(function($ctx1) {
  487. var $1,$2,$3,$4,$5,$6;
  488. $1=_st(html)._button();
  489. _st($1)._class_("button");
  490. _st($1)._with_("DoIt");
  491. $2=_st($1)._onClick_((function(){
  492. return smalltalk.withContext(function($ctx2) {
  493. return self._doIt();
  494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  495. $3=_st(html)._button();
  496. _st($3)._class_("button");
  497. _st($3)._with_("PrintIt");
  498. $4=_st($3)._onClick_((function(){
  499. return smalltalk.withContext(function($ctx2) {
  500. return self._printIt();
  501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  502. $5=_st(html)._button();
  503. _st($5)._class_("button");
  504. _st($5)._with_("InspectIt");
  505. $6=_st($5)._onClick_((function(){
  506. return smalltalk.withContext(function($ctx2) {
  507. return self._inspectIt();
  508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  509. return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},smalltalk.HLCodeWidget)})},
  510. messageSends: ["class:", "button", "with:", "onClick:", "doIt", "printIt", "inspectIt"]}),
  511. smalltalk.HLCodeWidget);
  512. smalltalk.addMethod(
  513. smalltalk.method({
  514. selector: "renderContentOn:",
  515. fn: function (html){
  516. var self=this;
  517. return smalltalk.withContext(function($ctx1) {
  518. var $1,$2,$3,$4,$5,$6;
  519. $1=_st(html)._div();
  520. _st($1)._class_("editor");
  521. $2=_st($1)._with_((function(){
  522. return smalltalk.withContext(function($ctx2) {
  523. self["@code"]=_st(html)._textarea();
  524. return self["@code"];
  525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  526. self["@state"]=_st(_st(html)._div())._class_("state");
  527. $3=_st(html)._div();
  528. _st($3)._class_("buttons_bar");
  529. $4=_st($3)._with_((function(){
  530. return smalltalk.withContext(function($ctx2) {
  531. return self._renderButtonsOn_(html);
  532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  533. $5=self;
  534. _st($5)._setEditorOn_(_st(self["@code"])._element());
  535. _st($5)._configureEditor();
  536. $6=_st($5)._updateState();
  537. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLCodeWidget)})},
  538. messageSends: ["class:", "div", "with:", "textarea", "renderButtonsOn:", "setEditorOn:", "element", "configureEditor", "updateState"]}),
  539. smalltalk.HLCodeWidget);
  540. smalltalk.addMethod(
  541. smalltalk.method({
  542. selector: "saveIt",
  543. fn: function (){
  544. var self=this;
  545. return smalltalk.withContext(function($ctx1) {
  546. return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{},smalltalk.HLCodeWidget)})},
  547. messageSends: []}),
  548. smalltalk.HLCodeWidget);
  549. smalltalk.addMethod(
  550. smalltalk.method({
  551. selector: "selection",
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1;
  556. $1=_st(self["@editor"])._getSelection();
  557. return $1;
  558. }, function($ctx1) {$ctx1.fill(self,"selection",{},smalltalk.HLCodeWidget)})},
  559. messageSends: ["getSelection"]}),
  560. smalltalk.HLCodeWidget);
  561. smalltalk.addMethod(
  562. smalltalk.method({
  563. selector: "selectionEnd",
  564. fn: function (){
  565. var self=this;
  566. return smalltalk.withContext(function($ctx1) {
  567. var $1;
  568. $1=_st(_st(self["@code"])._element())._selectionEnd();
  569. return $1;
  570. }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{},smalltalk.HLCodeWidget)})},
  571. messageSends: ["selectionEnd", "element"]}),
  572. smalltalk.HLCodeWidget);
  573. smalltalk.addMethod(
  574. smalltalk.method({
  575. selector: "selectionEnd:",
  576. fn: function (anInteger){
  577. var self=this;
  578. return smalltalk.withContext(function($ctx1) {
  579. _st(_st(self["@code"])._element())._selectionEnd_(anInteger);
  580. return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger},smalltalk.HLCodeWidget)})},
  581. messageSends: ["selectionEnd:", "element"]}),
  582. smalltalk.HLCodeWidget);
  583. smalltalk.addMethod(
  584. smalltalk.method({
  585. selector: "selectionStart",
  586. fn: function (){
  587. var self=this;
  588. return smalltalk.withContext(function($ctx1) {
  589. var $1;
  590. $1=_st(_st(self["@code"])._element())._selectionStart();
  591. return $1;
  592. }, function($ctx1) {$ctx1.fill(self,"selectionStart",{},smalltalk.HLCodeWidget)})},
  593. messageSends: ["selectionStart", "element"]}),
  594. smalltalk.HLCodeWidget);
  595. smalltalk.addMethod(
  596. smalltalk.method({
  597. selector: "selectionStart:",
  598. fn: function (anInteger){
  599. var self=this;
  600. return smalltalk.withContext(function($ctx1) {
  601. _st(_st(self["@code"])._element())._selectionStart_(anInteger);
  602. return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger},smalltalk.HLCodeWidget)})},
  603. messageSends: ["selectionStart:", "element"]}),
  604. smalltalk.HLCodeWidget);
  605. smalltalk.addMethod(
  606. smalltalk.method({
  607. selector: "setEditorOn:",
  608. fn: function (aTextarea){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. self['@editor'] = CodeMirror.fromTextArea(aTextarea, self._editorOptions());
  612. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea},smalltalk.HLCodeWidget)})},
  613. messageSends: []}),
  614. smalltalk.HLCodeWidget);
  615. smalltalk.addMethod(
  616. smalltalk.method({
  617. selector: "updateState",
  618. fn: function (){
  619. var self=this;
  620. return smalltalk.withContext(function($ctx1) {
  621. var $1;
  622. $1=self._hasModification();
  623. if(smalltalk.assert($1)){
  624. _st(_st(self["@state"])._asJQuery())._addClass_("modified");
  625. } else {
  626. _st(_st(self["@state"])._asJQuery())._removeClass_("modified");
  627. };
  628. return self}, function($ctx1) {$ctx1.fill(self,"updateState",{},smalltalk.HLCodeWidget)})},
  629. messageSends: ["ifTrue:ifFalse:", "addClass:", "asJQuery", "removeClass:", "hasModification"]}),
  630. smalltalk.HLCodeWidget);
  631. smalltalk.addMethod(
  632. smalltalk.method({
  633. selector: "variableHintFor:token:",
  634. fn: function (anEditor,aToken){
  635. var self=this;
  636. var variables,classNames,pseudoVariables;
  637. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  638. return smalltalk.withContext(function($ctx1) {
  639. var $1;
  640. variables=_st(_st(_st(_st(window)._jQuery_(_st(_st(anEditor)._display())._wrapper()))._find_("span.cm-variable"))._get())._collect_((function(each){
  641. return smalltalk.withContext(function($ctx2) {
  642. return _st(_st(window)._jQuery_(each))._html();
  643. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  644. classNames=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
  645. return smalltalk.withContext(function($ctx2) {
  646. return _st(each)._name();
  647. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  648. pseudoVariables=_st(_st($Smalltalk())._current())._pseudoVariableNames();
  649. $1=_st(_st(_st(_st(_st(_st(variables).__comma(classNames)).__comma(pseudoVariables))._asSet())._asArray())._select_((function(each){
  650. return smalltalk.withContext(function($ctx2) {
  651. return _st(each)._includesSubString_(_st(aToken)._string());
  652. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._reject_((function(each){
  653. return smalltalk.withContext(function($ctx2) {
  654. return _st(each).__eq(_st(aToken)._string());
  655. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  656. return $1;
  657. }, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken,variables:variables,classNames:classNames,pseudoVariables:pseudoVariables},smalltalk.HLCodeWidget)})},
  658. messageSends: ["collect:", "html", "jQuery:", "get", "find:", "wrapper", "display", "name", "classes", "current", "pseudoVariableNames", "reject:", "=", "string", "select:", "includesSubString:", "asArray", "asSet", ","]}),
  659. smalltalk.HLCodeWidget);
  660. smalltalk.addMethod(
  661. smalltalk.method({
  662. selector: "hintFor:options:",
  663. fn: function (anEditor,options){
  664. var self=this;
  665. var cursor,token,completions;
  666. function $CodeMirror(){return smalltalk.CodeMirror||(typeof CodeMirror=="undefined"?nil:CodeMirror)}
  667. function $HLCodeWidget(){return smalltalk.HLCodeWidget||(typeof HLCodeWidget=="undefined"?nil:HLCodeWidget)}
  668. return smalltalk.withContext(function($ctx1) {
  669. var $1,$2;
  670. cursor=_st(anEditor)._getCursor();
  671. token=_st(anEditor)._getTokenAt_(cursor);
  672. _st(token)._at_put_("state",_st(_st(_st($CodeMirror())._basicAt_("innerMode"))._value_value_(_st(anEditor)._getMode(),_st(token)._at_("state")))._state());
  673. $1=_st(_st(token)._type()).__eq("variable");
  674. if(smalltalk.assert($1)){
  675. completions=_st($HLCodeWidget())._variableHintFor_token_(anEditor,token);
  676. } else {
  677. completions=_st($HLCodeWidget())._messageHintFor_token_(anEditor,token);
  678. };
  679. $2=smalltalk.HashedCollection._from_(["list".__minus_gt(completions),"from".__minus_gt(_st(_st($CodeMirror())._basicAt_("Pos"))._value_value_(_st(cursor)._line(),_st(token)._end())),"to".__minus_gt(_st(_st($CodeMirror())._basicAt_("Pos"))._value_value_(_st(cursor)._line(),_st(token)._start()))]);
  680. return $2;
  681. }, function($ctx1) {$ctx1.fill(self,"hintFor:options:",{anEditor:anEditor,options:options,cursor:cursor,token:token,completions:completions},smalltalk.HLCodeWidget.klass)})},
  682. messageSends: ["getCursor", "getTokenAt:", "at:put:", "state", "value:value:", "getMode", "at:", "basicAt:", "ifTrue:ifFalse:", "variableHintFor:token:", "messageHintFor:token:", "=", "type", "->", "line", "end", "start"]}),
  683. smalltalk.HLCodeWidget.klass);
  684. smalltalk.addMethod(
  685. smalltalk.method({
  686. selector: "initialize",
  687. fn: function (){
  688. var self=this;
  689. return smalltalk.withContext(function($ctx1) {
  690. var $1,$2;
  691. smalltalk.HLCodeWidget.klass.superclass.fn.prototype._initialize.apply(_st(self), []);
  692. $1=self;
  693. _st($1)._setupCodeMirror();
  694. _st($1)._setupCommands();
  695. $2=_st($1)._setupKeyMaps();
  696. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLCodeWidget.klass)})},
  697. messageSends: ["initialize", "setupCodeMirror", "setupCommands", "setupKeyMaps"]}),
  698. smalltalk.HLCodeWidget.klass);
  699. smalltalk.addMethod(
  700. smalltalk.method({
  701. selector: "keyMap",
  702. fn: function (){
  703. var self=this;
  704. function $HLManager(){return smalltalk.HLManager||(typeof HLManager=="undefined"?nil:HLManager)}
  705. return smalltalk.withContext(function($ctx1) {
  706. var $2,$1;
  707. $2=_st(_st(_st($HLManager())._current())._keyBinder())._systemIsMac();
  708. if(smalltalk.assert($2)){
  709. $1=self._macKeyMap();
  710. } else {
  711. $1=self._pcKeyMap();
  712. };
  713. return $1;
  714. }, function($ctx1) {$ctx1.fill(self,"keyMap",{},smalltalk.HLCodeWidget.klass)})},
  715. messageSends: ["ifTrue:ifFalse:", "macKeyMap", "pcKeyMap", "systemIsMac", "keyBinder", "current"]}),
  716. smalltalk.HLCodeWidget.klass);
  717. smalltalk.addMethod(
  718. smalltalk.method({
  719. selector: "macKeyMap",
  720. fn: function (){
  721. var self=this;
  722. return smalltalk.withContext(function($ctx1) {
  723. var $1;
  724. $1=smalltalk.HashedCollection._from_(["Alt-Backspace".__minus_gt("delWordBefore"),"Alt-Delete".__minus_gt("delWordAfter"),"Alt-Left".__minus_gt("goWordBoundaryLeft"),"Alt-Right".__minus_gt("goWordBoundaryRight"),"Cmd-A".__minus_gt("selectAll"),"Cmd-Alt-F".__minus_gt("replace"),"Cmd-D".__minus_gt("doIt"),"Cmd-Down".__minus_gt("goDocEnd"),"Cmd-End".__minus_gt("goDocEnd"),"Cmd-F".__minus_gt("find"),"Cmd-G".__minus_gt("findNext"),"Cmd-I".__minus_gt("inspectIt"),"Cmd-Left".__minus_gt("goLineStart"),"Cmd-P".__minus_gt("printIt"),"Cmd-Right".__minus_gt("goLineEnd"),"Cmd-S".__minus_gt("saveIt"),"Cmd-Up".__minus_gt("goDocStart"),"Cmd-Y".__minus_gt("redo"),"Cmd-Z".__minus_gt("undo"),"Cmd-[".__minus_gt("indentLess"),"Cmd-]".__minus_gt("indentMore"),"Ctrl-Alt-Backspace".__minus_gt("delWordAfter"),"Shift-Cmd-Alt-F".__minus_gt("replaceAll"),"Shift-Cmd-G".__minus_gt("findPrev"),"Shift-Cmd-Z".__minus_gt("redo"),"fallthrough".__minus_gt(["basic","emacsy"])]);
  725. return $1;
  726. }, function($ctx1) {$ctx1.fill(self,"macKeyMap",{},smalltalk.HLCodeWidget.klass)})},
  727. messageSends: ["->"]}),
  728. smalltalk.HLCodeWidget.klass);
  729. smalltalk.addMethod(
  730. smalltalk.method({
  731. selector: "messageHintFor:token:",
  732. fn: function (anEditor,aToken){
  733. var self=this;
  734. return smalltalk.withContext(function($ctx1) {
  735. var $1;
  736. $1=_st(_st(anEditor)._at_("amberCodeWidget"))._messageHintFor_token_(anEditor,aToken);
  737. return $1;
  738. }, function($ctx1) {$ctx1.fill(self,"messageHintFor:token:",{anEditor:anEditor,aToken:aToken},smalltalk.HLCodeWidget.klass)})},
  739. messageSends: ["messageHintFor:token:", "at:"]}),
  740. smalltalk.HLCodeWidget.klass);
  741. smalltalk.addMethod(
  742. smalltalk.method({
  743. selector: "pcKeyMap",
  744. fn: function (){
  745. var self=this;
  746. return smalltalk.withContext(function($ctx1) {
  747. var $1;
  748. $1=smalltalk.HashedCollection._from_(["Alt-Left".__minus_gt("goLineStart"),"Alt-Right".__minus_gt("goLineEnd"),"Alt-Up".__minus_gt("goDocStart"),"Ctrl-A".__minus_gt("selectAll"),"Ctrl-Backspace".__minus_gt("delWordBefore"),"Ctrl-D".__minus_gt("doIt"),"Ctrl-Delete".__minus_gt("delWordAfter"),"Ctrl-Down".__minus_gt("goDocEnd"),"Ctrl-End".__minus_gt("goDocEnd"),"Ctrl-F".__minus_gt("find"),"Ctrl-G".__minus_gt("findNext"),"Ctrl-I".__minus_gt("inspectIt"),"Ctrl-Home".__minus_gt("goDocStart"),"Ctrl-Left".__minus_gt("goWordBoundaryLeft"),"Ctrl-P".__minus_gt("printIt"),"Ctrl-Right".__minus_gt("goWordBoundaryRight"),"Ctrl-S".__minus_gt("saveIt"),"Ctrl-Y".__minus_gt("redo"),"Ctrl-Z".__minus_gt("undo"),"Ctrl-[".__minus_gt("indentLess"),"Ctrl-]".__minus_gt("indentMore"),"Shift-Ctrl-F".__minus_gt("replace"),"Shift-Ctrl-G".__minus_gt("findPrev"),"Shift-Ctrl-R".__minus_gt("replaceAll"),"Shift-Ctrl-Z".__minus_gt("redo"),"fallthrough".__minus_gt(["basic"])]);
  749. return $1;
  750. }, function($ctx1) {$ctx1.fill(self,"pcKeyMap",{},smalltalk.HLCodeWidget.klass)})},
  751. messageSends: ["->"]}),
  752. smalltalk.HLCodeWidget.klass);
  753. smalltalk.addMethod(
  754. smalltalk.method({
  755. selector: "setupCodeMirror",
  756. fn: function (){
  757. var self=this;
  758. return smalltalk.withContext(function($ctx1) {
  759. CodeMirror.keyMap.default.fallthrough = ["basic"];
  760. CodeMirror.commands.autocomplete = function(cm) {
  761. CodeMirror.showHint(cm, self._hintFor_options_);
  762. }
  763. ;
  764. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{},smalltalk.HLCodeWidget.klass)})},
  765. messageSends: []}),
  766. smalltalk.HLCodeWidget.klass);
  767. smalltalk.addMethod(
  768. smalltalk.method({
  769. selector: "setupCommands",
  770. fn: function (){
  771. var self=this;
  772. function $CodeMirror(){return smalltalk.CodeMirror||(typeof CodeMirror=="undefined"?nil:CodeMirror)}
  773. return smalltalk.withContext(function($ctx1) {
  774. var $1,$2;
  775. $1=_st($CodeMirror())._basicAt_("commands");
  776. _st($1)._at_put_("doIt",(function(cm){
  777. return smalltalk.withContext(function($ctx2) {
  778. return _st(_st(cm)._amberCodeWidget())._doIt();
  779. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  780. _st($1)._at_put_("inspectIt",(function(cm){
  781. return smalltalk.withContext(function($ctx2) {
  782. return _st(_st(cm)._amberCodeWidget())._inspectIt();
  783. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  784. _st($1)._at_put_("printIt",(function(cm){
  785. return smalltalk.withContext(function($ctx2) {
  786. return _st(_st(cm)._amberCodeWidget())._printIt();
  787. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  788. $2=_st($1)._at_put_("saveIt",(function(cm){
  789. return smalltalk.withContext(function($ctx2) {
  790. return _st(_st(cm)._amberCodeWidget())._saveIt();
  791. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  792. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{},smalltalk.HLCodeWidget.klass)})},
  793. messageSends: ["at:put:", "doIt", "amberCodeWidget", "basicAt:", "inspectIt", "printIt", "saveIt"]}),
  794. smalltalk.HLCodeWidget.klass);
  795. smalltalk.addMethod(
  796. smalltalk.method({
  797. selector: "setupKeyMaps",
  798. fn: function (){
  799. var self=this;
  800. return smalltalk.withContext(function($ctx1) {
  801. CodeMirror.keyMap['Amber'] = self._keyMap();
  802. return self}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{},smalltalk.HLCodeWidget.klass)})},
  803. messageSends: []}),
  804. smalltalk.HLCodeWidget.klass);
  805. smalltalk.addMethod(
  806. smalltalk.method({
  807. selector: "variableHintFor:token:",
  808. fn: function (anEditor,aToken){
  809. var self=this;
  810. return smalltalk.withContext(function($ctx1) {
  811. var $1;
  812. $1=_st(_st(anEditor)._at_("amberCodeWidget"))._variableHintFor_token_(anEditor,aToken);
  813. return $1;
  814. }, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken},smalltalk.HLCodeWidget.klass)})},
  815. messageSends: ["variableHintFor:token:", "at:"]}),
  816. smalltalk.HLCodeWidget.klass);
  817. smalltalk.addClass('HLNavigationCodeWidget', smalltalk.HLCodeWidget, ['methodContents'], 'Helios-Workspace');
  818. smalltalk.addMethod(
  819. smalltalk.method({
  820. selector: "configureEditor",
  821. fn: function (){
  822. var self=this;
  823. return smalltalk.withContext(function($ctx1) {
  824. smalltalk.HLNavigationCodeWidget.superclass.fn.prototype._configureEditor.apply(_st(self), []);
  825. self._contents_(self._methodContents());
  826. return self}, function($ctx1) {$ctx1.fill(self,"configureEditor",{},smalltalk.HLNavigationCodeWidget)})},
  827. messageSends: ["configureEditor", "contents:", "methodContents"]}),
  828. smalltalk.HLNavigationCodeWidget);
  829. smalltalk.addMethod(
  830. smalltalk.method({
  831. selector: "contents:",
  832. fn: function (aString){
  833. var self=this;
  834. return smalltalk.withContext(function($ctx1) {
  835. self._methodContents_(aString);
  836. smalltalk.HLNavigationCodeWidget.superclass.fn.prototype._contents_.apply(_st(self), [aString]);
  837. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString},smalltalk.HLNavigationCodeWidget)})},
  838. messageSends: ["methodContents:", "contents:"]}),
  839. smalltalk.HLNavigationCodeWidget);
  840. smalltalk.addMethod(
  841. smalltalk.method({
  842. selector: "hasModification",
  843. fn: function (){
  844. var self=this;
  845. return smalltalk.withContext(function($ctx1) {
  846. var $1;
  847. $1=_st(_st(self._methodContents()).__eq(self._contents()))._not();
  848. return $1;
  849. }, function($ctx1) {$ctx1.fill(self,"hasModification",{},smalltalk.HLNavigationCodeWidget)})},
  850. messageSends: ["not", "=", "contents", "methodContents"]}),
  851. smalltalk.HLNavigationCodeWidget);
  852. smalltalk.addMethod(
  853. smalltalk.method({
  854. selector: "methodContents",
  855. fn: function (){
  856. var self=this;
  857. return smalltalk.withContext(function($ctx1) {
  858. var $2,$1;
  859. $2=self["@methodContents"];
  860. if(($receiver = $2) == nil || $receiver == undefined){
  861. $1="";
  862. } else {
  863. $1=$2;
  864. };
  865. return $1;
  866. }, function($ctx1) {$ctx1.fill(self,"methodContents",{},smalltalk.HLNavigationCodeWidget)})},
  867. messageSends: ["ifNil:"]}),
  868. smalltalk.HLNavigationCodeWidget);
  869. smalltalk.addMethod(
  870. smalltalk.method({
  871. selector: "methodContents:",
  872. fn: function (aString){
  873. var self=this;
  874. return smalltalk.withContext(function($ctx1) {
  875. var $1;
  876. self["@methodContents"]=aString;
  877. $1=self["@methodContents"];
  878. return $1;
  879. }, function($ctx1) {$ctx1.fill(self,"methodContents:",{aString:aString},smalltalk.HLNavigationCodeWidget)})},
  880. messageSends: []}),
  881. smalltalk.HLNavigationCodeWidget);
  882. smalltalk.addMethod(
  883. smalltalk.method({
  884. selector: "previous",
  885. fn: function (){
  886. var self=this;
  887. return smalltalk.withContext(function($ctx1) {
  888. return self}, function($ctx1) {$ctx1.fill(self,"previous",{},smalltalk.HLNavigationCodeWidget)})},
  889. messageSends: []}),
  890. smalltalk.HLNavigationCodeWidget);
  891. smalltalk.addMethod(
  892. smalltalk.method({
  893. selector: "previous:",
  894. fn: function (aWidget){
  895. var self=this;
  896. return smalltalk.withContext(function($ctx1) {
  897. return self}, function($ctx1) {$ctx1.fill(self,"previous:",{aWidget:aWidget},smalltalk.HLNavigationCodeWidget)})},
  898. messageSends: []}),
  899. smalltalk.HLNavigationCodeWidget);
  900. smalltalk.addMethod(
  901. smalltalk.method({
  902. selector: "canBeOpenAsTab",
  903. fn: function (){
  904. var self=this;
  905. return smalltalk.withContext(function($ctx1) {
  906. return false;
  907. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{},smalltalk.HLNavigationCodeWidget.klass)})},
  908. messageSends: []}),
  909. smalltalk.HLNavigationCodeWidget.klass);
  910. smalltalk.addMethod(
  911. smalltalk.method({
  912. selector: "on:",
  913. fn: function (aBrowserModel){
  914. var self=this;
  915. return smalltalk.withContext(function($ctx1) {
  916. var $2,$3,$1;
  917. $2=self._new();
  918. _st($2)._browserModel_(aBrowserModel);
  919. $3=_st($2)._yourself();
  920. $1=$3;
  921. return $1;
  922. }, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel},smalltalk.HLNavigationCodeWidget.klass)})},
  923. messageSends: ["browserModel:", "new", "yourself"]}),
  924. smalltalk.HLNavigationCodeWidget.klass);
  925. smalltalk.addClass('HLBrowserCodeWidget', smalltalk.HLNavigationCodeWidget, ['browserModel'], 'Helios-Workspace');
  926. smalltalk.addMethod(
  927. smalltalk.method({
  928. selector: "browserModel",
  929. fn: function (){
  930. var self=this;
  931. return smalltalk.withContext(function($ctx1) {
  932. var $1;
  933. $1=self["@browserModel"];
  934. return $1;
  935. }, function($ctx1) {$ctx1.fill(self,"browserModel",{},smalltalk.HLBrowserCodeWidget)})},
  936. messageSends: []}),
  937. smalltalk.HLBrowserCodeWidget);
  938. smalltalk.addMethod(
  939. smalltalk.method({
  940. selector: "browserModel:",
  941. fn: function (aBrowserModel){
  942. var self=this;
  943. return smalltalk.withContext(function($ctx1) {
  944. var $1,$2;
  945. self["@browserModel"]=aBrowserModel;
  946. $1=self;
  947. _st($1)._observeSystem();
  948. $2=_st($1)._observeBrowserModel();
  949. return self}, function($ctx1) {$ctx1.fill(self,"browserModel:",{aBrowserModel:aBrowserModel},smalltalk.HLBrowserCodeWidget)})},
  950. messageSends: ["observeSystem", "observeBrowserModel"]}),
  951. smalltalk.HLBrowserCodeWidget);
  952. smalltalk.addMethod(
  953. smalltalk.method({
  954. selector: "observeBrowserModel",
  955. fn: function (){
  956. var self=this;
  957. function $HLSaveSourceCode(){return smalltalk.HLSaveSourceCode||(typeof HLSaveSourceCode=="undefined"?nil:HLSaveSourceCode)}
  958. function $HLShowInstanceToggled(){return smalltalk.HLShowInstanceToggled||(typeof HLShowInstanceToggled=="undefined"?nil:HLShowInstanceToggled)}
  959. function $HLSourceCodeSaved(){return smalltalk.HLSourceCodeSaved||(typeof HLSourceCodeSaved=="undefined"?nil:HLSourceCodeSaved)}
  960. function $HLAboutToChange(){return smalltalk.HLAboutToChange||(typeof HLAboutToChange=="undefined"?nil:HLAboutToChange)}
  961. function $HLParseErrorRaised(){return smalltalk.HLParseErrorRaised||(typeof HLParseErrorRaised=="undefined"?nil:HLParseErrorRaised)}
  962. function $HLCompileErrorRaised(){return smalltalk.HLCompileErrorRaised||(typeof HLCompileErrorRaised=="undefined"?nil:HLCompileErrorRaised)}
  963. function $HLUnknownVariableErrorRaised(){return smalltalk.HLUnknownVariableErrorRaised||(typeof HLUnknownVariableErrorRaised=="undefined"?nil:HLUnknownVariableErrorRaised)}
  964. function $HLInstVarAdded(){return smalltalk.HLInstVarAdded||(typeof HLInstVarAdded=="undefined"?nil:HLInstVarAdded)}
  965. function $HLMethodSelected(){return smalltalk.HLMethodSelected||(typeof HLMethodSelected=="undefined"?nil:HLMethodSelected)}
  966. function $HLClassSelected(){return smalltalk.HLClassSelected||(typeof HLClassSelected=="undefined"?nil:HLClassSelected)}
  967. function $HLProtocolSelected(){return smalltalk.HLProtocolSelected||(typeof HLProtocolSelected=="undefined"?nil:HLProtocolSelected)}
  968. function $HLSourceCodeFocusRequested(){return smalltalk.HLSourceCodeFocusRequested||(typeof HLSourceCodeFocusRequested=="undefined"?nil:HLSourceCodeFocusRequested)}
  969. return smalltalk.withContext(function($ctx1) {
  970. var $1,$2;
  971. $1=_st(self._browserModel())._announcer();
  972. _st($1)._on_send_to_($HLSaveSourceCode(),"onSaveIt",self);
  973. _st($1)._on_send_to_($HLShowInstanceToggled(),"onShowInstanceToggled",self);
  974. _st($1)._on_send_to_($HLSourceCodeSaved(),"onSourceCodeSaved",self);
  975. _st($1)._on_send_to_($HLAboutToChange(),"onBrowserAboutToChange:",self);
  976. _st($1)._on_send_to_($HLParseErrorRaised(),"onParseError:",self);
  977. _st($1)._on_send_to_($HLCompileErrorRaised(),"onCompileError:",self);
  978. _st($1)._on_send_to_($HLUnknownVariableErrorRaised(),"onUnknownVariableError:",self);
  979. _st($1)._on_send_to_($HLInstVarAdded(),"onInstVarAdded",self);
  980. _st($1)._on_send_to_($HLMethodSelected(),"onMethodSelected:",self);
  981. _st($1)._on_send_to_($HLClassSelected(),"onClassSelected:",self);
  982. _st($1)._on_send_to_($HLProtocolSelected(),"onProtocolSelected:",self);
  983. $2=_st($1)._on_send_to_($HLSourceCodeFocusRequested(),"onSourceCodeFocusRequested",self);
  984. return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{},smalltalk.HLBrowserCodeWidget)})},
  985. messageSends: ["on:send:to:", "announcer", "browserModel"]}),
  986. smalltalk.HLBrowserCodeWidget);
  987. smalltalk.addMethod(
  988. smalltalk.method({
  989. selector: "observeSystem",
  990. fn: function (){
  991. var self=this;
  992. function $MethodModified(){return smalltalk.MethodModified||(typeof MethodModified=="undefined"?nil:MethodModified)}
  993. return smalltalk.withContext(function($ctx1) {
  994. _st(_st(self._browserModel())._systemAnnouncer())._on_send_to_($MethodModified(),"onMethodModified:",self);
  995. return self}, function($ctx1) {$ctx1.fill(self,"observeSystem",{},smalltalk.HLBrowserCodeWidget)})},
  996. messageSends: ["on:send:to:", "systemAnnouncer", "browserModel"]}),
  997. smalltalk.HLBrowserCodeWidget);
  998. smalltalk.addMethod(
  999. smalltalk.method({
  1000. selector: "onBrowserAboutToChange:",
  1001. fn: function (anAnnouncement){
  1002. var self=this;
  1003. var block;
  1004. function $HLChangeForbidden(){return smalltalk.HLChangeForbidden||(typeof HLChangeForbidden=="undefined"?nil:HLChangeForbidden)}
  1005. return smalltalk.withContext(function($ctx1) {
  1006. var $1;
  1007. block=_st(anAnnouncement)._actionBlock();
  1008. $1=self._hasModification();
  1009. if(smalltalk.assert($1)){
  1010. self._confirm_ifTrue_("Changes have not been saved. Do you want to discard these changes?",(function(){
  1011. return smalltalk.withContext(function($ctx2) {
  1012. self._methodContents_(self._contents());
  1013. return _st(block)._value();
  1014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1015. _st($HLChangeForbidden())._signal();
  1016. };
  1017. return self}, function($ctx1) {$ctx1.fill(self,"onBrowserAboutToChange:",{anAnnouncement:anAnnouncement,block:block},smalltalk.HLBrowserCodeWidget)})},
  1018. messageSends: ["actionBlock", "ifTrue:", "confirm:ifTrue:", "methodContents:", "contents", "value", "signal", "hasModification"]}),
  1019. smalltalk.HLBrowserCodeWidget);
  1020. smalltalk.addMethod(
  1021. smalltalk.method({
  1022. selector: "onClassSelected:",
  1023. fn: function (anAnnouncement){
  1024. var self=this;
  1025. var class_;
  1026. return smalltalk.withContext(function($ctx1) {
  1027. var $1,$2;
  1028. class_=_st(anAnnouncement)._item();
  1029. $1=class_;
  1030. if(($receiver = $1) == nil || $receiver == undefined){
  1031. $2=self._contents_("");
  1032. return $2;
  1033. } else {
  1034. $1;
  1035. };
  1036. self._contents_(_st(class_)._definition());
  1037. return self}, function($ctx1) {$ctx1.fill(self,"onClassSelected:",{anAnnouncement:anAnnouncement,class_:class_},smalltalk.HLBrowserCodeWidget)})},
  1038. messageSends: ["item", "ifNil:", "contents:", "definition"]}),
  1039. smalltalk.HLBrowserCodeWidget);
  1040. smalltalk.addMethod(
  1041. smalltalk.method({
  1042. selector: "onCompileError:",
  1043. fn: function (anAnnouncement){
  1044. var self=this;
  1045. return smalltalk.withContext(function($ctx1) {
  1046. self._alert_(_st(_st(anAnnouncement)._error())._messageText());
  1047. return self}, function($ctx1) {$ctx1.fill(self,"onCompileError:",{anAnnouncement:anAnnouncement},smalltalk.HLBrowserCodeWidget)})},
  1048. messageSends: ["alert:", "messageText", "error"]}),
  1049. smalltalk.HLBrowserCodeWidget);
  1050. smalltalk.addMethod(
  1051. smalltalk.method({
  1052. selector: "onInstVarAdded",
  1053. fn: function (){
  1054. var self=this;
  1055. return smalltalk.withContext(function($ctx1) {
  1056. _st(self._browserModel())._save_(self._contents());
  1057. return self}, function($ctx1) {$ctx1.fill(self,"onInstVarAdded",{},smalltalk.HLBrowserCodeWidget)})},
  1058. messageSends: ["save:", "contents", "browserModel"]}),
  1059. smalltalk.HLBrowserCodeWidget);
  1060. smalltalk.addMethod(
  1061. smalltalk.method({
  1062. selector: "onMethodModified:",
  1063. fn: function (anAnnouncement){
  1064. var self=this;
  1065. var method;
  1066. return smalltalk.withContext(function($ctx1) {
  1067. var $1,$2,$3,$4,$5,$6;
  1068. method=_st(anAnnouncement)._method();
  1069. $1=_st(_st(self._browserModel())._selectedClass()).__eq(_st(method)._methodClass());
  1070. if(! smalltalk.assert($1)){
  1071. $2=self;
  1072. return $2;
  1073. };
  1074. $3=_st(self._browserModel())._selectedMethod();
  1075. if(($receiver = $3) == nil || $receiver == undefined){
  1076. $4=self;
  1077. return $4;
  1078. } else {
  1079. $3;
  1080. };
  1081. $5=_st(_st(_st(self._browserModel())._selectedMethod())._selector()).__eq(_st(method)._selector());
  1082. if(! smalltalk.assert($5)){
  1083. $6=self;
  1084. return $6;
  1085. };
  1086. self._refresh();
  1087. return self}, function($ctx1) {$ctx1.fill(self,"onMethodModified:",{anAnnouncement:anAnnouncement,method:method},smalltalk.HLBrowserCodeWidget)})},
  1088. messageSends: ["method", "ifFalse:", "=", "methodClass", "selectedClass", "browserModel", "ifNil:", "selectedMethod", "selector", "refresh"]}),
  1089. smalltalk.HLBrowserCodeWidget);
  1090. smalltalk.addMethod(
  1091. smalltalk.method({
  1092. selector: "onMethodSelected:",
  1093. fn: function (anAnnouncement){
  1094. var self=this;
  1095. var method;
  1096. return smalltalk.withContext(function($ctx1) {
  1097. var $1,$2;
  1098. method=_st(anAnnouncement)._item();
  1099. $1=method;
  1100. if(($receiver = $1) == nil || $receiver == undefined){
  1101. $2=self._contents_("");
  1102. return $2;
  1103. } else {
  1104. $1;
  1105. };
  1106. self._contents_(_st(method)._source());
  1107. return self}, function($ctx1) {$ctx1.fill(self,"onMethodSelected:",{anAnnouncement:anAnnouncement,method:method},smalltalk.HLBrowserCodeWidget)})},
  1108. messageSends: ["item", "ifNil:", "contents:", "source"]}),
  1109. smalltalk.HLBrowserCodeWidget);
  1110. smalltalk.addMethod(
  1111. smalltalk.method({
  1112. selector: "onParseError:",
  1113. fn: function (anAnnouncement){
  1114. var self=this;
  1115. var lineIndex,newContents;
  1116. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1117. return smalltalk.withContext(function($ctx1) {
  1118. var $1,$2,$3;
  1119. lineIndex=(1);
  1120. self._contents_(_st($String())._streamContents_((function(stream){
  1121. return smalltalk.withContext(function($ctx2) {
  1122. return _st(self._contents())._linesDo_((function(each){
  1123. return smalltalk.withContext(function($ctx3) {
  1124. $1=_st(lineIndex).__eq(_st(anAnnouncement)._line());
  1125. if(smalltalk.assert($1)){
  1126. $2=stream;
  1127. _st($2)._nextPutAll_(_st(each)._copyFrom_to_((1),_st(anAnnouncement)._column()));
  1128. _st($2)._nextPutAll_("<- ");
  1129. _st($2)._nextPutAll_(_st(anAnnouncement)._message());
  1130. _st($2)._nextPutAll_(" ");
  1131. $3=_st($2)._nextPutAll_(_st(each)._copyFrom_to_(_st(_st(anAnnouncement)._column()).__plus((1)),_st(each)._size()));
  1132. $3;
  1133. } else {
  1134. _st(stream)._nextPutAll_(each);
  1135. };
  1136. _st(stream)._nextPutAll_(_st($String())._cr());
  1137. lineIndex=_st(lineIndex).__plus((1));
  1138. return lineIndex;
  1139. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  1140. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  1141. return self}, function($ctx1) {$ctx1.fill(self,"onParseError:",{anAnnouncement:anAnnouncement,lineIndex:lineIndex,newContents:newContents},smalltalk.HLBrowserCodeWidget)})},
  1142. messageSends: ["contents:", "streamContents:", "linesDo:", "ifTrue:ifFalse:", "nextPutAll:", "copyFrom:to:", "column", "message", "+", "size", "=", "line", "cr", "contents"]}),
  1143. smalltalk.HLBrowserCodeWidget);
  1144. smalltalk.addMethod(
  1145. smalltalk.method({
  1146. selector: "onProtocolSelected:",
  1147. fn: function (anAnnouncement){
  1148. var self=this;
  1149. return smalltalk.withContext(function($ctx1) {
  1150. var $1,$2;
  1151. $1=_st(self._browserModel())._selectedClass();
  1152. if(($receiver = $1) == nil || $receiver == undefined){
  1153. $2=self._contents_("");
  1154. return $2;
  1155. } else {
  1156. $1;
  1157. };
  1158. self._contents_(_st(_st(self._browserModel())._selectedClass())._definition());
  1159. return self}, function($ctx1) {$ctx1.fill(self,"onProtocolSelected:",{anAnnouncement:anAnnouncement},smalltalk.HLBrowserCodeWidget)})},
  1160. messageSends: ["ifNil:", "contents:", "selectedClass", "browserModel", "definition"]}),
  1161. smalltalk.HLBrowserCodeWidget);
  1162. smalltalk.addMethod(
  1163. smalltalk.method({
  1164. selector: "onSaveIt",
  1165. fn: function (){
  1166. var self=this;
  1167. return smalltalk.withContext(function($ctx1) {
  1168. _st(self._browserModel())._save_(self._contents());
  1169. return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{},smalltalk.HLBrowserCodeWidget)})},
  1170. messageSends: ["save:", "contents", "browserModel"]}),
  1171. smalltalk.HLBrowserCodeWidget);
  1172. smalltalk.addMethod(
  1173. smalltalk.method({
  1174. selector: "onShowInstanceToggled",
  1175. fn: function (){
  1176. var self=this;
  1177. return smalltalk.withContext(function($ctx1) {
  1178. var $1,$2;
  1179. $1=_st(self._browserModel())._selectedClass();
  1180. if(($receiver = $1) == nil || $receiver == undefined){
  1181. $2=self._contents_("");
  1182. return $2;
  1183. } else {
  1184. $1;
  1185. };
  1186. self._contents_(_st(_st(self._browserModel())._selectedClass())._definition());
  1187. return self}, function($ctx1) {$ctx1.fill(self,"onShowInstanceToggled",{},smalltalk.HLBrowserCodeWidget)})},
  1188. messageSends: ["ifNil:", "contents:", "selectedClass", "browserModel", "definition"]}),
  1189. smalltalk.HLBrowserCodeWidget);
  1190. smalltalk.addMethod(
  1191. smalltalk.method({
  1192. selector: "onSourceCodeFocusRequested",
  1193. fn: function (){
  1194. var self=this;
  1195. return smalltalk.withContext(function($ctx1) {
  1196. self._focus();
  1197. return self}, function($ctx1) {$ctx1.fill(self,"onSourceCodeFocusRequested",{},smalltalk.HLBrowserCodeWidget)})},
  1198. messageSends: ["focus"]}),
  1199. smalltalk.HLBrowserCodeWidget);
  1200. smalltalk.addMethod(
  1201. smalltalk.method({
  1202. selector: "onSourceCodeSaved",
  1203. fn: function (){
  1204. var self=this;
  1205. return smalltalk.withContext(function($ctx1) {
  1206. self._methodContents_(self._contents());
  1207. self._updateState();
  1208. return self}, function($ctx1) {$ctx1.fill(self,"onSourceCodeSaved",{},smalltalk.HLBrowserCodeWidget)})},
  1209. messageSends: ["methodContents:", "contents", "updateState"]}),
  1210. smalltalk.HLBrowserCodeWidget);
  1211. smalltalk.addMethod(
  1212. smalltalk.method({
  1213. selector: "onUnknownVariableError:",
  1214. fn: function (anAnnouncement){
  1215. var self=this;
  1216. var error;
  1217. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  1218. return smalltalk.withContext(function($ctx1) {
  1219. var $1,$2;
  1220. error=_st(anAnnouncement)._error();
  1221. self._confirm_ifTrue_(_st($String())._streamContents_((function(stream){
  1222. return smalltalk.withContext(function($ctx2) {
  1223. $1=stream;
  1224. _st($1)._nextPutAll_(_st(error)._messageText());
  1225. _st($1)._nextPutAll_(_st($String())._cr());
  1226. $2=_st($1)._nextPutAll_("Would you like to define an instance variable?");
  1227. return $2;
  1228. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})),(function(){
  1229. return smalltalk.withContext(function($ctx2) {
  1230. return _st(self._browserModel())._addInstVarNamed_(_st(error)._variableName());
  1231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1232. return self}, function($ctx1) {$ctx1.fill(self,"onUnknownVariableError:",{anAnnouncement:anAnnouncement,error:error},smalltalk.HLBrowserCodeWidget)})},
  1233. messageSends: ["error", "confirm:ifTrue:", "streamContents:", "nextPutAll:", "messageText", "cr", "addInstVarNamed:", "variableName", "browserModel"]}),
  1234. smalltalk.HLBrowserCodeWidget);
  1235. smalltalk.addMethod(
  1236. smalltalk.method({
  1237. selector: "refresh",
  1238. fn: function (){
  1239. var self=this;
  1240. return smalltalk.withContext(function($ctx1) {
  1241. var $1,$2,$3,$4;
  1242. $1=self._hasModification();
  1243. if(smalltalk.assert($1)){
  1244. $2=self;
  1245. return $2;
  1246. };
  1247. $3=self._hasFocus();
  1248. if(smalltalk.assert($3)){
  1249. $4=self;
  1250. return $4;
  1251. };
  1252. self._contents_(_st(_st(self._browserModel())._selectedMethod())._source());
  1253. return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},smalltalk.HLBrowserCodeWidget)})},
  1254. messageSends: ["ifTrue:", "hasModification", "hasFocus", "contents:", "source", "selectedMethod", "browserModel"]}),
  1255. smalltalk.HLBrowserCodeWidget);
  1256. smalltalk.addMethod(
  1257. smalltalk.method({
  1258. selector: "renderButtonsOn:",
  1259. fn: function (html){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) {
  1262. var $1,$2;
  1263. $1=_st(html)._button();
  1264. _st($1)._class_("button");
  1265. _st($1)._with_("SaveIt");
  1266. $2=_st($1)._onClick_((function(){
  1267. return smalltalk.withContext(function($ctx2) {
  1268. return self._saveIt();
  1269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1270. smalltalk.HLBrowserCodeWidget.superclass.fn.prototype._renderButtonsOn_.apply(_st(self), [html]);
  1271. return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},smalltalk.HLBrowserCodeWidget)})},
  1272. messageSends: ["class:", "button", "with:", "onClick:", "saveIt", "renderButtonsOn:"]}),
  1273. smalltalk.HLBrowserCodeWidget);
  1274. smalltalk.addMethod(
  1275. smalltalk.method({
  1276. selector: "saveIt",
  1277. fn: function (){
  1278. var self=this;
  1279. return smalltalk.withContext(function($ctx1) {
  1280. _st(self._browserModel())._saveSourceCode();
  1281. return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{},smalltalk.HLBrowserCodeWidget)})},
  1282. messageSends: ["saveSourceCode", "browserModel"]}),
  1283. smalltalk.HLBrowserCodeWidget);
  1284. smalltalk.addMethod(
  1285. smalltalk.method({
  1286. selector: "unregister",
  1287. fn: function (){
  1288. var self=this;
  1289. return smalltalk.withContext(function($ctx1) {
  1290. smalltalk.HLBrowserCodeWidget.superclass.fn.prototype._unregsiter.apply(_st(self), []);
  1291. _st(_st(self._browserModel())._announcer())._unsubscribe_(self);
  1292. _st(_st(self._browserModel())._systemAnnouncer())._unsubscribe_(self);
  1293. return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},smalltalk.HLBrowserCodeWidget)})},
  1294. messageSends: ["unregsiter", "unsubscribe:", "announcer", "browserModel", "systemAnnouncer"]}),
  1295. smalltalk.HLBrowserCodeWidget);
  1296. smalltalk.addMethod(
  1297. smalltalk.method({
  1298. selector: "canBeOpenAsTab",
  1299. fn: function (){
  1300. var self=this;
  1301. return smalltalk.withContext(function($ctx1) {
  1302. return false;
  1303. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{},smalltalk.HLBrowserCodeWidget.klass)})},
  1304. messageSends: []}),
  1305. smalltalk.HLBrowserCodeWidget.klass);
  1306. smalltalk.addMethod(
  1307. smalltalk.method({
  1308. selector: "on:",
  1309. fn: function (aBrowserModel){
  1310. var self=this;
  1311. return smalltalk.withContext(function($ctx1) {
  1312. var $2,$3,$1;
  1313. $2=self._new();
  1314. _st($2)._browserModel_(aBrowserModel);
  1315. $3=_st($2)._yourself();
  1316. $1=$3;
  1317. return $1;
  1318. }, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel},smalltalk.HLBrowserCodeWidget.klass)})},
  1319. messageSends: ["browserModel:", "new", "yourself"]}),
  1320. smalltalk.HLBrowserCodeWidget.klass);
  1321. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['codeWidget', 'transcript'], 'Helios-Workspace');
  1322. smalltalk.addMethod(
  1323. smalltalk.method({
  1324. selector: "canHaveFocus",
  1325. fn: function (){
  1326. var self=this;
  1327. return smalltalk.withContext(function($ctx1) {
  1328. return true;
  1329. }, function($ctx1) {$ctx1.fill(self,"canHaveFocus",{},smalltalk.HLWorkspace)})},
  1330. messageSends: []}),
  1331. smalltalk.HLWorkspace);
  1332. smalltalk.addMethod(
  1333. smalltalk.method({
  1334. selector: "codeWidget",
  1335. fn: function (){
  1336. var self=this;
  1337. function $HLCodeWidget(){return smalltalk.HLCodeWidget||(typeof HLCodeWidget=="undefined"?nil:HLCodeWidget)}
  1338. return smalltalk.withContext(function($ctx1) {
  1339. var $2,$1;
  1340. $2=self["@codeWidget"];
  1341. if(($receiver = $2) == nil || $receiver == undefined){
  1342. self["@codeWidget"]=_st($HLCodeWidget())._new();
  1343. $1=self["@codeWidget"];
  1344. } else {
  1345. $1=$2;
  1346. };
  1347. return $1;
  1348. }, function($ctx1) {$ctx1.fill(self,"codeWidget",{},smalltalk.HLWorkspace)})},
  1349. messageSends: ["ifNil:", "new"]}),
  1350. smalltalk.HLWorkspace);
  1351. smalltalk.addMethod(
  1352. smalltalk.method({
  1353. selector: "focus",
  1354. fn: function (){
  1355. var self=this;
  1356. return smalltalk.withContext(function($ctx1) {
  1357. var $1;
  1358. $1=_st(self._codeWidget())._focus();
  1359. return $1;
  1360. }, function($ctx1) {$ctx1.fill(self,"focus",{},smalltalk.HLWorkspace)})},
  1361. messageSends: ["focus", "codeWidget"]}),
  1362. smalltalk.HLWorkspace);
  1363. smalltalk.addMethod(
  1364. smalltalk.method({
  1365. selector: "renderContentOn:",
  1366. fn: function (html){
  1367. var self=this;
  1368. function $HLHorizontalSplitter(){return smalltalk.HLHorizontalSplitter||(typeof HLHorizontalSplitter=="undefined"?nil:HLHorizontalSplitter)}
  1369. function $HLContainer(){return smalltalk.HLContainer||(typeof HLContainer=="undefined"?nil:HLContainer)}
  1370. return smalltalk.withContext(function($ctx1) {
  1371. _st(html)._with_(_st($HLContainer())._with_(_st($HLHorizontalSplitter())._with_with_(self._codeWidget(),(function(canvas){
  1372. return smalltalk.withContext(function($ctx2) {
  1373. return self._renderTranscriptOn_(canvas);
  1374. }, function($ctx2) {$ctx2.fillBlock({canvas:canvas},$ctx1)})}))));
  1375. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html},smalltalk.HLWorkspace)})},
  1376. messageSends: ["with:", "with:with:", "codeWidget", "renderTranscriptOn:"]}),
  1377. smalltalk.HLWorkspace);
  1378. smalltalk.addMethod(
  1379. smalltalk.method({
  1380. selector: "renderTranscriptOn:",
  1381. fn: function (html){
  1382. var self=this;
  1383. return smalltalk.withContext(function($ctx1) {
  1384. var $1,$3,$4,$2;
  1385. $1=_st(html)._div();
  1386. _st($1)._class_("transcript-container");
  1387. $2=_st($1)._with_((function(){
  1388. return smalltalk.withContext(function($ctx2) {
  1389. $3=_st(html)._div();
  1390. _st($3)._class_("list-label");
  1391. $4=_st($3)._with_("Transcript");
  1392. $4;
  1393. return _st(self._transcript())._renderOn_(html);
  1394. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1395. return self}, function($ctx1) {$ctx1.fill(self,"renderTranscriptOn:",{html:html},smalltalk.HLWorkspace)})},
  1396. messageSends: ["class:", "div", "with:", "renderOn:", "transcript"]}),
  1397. smalltalk.HLWorkspace);
  1398. smalltalk.addMethod(
  1399. smalltalk.method({
  1400. selector: "transcript",
  1401. fn: function (){
  1402. var self=this;
  1403. function $HLTranscript(){return smalltalk.HLTranscript||(typeof HLTranscript=="undefined"?nil:HLTranscript)}
  1404. return smalltalk.withContext(function($ctx1) {
  1405. var $2,$1;
  1406. $2=self["@transcript"];
  1407. if(($receiver = $2) == nil || $receiver == undefined){
  1408. self["@transcript"]=_st($HLTranscript())._new();
  1409. $1=self["@transcript"];
  1410. } else {
  1411. $1=$2;
  1412. };
  1413. return $1;
  1414. }, function($ctx1) {$ctx1.fill(self,"transcript",{},smalltalk.HLWorkspace)})},
  1415. messageSends: ["ifNil:", "new"]}),
  1416. smalltalk.HLWorkspace);
  1417. smalltalk.addMethod(
  1418. smalltalk.method({
  1419. selector: "unregister",
  1420. fn: function (){
  1421. var self=this;
  1422. return smalltalk.withContext(function($ctx1) {
  1423. smalltalk.HLWorkspace.superclass.fn.prototype._unregister.apply(_st(self), []);
  1424. _st(self._transcript())._unregister();
  1425. return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},smalltalk.HLWorkspace)})},
  1426. messageSends: ["unregister", "transcript"]}),
  1427. smalltalk.HLWorkspace);
  1428. smalltalk.addMethod(
  1429. smalltalk.method({
  1430. selector: "canBeOpenAsTab",
  1431. fn: function (){
  1432. var self=this;
  1433. return smalltalk.withContext(function($ctx1) {
  1434. return true;
  1435. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{},smalltalk.HLWorkspace.klass)})},
  1436. messageSends: []}),
  1437. smalltalk.HLWorkspace.klass);
  1438. smalltalk.addMethod(
  1439. smalltalk.method({
  1440. selector: "tabClass",
  1441. fn: function (){
  1442. var self=this;
  1443. return smalltalk.withContext(function($ctx1) {
  1444. return "workspace";
  1445. }, function($ctx1) {$ctx1.fill(self,"tabClass",{},smalltalk.HLWorkspace.klass)})},
  1446. messageSends: []}),
  1447. smalltalk.HLWorkspace.klass);
  1448. smalltalk.addMethod(
  1449. smalltalk.method({
  1450. selector: "tabLabel",
  1451. fn: function (){
  1452. var self=this;
  1453. return smalltalk.withContext(function($ctx1) {
  1454. return "Workspace";
  1455. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{},smalltalk.HLWorkspace.klass)})},
  1456. messageSends: []}),
  1457. smalltalk.HLWorkspace.klass);
  1458. smalltalk.addMethod(
  1459. smalltalk.method({
  1460. selector: "tabPriority",
  1461. fn: function (){
  1462. var self=this;
  1463. return smalltalk.withContext(function($ctx1) {
  1464. return (10);
  1465. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{},smalltalk.HLWorkspace.klass)})},
  1466. messageSends: []}),
  1467. smalltalk.HLWorkspace.klass);
  1468. });