Helios-Workspace.js 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336
  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. category: 'accessing',
  8. fn: function (){
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) { var $2,$1;
  11. $2=self["@announcer"];
  12. if(($receiver = $2) == nil || $receiver == undefined){
  13. self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
  14. $1=self["@announcer"];
  15. } else {
  16. $1=$2;
  17. };
  18. return $1;
  19. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLCodeModel)})},
  20. args: [],
  21. source: "announcer\x0a\x09^ announcer ifNil: [ announcer := Announcer new ]",
  22. messageSends: ["ifNil:", "new"],
  23. referencedClasses: ["Announcer"]
  24. }),
  25. smalltalk.HLCodeModel);
  26. smalltalk.addMethod(
  27. "_defaultReceiver",
  28. smalltalk.method({
  29. selector: "defaultReceiver",
  30. category: 'defaults',
  31. fn: function (){
  32. var self=this;
  33. return smalltalk.withContext(function($ctx1) { var $1;
  34. $1=_st((smalltalk.DoIt || DoIt))._new();
  35. return $1;
  36. }, function($ctx1) {$ctx1.fill(self,"defaultReceiver",{}, smalltalk.HLCodeModel)})},
  37. args: [],
  38. source: "defaultReceiver\x0a\x09^ DoIt new",
  39. messageSends: ["new"],
  40. referencedClasses: ["DoIt"]
  41. }),
  42. smalltalk.HLCodeModel);
  43. smalltalk.addMethod(
  44. "_doIt_",
  45. smalltalk.method({
  46. selector: "doIt:",
  47. category: 'actions',
  48. fn: function (someCode){
  49. var self=this;
  50. return smalltalk.withContext(function($ctx1) { var $1;
  51. $1=_st(_st(self)._environment())._eval_on_(someCode,_st(self)._receiver());
  52. return $1;
  53. }, function($ctx1) {$ctx1.fill(self,"doIt:",{someCode:someCode}, smalltalk.HLCodeModel)})},
  54. args: ["someCode"],
  55. source: "doIt: someCode\x0a\x0a\x09^ self environment eval: someCode on: self receiver",
  56. messageSends: ["eval:on:", "receiver", "environment"],
  57. referencedClasses: []
  58. }),
  59. smalltalk.HLCodeModel);
  60. smalltalk.addMethod(
  61. "_environment",
  62. smalltalk.method({
  63. selector: "environment",
  64. category: 'accessing',
  65. fn: function (){
  66. var self=this;
  67. return smalltalk.withContext(function($ctx1) { var $2,$1;
  68. $2=self["@environment"];
  69. if(($receiver = $2) == nil || $receiver == undefined){
  70. $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
  71. } else {
  72. $1=$2;
  73. };
  74. return $1;
  75. }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLCodeModel)})},
  76. args: [],
  77. source: "environment\x0a\x09^ environment ifNil: [ HLManager current environment ]",
  78. messageSends: ["ifNil:", "environment", "current"],
  79. referencedClasses: ["HLManager"]
  80. }),
  81. smalltalk.HLCodeModel);
  82. smalltalk.addMethod(
  83. "_environment_",
  84. smalltalk.method({
  85. selector: "environment:",
  86. category: 'accessing',
  87. fn: function (anEnvironment){
  88. var self=this;
  89. return smalltalk.withContext(function($ctx1) { self["@environment"]=anEnvironment;
  90. return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLCodeModel)})},
  91. args: ["anEnvironment"],
  92. source: "environment: anEnvironment\x0a\x09environment := anEnvironment",
  93. messageSends: [],
  94. referencedClasses: []
  95. }),
  96. smalltalk.HLCodeModel);
  97. smalltalk.addMethod(
  98. "_receiver",
  99. smalltalk.method({
  100. selector: "receiver",
  101. category: 'accessing',
  102. fn: function (){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) { var $2,$1;
  105. $2=self["@receiver"];
  106. if(($receiver = $2) == nil || $receiver == undefined){
  107. self["@receiver"]=_st(self)._defaultReceiver();
  108. $1=self["@receiver"];
  109. } else {
  110. $1=$2;
  111. };
  112. return $1;
  113. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeModel)})},
  114. args: [],
  115. source: "receiver\x0a\x09^ receiver ifNil: [ receiver := self defaultReceiver ]",
  116. messageSends: ["ifNil:", "defaultReceiver"],
  117. referencedClasses: []
  118. }),
  119. smalltalk.HLCodeModel);
  120. smalltalk.addMethod(
  121. "_receiver_",
  122. smalltalk.method({
  123. selector: "receiver:",
  124. category: 'accessing',
  125. fn: function (anObject){
  126. var self=this;
  127. return smalltalk.withContext(function($ctx1) { self["@receiver"]=anObject;
  128. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeModel)})},
  129. args: ["anObject"],
  130. source: "receiver: anObject\x0a\x09receiver := anObject",
  131. messageSends: [],
  132. referencedClasses: []
  133. }),
  134. smalltalk.HLCodeModel);
  135. smalltalk.addMethod(
  136. "_subscribe_",
  137. smalltalk.method({
  138. selector: "subscribe:",
  139. category: 'actions',
  140. fn: function (aWidget){
  141. var self=this;
  142. return smalltalk.withContext(function($ctx1) { _st(aWidget)._subscribeTo_(_st(self)._announcer());
  143. return self}, function($ctx1) {$ctx1.fill(self,"subscribe:",{aWidget:aWidget}, smalltalk.HLCodeModel)})},
  144. args: ["aWidget"],
  145. source: "subscribe: aWidget\x0a\x09aWidget subscribeTo: self announcer",
  146. messageSends: ["subscribeTo:", "announcer"],
  147. referencedClasses: []
  148. }),
  149. smalltalk.HLCodeModel);
  150. smalltalk.addMethod(
  151. "_on_",
  152. smalltalk.method({
  153. selector: "on:",
  154. category: 'actions',
  155. fn: function (anEnvironment){
  156. var self=this;
  157. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  158. $2=_st(self)._new();
  159. _st($2)._environment_(anEnvironment);
  160. $3=_st($2)._yourself();
  161. $1=$3;
  162. return $1;
  163. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLCodeModel.klass)})},
  164. args: ["anEnvironment"],
  165. source: "on: anEnvironment\x0a\x0a\x09^ self new\x0a \x09environment: anEnvironment;\x0a yourself",
  166. messageSends: ["environment:", "new", "yourself"],
  167. referencedClasses: []
  168. }),
  169. smalltalk.HLCodeModel.klass);
  170. smalltalk.addClass('HLCodeWidget', smalltalk.HLWidget, ['model', 'wrapper', 'code', 'editor'], 'Helios-Workspace');
  171. smalltalk.addMethod(
  172. "_announcer",
  173. smalltalk.method({
  174. selector: "announcer",
  175. category: 'accessing',
  176. fn: function (){
  177. var self=this;
  178. return smalltalk.withContext(function($ctx1) { var $1;
  179. $1=_st(_st(self)._model())._announcer();
  180. return $1;
  181. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLCodeWidget)})},
  182. args: [],
  183. source: "announcer\x0a\x09^ self model announcer",
  184. messageSends: ["announcer", "model"],
  185. referencedClasses: []
  186. }),
  187. smalltalk.HLCodeWidget);
  188. smalltalk.addMethod(
  189. "_canHaveFocus",
  190. smalltalk.method({
  191. selector: "canHaveFocus",
  192. category: 'testing',
  193. fn: function (){
  194. var self=this;
  195. return smalltalk.withContext(function($ctx1) { return true;
  196. }, function($ctx1) {$ctx1.fill(self,"canHaveFocus",{},smalltalk.HLCodeWidget)})},
  197. args: [],
  198. source: "canHaveFocus\x0a\x09^ true",
  199. messageSends: [],
  200. referencedClasses: []
  201. }),
  202. smalltalk.HLCodeWidget);
  203. smalltalk.addMethod(
  204. "_clear",
  205. smalltalk.method({
  206. selector: "clear",
  207. category: 'actions',
  208. fn: function (){
  209. var self=this;
  210. return smalltalk.withContext(function($ctx1) { _st(self)._contents_("");
  211. return self}, function($ctx1) {$ctx1.fill(self,"clear",{}, smalltalk.HLCodeWidget)})},
  212. args: [],
  213. source: "clear\x0a self contents: ''",
  214. messageSends: ["contents:"],
  215. referencedClasses: []
  216. }),
  217. smalltalk.HLCodeWidget);
  218. smalltalk.addMethod(
  219. "_configureEditor",
  220. smalltalk.method({
  221. selector: "configureEditor",
  222. category: 'actions',
  223. fn: function (){
  224. var self=this;
  225. return smalltalk.withContext(function($ctx1) { _st(_st(self)._editor())._at_put_("amberCodeWidget",self);
  226. return self}, function($ctx1) {$ctx1.fill(self,"configureEditor",{}, smalltalk.HLCodeWidget)})},
  227. args: [],
  228. source: "configureEditor\x0a\x09self editor at: 'amberCodeWidget' put: self",
  229. messageSends: ["at:put:", "editor"],
  230. referencedClasses: []
  231. }),
  232. smalltalk.HLCodeWidget);
  233. smalltalk.addMethod(
  234. "_contents",
  235. smalltalk.method({
  236. selector: "contents",
  237. category: 'accessing',
  238. fn: function (){
  239. var self=this;
  240. return smalltalk.withContext(function($ctx1) { var $1;
  241. $1=_st(self["@editor"])._getValue();
  242. return $1;
  243. }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.HLCodeWidget)})},
  244. args: [],
  245. source: "contents\x0a\x09^ editor getValue",
  246. messageSends: ["getValue"],
  247. referencedClasses: []
  248. }),
  249. smalltalk.HLCodeWidget);
  250. smalltalk.addMethod(
  251. "_contents_",
  252. smalltalk.method({
  253. selector: "contents:",
  254. category: 'accessing',
  255. fn: function (aString){
  256. var self=this;
  257. return smalltalk.withContext(function($ctx1) { _st(self["@editor"])._setValue_(aString);
  258. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString}, smalltalk.HLCodeWidget)})},
  259. args: ["aString"],
  260. source: "contents: aString\x0a\x09editor setValue: aString",
  261. messageSends: ["setValue:"],
  262. referencedClasses: []
  263. }),
  264. smalltalk.HLCodeWidget);
  265. smalltalk.addMethod(
  266. "_currentLine",
  267. smalltalk.method({
  268. selector: "currentLine",
  269. category: 'accessing',
  270. fn: function (){
  271. var self=this;
  272. return smalltalk.withContext(function($ctx1) { var $1;
  273. $1=_st(self["@editor"])._getLine_(_st(_st(self["@editor"])._getCursor())._line());
  274. return $1;
  275. }, function($ctx1) {$ctx1.fill(self,"currentLine",{}, smalltalk.HLCodeWidget)})},
  276. args: [],
  277. source: "currentLine\x0a ^editor getLine: (editor getCursor line)",
  278. messageSends: ["getLine:", "line", "getCursor"],
  279. referencedClasses: []
  280. }),
  281. smalltalk.HLCodeWidget);
  282. smalltalk.addMethod(
  283. "_currentLineOrSelection",
  284. smalltalk.method({
  285. selector: "currentLineOrSelection",
  286. category: 'accessing',
  287. fn: function (){
  288. var self=this;
  289. return smalltalk.withContext(function($ctx1) { var $2,$1;
  290. $2=_st(self["@editor"])._somethingSelected();
  291. if(smalltalk.assert($2)){
  292. $1=_st(self)._selection();
  293. } else {
  294. $1=_st(self)._currentLine();
  295. };
  296. return $1;
  297. }, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{}, smalltalk.HLCodeWidget)})},
  298. args: [],
  299. source: "currentLineOrSelection\x0a ^editor somethingSelected\x0a\x09\x09ifFalse: [ self currentLine ]\x0a\x09\x09ifTrue: [ self selection ]",
  300. messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"],
  301. referencedClasses: []
  302. }),
  303. smalltalk.HLCodeWidget);
  304. smalltalk.addMethod(
  305. "_doIt",
  306. smalltalk.method({
  307. selector: "doIt",
  308. category: 'actions',
  309. fn: function (){
  310. var self=this;
  311. var result;
  312. return smalltalk.withContext(function($ctx1) { var $1;
  313. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItRequested || HLDoItRequested))._on_(self["@model"]));
  314. result=_st(self["@model"])._doIt_(_st(self)._currentLineOrSelection());
  315. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItExecuted || HLDoItExecuted))._on_(self["@model"]));
  316. $1=result;
  317. return $1;
  318. }, function($ctx1) {$ctx1.fill(self,"doIt",{result:result}, smalltalk.HLCodeWidget)})},
  319. args: [],
  320. source: "doIt\x0a\x09| result |\x0a\x0a\x09self announcer announce: (HLDoItRequested on: model).\x0a\x0a\x09result:= model doIt: self currentLineOrSelection.\x0a\x0a\x09self announcer announce: (HLDoItExecuted on: model).\x0a\x0a\x09^ result ",
  321. messageSends: ["announce:", "on:", "announcer", "doIt:", "currentLineOrSelection"],
  322. referencedClasses: ["HLDoItRequested", "HLDoItExecuted"]
  323. }),
  324. smalltalk.HLCodeWidget);
  325. smalltalk.addMethod(
  326. "_editor",
  327. smalltalk.method({
  328. selector: "editor",
  329. category: 'actions',
  330. fn: function (){
  331. var self=this;
  332. return smalltalk.withContext(function($ctx1) { var $1;
  333. $1=self["@editor"];
  334. return $1;
  335. }, function($ctx1) {$ctx1.fill(self,"editor",{}, smalltalk.HLCodeWidget)})},
  336. args: [],
  337. source: "editor\x0a\x09^editor",
  338. messageSends: [],
  339. referencedClasses: []
  340. }),
  341. smalltalk.HLCodeWidget);
  342. smalltalk.addMethod(
  343. "_focus",
  344. smalltalk.method({
  345. selector: "focus",
  346. category: 'actions',
  347. fn: function (){
  348. var self=this;
  349. return smalltalk.withContext(function($ctx1) { _st(self["@editor"])._focus();
  350. return self}, function($ctx1) {$ctx1.fill(self,"focus",{}, smalltalk.HLCodeWidget)})},
  351. args: [],
  352. source: "focus\x0a\x09editor focus",
  353. messageSends: ["focus"],
  354. referencedClasses: []
  355. }),
  356. smalltalk.HLCodeWidget);
  357. smalltalk.addMethod(
  358. "_hasFocus",
  359. smalltalk.method({
  360. selector: "hasFocus",
  361. category: 'testing',
  362. fn: function (){
  363. var self=this;
  364. return smalltalk.withContext(function($ctx1) { var $1;
  365. $1=_st(_st(self["@code"])._asJQuery())._is_(":active");
  366. return $1;
  367. }, function($ctx1) {$ctx1.fill(self,"hasFocus",{}, smalltalk.HLCodeWidget)})},
  368. args: [],
  369. source: "hasFocus\x0a\x09^ code asJQuery is: ':active'",
  370. messageSends: ["is:", "asJQuery"],
  371. referencedClasses: []
  372. }),
  373. smalltalk.HLCodeWidget);
  374. smalltalk.addMethod(
  375. "_inspectIt",
  376. smalltalk.method({
  377. selector: "inspectIt",
  378. category: 'actions',
  379. fn: function (){
  380. var self=this;
  381. var newInspector;
  382. return smalltalk.withContext(function($ctx1) { _st(_st(self)._announcer())._announce_(_st((smalltalk.HLInspectItRequested || HLInspectItRequested))._on_(self["@model"]));
  383. newInspector=_st(self)._makeInspectorOn_(_st(self)._doIt());
  384. _st(newInspector)._open();
  385. return self}, function($ctx1) {$ctx1.fill(self,"inspectIt",{newInspector:newInspector}, smalltalk.HLCodeWidget)})},
  386. args: [],
  387. source: "inspectIt\x0a\x09| newInspector |\x0a \x0a\x09self announcer announce: (HLInspectItRequested on: model).\x0a\x09newInspector := self makeInspectorOn: self doIt.\x0a\x09newInspector open",
  388. messageSends: ["announce:", "on:", "announcer", "makeInspectorOn:", "doIt", "open"],
  389. referencedClasses: ["HLInspectItRequested"]
  390. }),
  391. smalltalk.HLCodeWidget);
  392. smalltalk.addMethod(
  393. "_makeInspectorOn_",
  394. smalltalk.method({
  395. selector: "makeInspectorOn:",
  396. category: 'actions',
  397. fn: function (anObject){
  398. var self=this;
  399. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  400. $2=_st((smalltalk.HLInspector || HLInspector))._new();
  401. _st($2)._inspect_(anObject);
  402. $3=_st($2)._yourself();
  403. $1=$3;
  404. return $1;
  405. }, function($ctx1) {$ctx1.fill(self,"makeInspectorOn:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  406. args: ["anObject"],
  407. source: "makeInspectorOn: anObject\x0a\x0a\x09^ HLInspector new \x0a\x09\x09inspect: anObject;\x0a\x09\x09yourself",
  408. messageSends: ["inspect:", "new", "yourself"],
  409. referencedClasses: ["HLInspector"]
  410. }),
  411. smalltalk.HLCodeWidget);
  412. smalltalk.addMethod(
  413. "_messageHintFor_token_",
  414. smalltalk.method({
  415. selector: "messageHintFor:token:",
  416. category: 'hints',
  417. fn: function (anEditor,aToken){
  418. var self=this;
  419. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  420. return smalltalk.withContext(function($ctx1) {
  421. var $1;
  422. $1=_st(_st(_st(_st(_st(_st(_st($Smalltalk())._current())._at_("allSelectors"))._value())._asSet())._asArray())._select_((function(each){
  423. return smalltalk.withContext(function($ctx2) {
  424. return _st(each)._includesSubString_(_st(aToken)._string());
  425. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._reject_((function(each){
  426. return smalltalk.withContext(function($ctx2) {
  427. return _st(each).__eq(_st(aToken)._string());
  428. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  429. return $1;
  430. }, function($ctx1) {$ctx1.fill(self,"messageHintFor:token:",{anEditor:anEditor,aToken:aToken},smalltalk.HLCodeWidget)})},
  431. args: ["anEditor", "aToken"],
  432. source: "messageHintFor: anEditor token: aToken\x0a\x09^ ((Smalltalk current at: 'allSelectors') value asSet asArray \x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
  433. messageSends: ["reject:", "=", "string", "select:", "includesSubString:", "asArray", "asSet", "value", "at:", "current"],
  434. referencedClasses: ["Smalltalk"]
  435. }),
  436. smalltalk.HLCodeWidget);
  437. smalltalk.addMethod(
  438. "_model",
  439. smalltalk.method({
  440. selector: "model",
  441. category: 'accessing',
  442. fn: function (){
  443. var self=this;
  444. return smalltalk.withContext(function($ctx1) { var $2,$1;
  445. $2=self["@model"];
  446. if(($receiver = $2) == nil || $receiver == undefined){
  447. self["@model"]=_st((smalltalk.HLCodeModel || HLCodeModel))._new();
  448. $1=self["@model"];
  449. } else {
  450. $1=$2;
  451. };
  452. return $1;
  453. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLCodeWidget)})},
  454. args: [],
  455. source: "model\x0a\x09^ model ifNil: [ model := HLCodeModel new ]",
  456. messageSends: ["ifNil:", "new"],
  457. referencedClasses: ["HLCodeModel"]
  458. }),
  459. smalltalk.HLCodeWidget);
  460. smalltalk.addMethod(
  461. "_model_",
  462. smalltalk.method({
  463. selector: "model:",
  464. category: 'accessing',
  465. fn: function (aModel){
  466. var self=this;
  467. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  468. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLCodeWidget)})},
  469. args: ["aModel"],
  470. source: "model: aModel\x0a\x09model := aModel",
  471. messageSends: [],
  472. referencedClasses: []
  473. }),
  474. smalltalk.HLCodeWidget);
  475. smalltalk.addMethod(
  476. "_onDoIt",
  477. smalltalk.method({
  478. selector: "onDoIt",
  479. category: 'reactions',
  480. fn: function (){
  481. var self=this;
  482. return smalltalk.withContext(function($ctx1) { _st(self)._doIt();
  483. return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLCodeWidget)})},
  484. args: [],
  485. source: "onDoIt\x0a\x09\x0a self doIt",
  486. messageSends: ["doIt"],
  487. referencedClasses: []
  488. }),
  489. smalltalk.HLCodeWidget);
  490. smalltalk.addMethod(
  491. "_onInspectIt",
  492. smalltalk.method({
  493. selector: "onInspectIt",
  494. category: 'reactions',
  495. fn: function (){
  496. var self=this;
  497. return smalltalk.withContext(function($ctx1) { _st(self)._inspectIt();
  498. return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLCodeWidget)})},
  499. args: [],
  500. source: "onInspectIt\x0a\x0a\x09self inspectIt",
  501. messageSends: ["inspectIt"],
  502. referencedClasses: []
  503. }),
  504. smalltalk.HLCodeWidget);
  505. smalltalk.addMethod(
  506. "_onPrintIt",
  507. smalltalk.method({
  508. selector: "onPrintIt",
  509. category: 'reactions',
  510. fn: function (){
  511. var self=this;
  512. return smalltalk.withContext(function($ctx1) { _st(self)._printIt();
  513. return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLCodeWidget)})},
  514. args: [],
  515. source: "onPrintIt\x0a\x0a\x09self printIt",
  516. messageSends: ["printIt"],
  517. referencedClasses: []
  518. }),
  519. smalltalk.HLCodeWidget);
  520. smalltalk.addMethod(
  521. "_onSaveIt",
  522. smalltalk.method({
  523. selector: "onSaveIt",
  524. category: 'reactions',
  525. fn: function (){
  526. var self=this;
  527. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLCodeWidget)})},
  528. args: [],
  529. source: "onSaveIt\x0a\x09\x22I do not do anything\x22",
  530. messageSends: [],
  531. referencedClasses: []
  532. }),
  533. smalltalk.HLCodeWidget);
  534. smalltalk.addMethod(
  535. "_print_",
  536. smalltalk.method({
  537. selector: "print:",
  538. category: 'actions',
  539. fn: function (aString){
  540. var self=this;
  541. var start,stop,currentLine;
  542. return smalltalk.withContext(function($ctx1) { currentLine=_st(_st(self["@editor"])._getCursor_(false))._line();
  543. start=_st((smalltalk.HashedCollection || HashedCollection))._new();
  544. _st(start)._at_put_("line",currentLine);
  545. _st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
  546. _st(_st(self["@editor"])._getSelection())._ifEmpty_((function(){
  547. return smalltalk.withContext(function($ctx2) { _st(start)._at_put_("ch",_st(_st(self["@editor"])._getLine_(currentLine))._size());
  548. return _st(self["@editor"])._setSelection_end_(smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(currentLine),_st("ch").__minus_gt((0))]),start);
  549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  550. stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
  551. _st(stop)._at_put_("line",currentLine);
  552. _st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
  553. _st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
  554. _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
  555. _st(self["@editor"])._setSelection_end_(stop,start);
  556. return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine}, smalltalk.HLCodeWidget)})},
  557. args: ["aString"],
  558. source: "print: aString\x0a\x09| start stop currentLine |\x0a currentLine := (editor getCursor: false) line.\x0a\x09start := HashedCollection new.\x0a\x09start at: 'line' put: currentLine.\x0a\x09start at: 'ch' put: (editor getCursor: false) ch.\x0a (editor getSelection) ifEmpty: [\x0a \x09\x22select current line if selection is empty\x22\x0a \x09start at: 'ch' put: (editor getLine: currentLine) size.\x0a editor setSelection: #{'line' -> currentLine. 'ch' -> 0} end: start.\x0a ].\x0a\x09stop := HashedCollection new.\x0a\x09stop at: 'line' put: currentLine.\x0a\x09stop at: 'ch' put: ((start at: 'ch') + aString size + 2).\x0a\x0a\x09editor replaceSelection: (editor getSelection, ' ', aString, ' ').\x0a\x09editor setCursor: (editor getCursor: true).\x0a\x09editor setSelection: stop end: start",
  559. messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "size", "getLine:", "setSelection:end:", "->", "getSelection", "+", "at:", "replaceSelection:", ",", "setCursor:"],
  560. referencedClasses: ["HashedCollection"]
  561. }),
  562. smalltalk.HLCodeWidget);
  563. smalltalk.addMethod(
  564. "_printIt",
  565. smalltalk.method({
  566. selector: "printIt",
  567. category: 'actions',
  568. fn: function (){
  569. var self=this;
  570. var result;
  571. return smalltalk.withContext(function($ctx1) { result=_st(self)._doIt();
  572. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLPrintItRequested || HLPrintItRequested))._on_(self["@model"]));
  573. _st(self)._print_(_st(result)._printString());
  574. _st(self)._focus();
  575. return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result}, smalltalk.HLCodeWidget)})},
  576. args: [],
  577. source: "printIt\x0a\x09| result |\x0a\x0a\x09result:= self doIt.\x0a \x0a\x09self announcer announce: (HLPrintItRequested on: model).\x0a\x0a self print: result printString.\x0a\x09self focus.",
  578. messageSends: ["doIt", "announce:", "on:", "announcer", "print:", "printString", "focus"],
  579. referencedClasses: ["HLPrintItRequested"]
  580. }),
  581. smalltalk.HLCodeWidget);
  582. smalltalk.addMethod(
  583. "_receiver",
  584. smalltalk.method({
  585. selector: "receiver",
  586. category: 'accessing',
  587. fn: function (){
  588. var self=this;
  589. return smalltalk.withContext(function($ctx1) { var $1;
  590. $1=_st(_st(self)._model())._receiver();
  591. return $1;
  592. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeWidget)})},
  593. args: [],
  594. source: "receiver\x0a\x09^ self model receiver",
  595. messageSends: ["receiver", "model"],
  596. referencedClasses: []
  597. }),
  598. smalltalk.HLCodeWidget);
  599. smalltalk.addMethod(
  600. "_receiver_",
  601. smalltalk.method({
  602. selector: "receiver:",
  603. category: 'accessing',
  604. fn: function (anObject){
  605. var self=this;
  606. return smalltalk.withContext(function($ctx1) { _st(_st(self)._model())._receiver_(anObject);
  607. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  608. args: ["anObject"],
  609. source: "receiver: anObject\x0a\x09self model receiver: anObject",
  610. messageSends: ["receiver:", "model"],
  611. referencedClasses: []
  612. }),
  613. smalltalk.HLCodeWidget);
  614. smalltalk.addMethod(
  615. "_renderContentOn_",
  616. smalltalk.method({
  617. selector: "renderContentOn:",
  618. category: 'rendering',
  619. fn: function (html){
  620. var self=this;
  621. return smalltalk.withContext(function($ctx1) { self["@code"]=_st(html)._textarea();
  622. _st(self)._setEditorOn_(_st(self["@code"])._element());
  623. _st(self)._configureEditor();
  624. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLCodeWidget)})},
  625. args: ["html"],
  626. source: "renderContentOn: html\x0a code := html textarea.\x0a self setEditorOn: code element.\x0a self configureEditor",
  627. messageSends: ["textarea", "setEditorOn:", "element", "configureEditor"],
  628. referencedClasses: []
  629. }),
  630. smalltalk.HLCodeWidget);
  631. smalltalk.addMethod(
  632. "_saveIt",
  633. smalltalk.method({
  634. selector: "saveIt",
  635. category: 'actions',
  636. fn: function (){
  637. var self=this;
  638. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLCodeWidget)})},
  639. args: [],
  640. source: "saveIt\x0a\x09\x22I do not do anything\x22",
  641. messageSends: [],
  642. referencedClasses: []
  643. }),
  644. smalltalk.HLCodeWidget);
  645. smalltalk.addMethod(
  646. "_selection",
  647. smalltalk.method({
  648. selector: "selection",
  649. category: 'accessing',
  650. fn: function (){
  651. var self=this;
  652. return smalltalk.withContext(function($ctx1) { var $1;
  653. $1=_st(self["@editor"])._getSelection();
  654. return $1;
  655. }, function($ctx1) {$ctx1.fill(self,"selection",{}, smalltalk.HLCodeWidget)})},
  656. args: [],
  657. source: "selection\x0a\x09^editor getSelection",
  658. messageSends: ["getSelection"],
  659. referencedClasses: []
  660. }),
  661. smalltalk.HLCodeWidget);
  662. smalltalk.addMethod(
  663. "_selectionEnd",
  664. smalltalk.method({
  665. selector: "selectionEnd",
  666. category: 'accessing',
  667. fn: function (){
  668. var self=this;
  669. return smalltalk.withContext(function($ctx1) { var $1;
  670. $1=_st(_st(self["@code"])._element())._selectionEnd();
  671. return $1;
  672. }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{}, smalltalk.HLCodeWidget)})},
  673. args: [],
  674. source: "selectionEnd\x0a ^code element selectionEnd",
  675. messageSends: ["selectionEnd", "element"],
  676. referencedClasses: []
  677. }),
  678. smalltalk.HLCodeWidget);
  679. smalltalk.addMethod(
  680. "_selectionEnd_",
  681. smalltalk.method({
  682. selector: "selectionEnd:",
  683. category: 'accessing',
  684. fn: function (anInteger){
  685. var self=this;
  686. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionEnd_(anInteger);
  687. return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  688. args: ["anInteger"],
  689. source: "selectionEnd: anInteger\x0a code element selectionEnd: anInteger",
  690. messageSends: ["selectionEnd:", "element"],
  691. referencedClasses: []
  692. }),
  693. smalltalk.HLCodeWidget);
  694. smalltalk.addMethod(
  695. "_selectionStart",
  696. smalltalk.method({
  697. selector: "selectionStart",
  698. category: 'accessing',
  699. fn: function (){
  700. var self=this;
  701. return smalltalk.withContext(function($ctx1) { var $1;
  702. $1=_st(_st(self["@code"])._element())._selectionStart();
  703. return $1;
  704. }, function($ctx1) {$ctx1.fill(self,"selectionStart",{}, smalltalk.HLCodeWidget)})},
  705. args: [],
  706. source: "selectionStart\x0a ^code element selectionStart",
  707. messageSends: ["selectionStart", "element"],
  708. referencedClasses: []
  709. }),
  710. smalltalk.HLCodeWidget);
  711. smalltalk.addMethod(
  712. "_selectionStart_",
  713. smalltalk.method({
  714. selector: "selectionStart:",
  715. category: 'accessing',
  716. fn: function (anInteger){
  717. var self=this;
  718. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionStart_(anInteger);
  719. return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  720. args: ["anInteger"],
  721. source: "selectionStart: anInteger\x0a code element selectionStart: anInteger",
  722. messageSends: ["selectionStart:", "element"],
  723. referencedClasses: []
  724. }),
  725. smalltalk.HLCodeWidget);
  726. smalltalk.addMethod(
  727. "_setEditorOn_",
  728. smalltalk.method({
  729. selector: "setEditorOn:",
  730. category: 'actions',
  731. fn: function (aTextarea){
  732. var self=this;
  733. return smalltalk.withContext(function($ctx1) {
  734. self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  735. theme: 'amber',
  736. lineNumbers: true,
  737. enterMode: 'flat',
  738. indentWithTabs: true,
  739. indentUnit: 4,
  740. matchBrackets: true,
  741. electricChars: false,
  742. keyMap: 'Amber',
  743. extraKeys: {"Shift-Space": "autocomplete"}
  744. });
  745. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea},smalltalk.HLCodeWidget)})},
  746. args: ["aTextarea"],
  747. source: "setEditorOn: aTextarea\x0a\x09<self['@editor'] = CodeMirror.fromTextArea(aTextarea, {\x0a\x09\x09theme: 'amber',\x0a lineNumbers: true,\x0a enterMode: 'flat',\x0a indentWithTabs: true,\x0a\x09\x09\x09\x09indentUnit: 4,\x0a matchBrackets: true,\x0a electricChars: false,\x0a\x09\x09\x09\x09keyMap: 'Amber',\x0a\x09\x09\x09\x09extraKeys: {\x22Shift-Space\x22: \x22autocomplete\x22}\x0a\x09})>",
  748. messageSends: [],
  749. referencedClasses: []
  750. }),
  751. smalltalk.HLCodeWidget);
  752. smalltalk.addMethod(
  753. "_variableHintFor_token_",
  754. smalltalk.method({
  755. selector: "variableHintFor:token:",
  756. category: 'hints',
  757. fn: function (anEditor,aToken){
  758. var self=this;
  759. var variables,classNames,pseudoVariables;
  760. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  761. return smalltalk.withContext(function($ctx1) {
  762. var $1;
  763. variables=_st(_st(_st(_st(window)._jQuery_(_st(_st(anEditor)._display())._wrapper()))._find_("span.cm-variable"))._get())._collect_((function(each){
  764. return smalltalk.withContext(function($ctx2) {
  765. return _st(_st(window)._jQuery_(each))._html();
  766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  767. classNames=_st(_st(_st($Smalltalk())._current())._classes())._collect_((function(each){
  768. return smalltalk.withContext(function($ctx2) {
  769. return _st(each)._name();
  770. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  771. pseudoVariables=_st(_st($Smalltalk())._current())._pseudoVariableNames();
  772. $1=_st(_st(_st(_st(_st(_st(variables).__comma(classNames)).__comma(pseudoVariables))._asSet())._asArray())._select_((function(each){
  773. return smalltalk.withContext(function($ctx2) {
  774. return _st(each)._includesSubString_(_st(aToken)._string());
  775. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._reject_((function(each){
  776. return smalltalk.withContext(function($ctx2) {
  777. return _st(each).__eq(_st(aToken)._string());
  778. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  779. return $1;
  780. }, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken,variables:variables,classNames:classNames,pseudoVariables:pseudoVariables},smalltalk.HLCodeWidget)})},
  781. args: ["anEditor", "aToken"],
  782. source: "variableHintFor: anEditor token: aToken\x0a\x09| variables classNames pseudoVariables |\x0a\x09\x0a\x09variables := ((window jQuery: anEditor display wrapper) find: 'span.cm-variable') get\x0a\x09\x09collect: [ :each | (window jQuery: each) html ].\x0a\x09\x0a\x09classNames := Smalltalk current classes collect: [ :each | each name ].\x0a\x09pseudoVariables := Smalltalk current pseudoVariableNames.\x0a\x09\x0a\x09^ ((variables, classNames, pseudoVariables) asSet asArray \x0a\x09\x09select: [ :each | each includesSubString: aToken string ])\x0a\x09\x09reject: [ :each | each = aToken string ]",
  783. messageSends: ["collect:", "html", "jQuery:", "get", "find:", "wrapper", "display", "name", "classes", "current", "pseudoVariableNames", "reject:", "=", "string", "select:", "includesSubString:", "asArray", "asSet", ","],
  784. referencedClasses: ["Smalltalk"]
  785. }),
  786. smalltalk.HLCodeWidget);
  787. smalltalk.addMethod(
  788. "_canBeOpenAsTab",
  789. smalltalk.method({
  790. selector: "canBeOpenAsTab",
  791. category: 'testing',
  792. fn: function (){
  793. var self=this;
  794. return smalltalk.withContext(function($ctx1) { return true;
  795. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLCodeWidget.klass)})},
  796. args: [],
  797. source: "canBeOpenAsTab\x0a\x09^ true",
  798. messageSends: [],
  799. referencedClasses: []
  800. }),
  801. smalltalk.HLCodeWidget.klass);
  802. smalltalk.addMethod(
  803. "_hintFor_options_",
  804. smalltalk.method({
  805. selector: "hintFor:options:",
  806. category: 'hints',
  807. fn: function (anEditor,options){
  808. var self=this;
  809. var cursor,token,completions;
  810. function $CodeMirror(){return smalltalk.CodeMirror||(typeof CodeMirror=="undefined"?nil:CodeMirror)}
  811. function $HLCodeWidget(){return smalltalk.HLCodeWidget||(typeof HLCodeWidget=="undefined"?nil:HLCodeWidget)}
  812. return smalltalk.withContext(function($ctx1) {
  813. var $1,$2;
  814. cursor=_st(anEditor)._getCursor();
  815. token=_st(anEditor)._getTokenAt_(cursor);
  816. _st(token)._at_put_("state",_st(_st(_st($CodeMirror())._basicAt_("innerMode"))._value_value_(_st(anEditor)._getMode(),_st(token)._at_("state")))._state());
  817. $1=_st(_st(token)._type()).__eq("variable");
  818. if(smalltalk.assert($1)){
  819. completions=_st($HLCodeWidget())._variableHintFor_token_(anEditor,token);
  820. } else {
  821. completions=_st($HLCodeWidget())._messageHintFor_token_(anEditor,token);
  822. };
  823. $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()))]);
  824. return $2;
  825. }, function($ctx1) {$ctx1.fill(self,"hintFor:options:",{anEditor:anEditor,options:options,cursor:cursor,token:token,completions:completions},smalltalk.HLCodeWidget.klass)})},
  826. args: ["anEditor", "options"],
  827. source: "hintFor: anEditor options: options\x0a\x09| cursor token completions |\x0a\x09\x0a\x09cursor := anEditor getCursor.\x0a\x09token := anEditor getTokenAt: cursor.\x0a\x09token at: 'state' put: ((CodeMirror basicAt: 'innerMode')\x0a\x09\x09value: anEditor getMode value: (token at: 'state')) state.\x0a\x09\x0a\x09completions := token type = 'variable' \x0a\x09\x09ifTrue: [ HLCodeWidget variableHintFor: anEditor token: token ]\x0a\x09\x09ifFalse: [ HLCodeWidget messageHintFor: anEditor token: token ].\x0a\x09\x0a\x09^ #{\x0a\x09\x09'list' -> completions.\x0a\x09\x09'from' -> ((CodeMirror basicAt: 'Pos') value: cursor line value: token end).\x0a\x09\x09'to' -> ((CodeMirror basicAt: 'Pos') value: cursor line value: token start)\x0a\x09}",
  828. messageSends: ["getCursor", "getTokenAt:", "at:put:", "state", "value:value:", "getMode", "at:", "basicAt:", "ifTrue:ifFalse:", "variableHintFor:token:", "messageHintFor:token:", "=", "type", "->", "line", "end", "start"],
  829. referencedClasses: ["CodeMirror", "HLCodeWidget"]
  830. }),
  831. smalltalk.HLCodeWidget.klass);
  832. smalltalk.addMethod(
  833. "_initialize",
  834. smalltalk.method({
  835. selector: "initialize",
  836. category: 'initialization',
  837. fn: function (){
  838. var self=this;
  839. return smalltalk.withContext(function($ctx1) { var $1,$2;
  840. smalltalk.HLWidget.klass.fn.prototype._initialize.apply(_st(self), []);
  841. $1=self;
  842. _st($1)._setupCodeMirror();
  843. _st($1)._setupCommands();
  844. $2=_st($1)._setupKeyMaps();
  845. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLCodeWidget.klass)})},
  846. args: [],
  847. source: "initialize\x0a\x09super initialize.\x0a\x09self \x0a\x09\x09setupCodeMirror;\x0a\x09\x09setupCommands;\x0a\x09\x09setupKeyMaps.",
  848. messageSends: ["initialize", "setupCodeMirror", "setupCommands", "setupKeyMaps"],
  849. referencedClasses: []
  850. }),
  851. smalltalk.HLCodeWidget.klass);
  852. smalltalk.addMethod(
  853. "_keyMap",
  854. smalltalk.method({
  855. selector: "keyMap",
  856. category: 'accessing',
  857. fn: function (){
  858. var self=this;
  859. return smalltalk.withContext(function($ctx1) { var $2,$1;
  860. $2=_st(_st(_st((smalltalk.HLManager || HLManager))._current())._keyBinder())._systemIsMac();
  861. if(smalltalk.assert($2)){
  862. $1=_st(self)._macKeyMap();
  863. } else {
  864. $1=_st(self)._pcKeyMap();
  865. };
  866. return $1;
  867. }, function($ctx1) {$ctx1.fill(self,"keyMap",{}, smalltalk.HLCodeWidget.klass)})},
  868. args: [],
  869. source: "keyMap\x0a\x09^ HLManager current keyBinder systemIsMac\x0a\x09\x09ifTrue: [ self macKeyMap ]\x0a\x09\x09ifFalse: [ self pcKeyMap ]",
  870. messageSends: ["ifTrue:ifFalse:", "macKeyMap", "pcKeyMap", "systemIsMac", "keyBinder", "current"],
  871. referencedClasses: ["HLManager"]
  872. }),
  873. smalltalk.HLCodeWidget.klass);
  874. smalltalk.addMethod(
  875. "_macKeyMap",
  876. smalltalk.method({
  877. selector: "macKeyMap",
  878. category: 'accessing',
  879. fn: function (){
  880. var self=this;
  881. return smalltalk.withContext(function($ctx1) {
  882. var $1;
  883. $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"])]);
  884. return $1;
  885. }, function($ctx1) {$ctx1.fill(self,"macKeyMap",{},smalltalk.HLCodeWidget.klass)})},
  886. args: [],
  887. source: "macKeyMap\x0a\x09^ #{\x0a\x09\x09'Alt-Backspace'\x09\x09-> 'delWordBefore'.\x0a\x09\x09'Alt-Delete'\x09\x09-> 'delWordAfter'. \x0a\x09\x09'Alt-Left'\x09\x09-> 'goWordBoundaryLeft'.\x0a\x09\x09'Alt-Right'\x09\x09-> 'goWordBoundaryRight'. \x0a\x09\x09'Cmd-A'\x09\x09\x09-> 'selectAll'. \x0a\x09\x09'Cmd-Alt-F'\x09\x09-> 'replace'. \x0a\x09\x09'Cmd-D'\x09\x09\x09-> 'doIt'. \x0a\x09\x09'Cmd-Down'\x09\x09-> 'goDocEnd'. \x0a\x09\x09'Cmd-End'\x09\x09-> 'goDocEnd'. \x0a\x09\x09'Cmd-F'\x09\x09\x09-> 'find'.\x0a\x09\x09'Cmd-G'\x09\x09\x09-> 'findNext'. \x0a\x09\x09'Cmd-I'\x09\x09\x09-> 'inspectIt'. \x0a\x09\x09'Cmd-Left'\x09\x09-> 'goLineStart'. \x0a\x09\x09'Cmd-P'\x09\x09\x09-> 'printIt'. \x0a\x09\x09'Cmd-Right'\x09\x09-> 'goLineEnd'. \x0a\x09\x09'Cmd-S'\x09\x09\x09-> 'saveIt'. \x0a\x09\x09'Cmd-Up'\x09\x09-> 'goDocStart'. \x0a\x09\x09'Cmd-Y'\x09\x09\x09-> 'redo'.\x0a\x09\x09'Cmd-Z'\x09\x09\x09-> 'undo'. \x0a\x09\x09'Cmd-['\x09\x09\x09-> 'indentLess'. \x0a\x09\x09'Cmd-]'\x09\x09\x09-> 'indentMore'.\x0a\x09\x09'Ctrl-Alt-Backspace'\x09-> 'delWordAfter'. \x0a\x09\x09'Shift-Cmd-Alt-F'\x09-> 'replaceAll'.\x0a\x09\x09'Shift-Cmd-G'\x09\x09-> 'findPrev'. \x0a\x09\x09'Shift-Cmd-Z'\x09\x09-> 'redo'. \x0a \x09'fallthrough' \x09-> { 'basic'. 'emacsy' }\x0a }",
  888. messageSends: ["->"],
  889. referencedClasses: []
  890. }),
  891. smalltalk.HLCodeWidget.klass);
  892. smalltalk.addMethod(
  893. "_messageHintFor_token_",
  894. smalltalk.method({
  895. selector: "messageHintFor:token:",
  896. category: 'hints',
  897. fn: function (anEditor,aToken){
  898. var self=this;
  899. return smalltalk.withContext(function($ctx1) {
  900. var $1;
  901. $1=_st(_st(anEditor)._at_("amberCodeWidget"))._messageHintFor_token_(anEditor,aToken);
  902. return $1;
  903. }, function($ctx1) {$ctx1.fill(self,"messageHintFor:token:",{anEditor:anEditor,aToken:aToken},smalltalk.HLCodeWidget.klass)})},
  904. args: ["anEditor", "aToken"],
  905. source: "messageHintFor: anEditor token: aToken\x0a\x09^ (anEditor at: 'amberCodeWidget')\x0a\x09\x09messageHintFor: anEditor token: aToken",
  906. messageSends: ["messageHintFor:token:", "at:"],
  907. referencedClasses: []
  908. }),
  909. smalltalk.HLCodeWidget.klass);
  910. smalltalk.addMethod(
  911. "_pcKeyMap",
  912. smalltalk.method({
  913. selector: "pcKeyMap",
  914. category: 'accessing',
  915. fn: function (){
  916. var self=this;
  917. return smalltalk.withContext(function($ctx1) { var $1;
  918. $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"])];
  919. return $1;
  920. }, function($ctx1) {$ctx1.fill(self,"pcKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  921. args: [],
  922. source: "pcKeyMap\x0a\x09^ {\x0a\x09\x09'Alt-Left' -> 'goLineStart'. \x0a\x09\x09'Alt-Right' -> 'goLineEnd'.\x0a\x09\x09'Alt-Up' -> 'goDocStart'. \x0a\x09\x09'Ctrl-A' -> 'selectAll'. \x0a\x09\x09'Ctrl-Backspace' -> 'delWordBefore'. \x0a\x09\x09'Ctrl-D' -> 'doIt'. \x0a\x09\x09'Ctrl-Delete' -> 'delWordAfter'. \x0a\x09\x09'Ctrl-Down' -> 'goDocEnd'.\x0a\x09\x09'Ctrl-End' -> 'goDocEnd'. \x0a\x09\x09'Ctrl-F' -> 'find'.\x0a\x09\x09'Ctrl-G' -> 'findNext'. \x0a\x09\x09'Ctrl-I' -> 'inspectIt'.\x0a\x09\x09'Ctrl-Home' -> 'goDocStart'. \x0a\x09\x09'Ctrl-Left' -> 'goWordBoundaryLeft'. \x0a\x09\x09'Ctrl-P' -> 'printIt'.\x0a\x09\x09'Ctrl-Right' -> 'goWordBoundaryRight'. \x0a\x09\x09'Ctrl-S' -> 'saveIt'. \x0a\x09\x09'Ctrl-Y' -> 'redo'.\x0a\x09\x09'Ctrl-Z' -> 'undo'. \x0a\x09\x09'Ctrl-[' -> 'indentLess'. \x0a\x09\x09'Ctrl-]' -> 'indentMore'.\x0a\x09\x09'Shift-Ctrl-F' -> 'replace'. \x0a\x09\x09'Shift-Ctrl-G' -> 'findPrev'. \x0a\x09\x09'Shift-Ctrl-R' -> 'replaceAll'.\x0a\x09\x09'Shift-Ctrl-Z' -> 'redo'. \x0a\x09\x09'fallthrough' -> #('basic')\x0a}",
  923. messageSends: ["->"],
  924. referencedClasses: []
  925. }),
  926. smalltalk.HLCodeWidget.klass);
  927. smalltalk.addMethod(
  928. "_setupCodeMirror",
  929. smalltalk.method({
  930. selector: "setupCodeMirror",
  931. category: 'initialization',
  932. fn: function (){
  933. var self=this;
  934. return smalltalk.withContext(function($ctx1) {
  935. CodeMirror.keyMap.default.fallthrough = ["basic"];
  936. CodeMirror.commands.autocomplete = function(cm) {
  937. CodeMirror.showHint(cm, self._hintFor_options_);
  938. }
  939. ;
  940. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{},smalltalk.HLCodeWidget.klass)})},
  941. args: [],
  942. source: "setupCodeMirror\x0a\x09< \x0a\x09\x09CodeMirror.keyMap.default.fallthrough = [\x22basic\x22];\x0a\x09\x09CodeMirror.commands.autocomplete = function(cm) {\x0a \x09CodeMirror.showHint(cm, self._hintFor_options_);\x0a \x09}\x0a\x09>",
  943. messageSends: [],
  944. referencedClasses: []
  945. }),
  946. smalltalk.HLCodeWidget.klass);
  947. smalltalk.addMethod(
  948. "_setupCommands",
  949. smalltalk.method({
  950. selector: "setupCommands",
  951. category: 'initialization',
  952. fn: function (){
  953. var self=this;
  954. return smalltalk.withContext(function($ctx1) { var $1,$2;
  955. $1=_st((smalltalk.CodeMirror || CodeMirror))._basicAt_("commands");
  956. _st($1)._at_put_("doIt",(function(cm){
  957. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._doIt();
  958. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  959. _st($1)._at_put_("inspectIt",(function(cm){
  960. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._inspectIt();
  961. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  962. _st($1)._at_put_("printIt",(function(cm){
  963. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._printIt();
  964. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  965. $2=_st($1)._at_put_("saveIt",(function(cm){
  966. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._saveIt();
  967. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  968. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{}, smalltalk.HLCodeWidget.klass)})},
  969. args: [],
  970. source: "setupCommands\x0a\x09(CodeMirror basicAt: 'commands') \x0a\x09\x09at: 'doIt' put: [ :cm | cm amberCodeWidget doIt ];\x0a\x09\x09at: 'inspectIt' put: [ :cm | cm amberCodeWidget inspectIt ];\x0a\x09\x09at: 'printIt' put: [ :cm | cm amberCodeWidget printIt ];\x0a\x09\x09at: 'saveIt' put: [ :cm | cm amberCodeWidget saveIt ]",
  971. messageSends: ["at:put:", "doIt", "amberCodeWidget", "basicAt:", "inspectIt", "printIt", "saveIt"],
  972. referencedClasses: ["CodeMirror"]
  973. }),
  974. smalltalk.HLCodeWidget.klass);
  975. smalltalk.addMethod(
  976. "_setupKeyMaps",
  977. smalltalk.method({
  978. selector: "setupKeyMaps",
  979. category: 'initialization',
  980. fn: function (){
  981. var self=this;
  982. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap['Amber'] = self._keyMap();
  983. return self}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{}, smalltalk.HLCodeWidget.klass)})},
  984. args: [],
  985. source: "setupKeyMaps\x0a\x09<CodeMirror.keyMap['Amber'] = self._keyMap()>",
  986. messageSends: [],
  987. referencedClasses: []
  988. }),
  989. smalltalk.HLCodeWidget.klass);
  990. smalltalk.addMethod(
  991. "_tabLabel",
  992. smalltalk.method({
  993. selector: "tabLabel",
  994. category: 'accessing',
  995. fn: function (){
  996. var self=this;
  997. return smalltalk.withContext(function($ctx1) { return "Workspace";
  998. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLCodeWidget.klass)})},
  999. args: [],
  1000. source: "tabLabel\x0a\x09^ 'Workspace'",
  1001. messageSends: [],
  1002. referencedClasses: []
  1003. }),
  1004. smalltalk.HLCodeWidget.klass);
  1005. smalltalk.addMethod(
  1006. "_tabPriority",
  1007. smalltalk.method({
  1008. selector: "tabPriority",
  1009. category: 'accessing',
  1010. fn: function (){
  1011. var self=this;
  1012. return smalltalk.withContext(function($ctx1) { return (10);
  1013. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLCodeWidget.klass)})},
  1014. args: [],
  1015. source: "tabPriority\x0a\x09^ 10",
  1016. messageSends: [],
  1017. referencedClasses: []
  1018. }),
  1019. smalltalk.HLCodeWidget.klass);
  1020. smalltalk.addMethod(
  1021. "_variableHintFor_token_",
  1022. smalltalk.method({
  1023. selector: "variableHintFor:token:",
  1024. category: 'hints',
  1025. fn: function (anEditor,aToken){
  1026. var self=this;
  1027. return smalltalk.withContext(function($ctx1) {
  1028. var $1;
  1029. $1=_st(_st(anEditor)._at_("amberCodeWidget"))._variableHintFor_token_(anEditor,aToken);
  1030. return $1;
  1031. }, function($ctx1) {$ctx1.fill(self,"variableHintFor:token:",{anEditor:anEditor,aToken:aToken},smalltalk.HLCodeWidget.klass)})},
  1032. args: ["anEditor", "aToken"],
  1033. source: "variableHintFor: anEditor token: aToken\x0a\x09^ (anEditor at: 'amberCodeWidget')\x0a\x09\x09variableHintFor: anEditor token: aToken",
  1034. messageSends: ["variableHintFor:token:", "at:"],
  1035. referencedClasses: []
  1036. }),
  1037. smalltalk.HLCodeWidget.klass);
  1038. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, ['browserModel'], 'Helios-Workspace');
  1039. smalltalk.addMethod(
  1040. "_browserModel",
  1041. smalltalk.method({
  1042. selector: "browserModel",
  1043. category: 'accessing',
  1044. fn: function (){
  1045. var self=this;
  1046. return smalltalk.withContext(function($ctx1) { var $1;
  1047. $1=self["@browserModel"];
  1048. return $1;
  1049. }, function($ctx1) {$ctx1.fill(self,"browserModel",{}, smalltalk.HLSourceCodeWidget)})},
  1050. args: [],
  1051. source: "browserModel\x0a\x09^ browserModel",
  1052. messageSends: [],
  1053. referencedClasses: []
  1054. }),
  1055. smalltalk.HLSourceCodeWidget);
  1056. smalltalk.addMethod(
  1057. "_browserModel_",
  1058. smalltalk.method({
  1059. selector: "browserModel:",
  1060. category: 'accessing',
  1061. fn: function (aBrowserModel){
  1062. var self=this;
  1063. return smalltalk.withContext(function($ctx1) { self["@browserModel"]=aBrowserModel;
  1064. _st(self)._observeBrowserModel();
  1065. return self}, function($ctx1) {$ctx1.fill(self,"browserModel:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget)})},
  1066. args: ["aBrowserModel"],
  1067. source: "browserModel: aBrowserModel\x0a\x09browserModel := aBrowserModel.\x0a\x09self observeBrowserModel",
  1068. messageSends: ["observeBrowserModel"],
  1069. referencedClasses: []
  1070. }),
  1071. smalltalk.HLSourceCodeWidget);
  1072. smalltalk.addMethod(
  1073. "_observeBrowserModel",
  1074. smalltalk.method({
  1075. selector: "observeBrowserModel",
  1076. category: 'actions',
  1077. fn: function (){
  1078. var self=this;
  1079. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1080. $1=_st(_st(self)._browserModel())._announcer();
  1081. _st($1)._on_do_((smalltalk.HLSaveSourceCode || HLSaveSourceCode),(function(ann){
  1082. return smalltalk.withContext(function($ctx2) { return _st(self)._onSaveIt();
  1083. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  1084. _st($1)._on_do_((smalltalk.HLParseErrorRaised || HLParseErrorRaised),(function(ann){
  1085. return smalltalk.withContext(function($ctx2) { return _st(self)._onParseError_(ann);
  1086. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  1087. _st($1)._on_do_((smalltalk.HLCompileErrorRaised || HLCompileErrorRaised),(function(ann){
  1088. return smalltalk.withContext(function($ctx2) { return _st(self)._onCompileError_(_st(ann)._error());
  1089. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  1090. _st($1)._on_do_((smalltalk.HLUnknownVariableErrorRaised || HLUnknownVariableErrorRaised),(function(ann){
  1091. return smalltalk.withContext(function($ctx2) { return _st(self)._onUnknownVariableError_(_st(ann)._error());
  1092. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  1093. $2=_st($1)._on_do_((smalltalk.HLInstVarAdded || HLInstVarAdded),(function(ann){
  1094. return smalltalk.withContext(function($ctx2) { return _st(self)._onInstVarAdded();
  1095. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  1096. return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{}, smalltalk.HLSourceCodeWidget)})},
  1097. args: [],
  1098. source: "observeBrowserModel\x0a\x09self browserModel announcer\x0a\x09\x09on: HLSaveSourceCode\x0a\x09\x09do: [ :ann | self onSaveIt ];\x0a\x09\x09on: HLParseErrorRaised\x0a\x09\x09do: [ :ann | self onParseError: ann ];\x0a\x09\x09on: HLCompileErrorRaised\x0a\x09\x09do: [ :ann | self onCompileError: ann error ];\x0a\x09\x09on: HLUnknownVariableErrorRaised\x0a\x09\x09do: [ :ann | self onUnknownVariableError: ann error ];\x0a\x09\x09on: HLInstVarAdded \x0a\x09\x09do: [ :ann | self onInstVarAdded ]",
  1099. messageSends: ["on:do:", "onSaveIt", "announcer", "browserModel", "onParseError:", "onCompileError:", "error", "onUnknownVariableError:", "onInstVarAdded"],
  1100. referencedClasses: ["HLSaveSourceCode", "HLParseErrorRaised", "HLCompileErrorRaised", "HLUnknownVariableErrorRaised", "HLInstVarAdded"]
  1101. }),
  1102. smalltalk.HLSourceCodeWidget);
  1103. smalltalk.addMethod(
  1104. "_onCompileError_",
  1105. smalltalk.method({
  1106. selector: "onCompileError:",
  1107. category: 'reactions',
  1108. fn: function (anError){
  1109. var self=this;
  1110. return smalltalk.withContext(function($ctx1) { _st(self)._alert_(_st(anError)._messageText());
  1111. return self}, function($ctx1) {$ctx1.fill(self,"onCompileError:",{anError:anError}, smalltalk.HLSourceCodeWidget)})},
  1112. args: ["anError"],
  1113. source: "onCompileError: anError\x0a\x09self alert: anError messageText",
  1114. messageSends: ["alert:", "messageText"],
  1115. referencedClasses: []
  1116. }),
  1117. smalltalk.HLSourceCodeWidget);
  1118. smalltalk.addMethod(
  1119. "_onInstVarAdded",
  1120. smalltalk.method({
  1121. selector: "onInstVarAdded",
  1122. category: 'reactions',
  1123. fn: function (){
  1124. var self=this;
  1125. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  1126. return self}, function($ctx1) {$ctx1.fill(self,"onInstVarAdded",{}, smalltalk.HLSourceCodeWidget)})},
  1127. args: [],
  1128. source: "onInstVarAdded\x0a\x09self browserModel save: self contents",
  1129. messageSends: ["save:", "contents", "browserModel"],
  1130. referencedClasses: []
  1131. }),
  1132. smalltalk.HLSourceCodeWidget);
  1133. smalltalk.addMethod(
  1134. "_onParseError_",
  1135. smalltalk.method({
  1136. selector: "onParseError:",
  1137. category: 'reactions',
  1138. fn: function (anAnnouncement){
  1139. var self=this;
  1140. var lineIndex,newContents;
  1141. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  1142. lineIndex=(1);
  1143. _st(self)._contents_(_st((smalltalk.String || String))._streamContents_((function(stream){
  1144. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._contents())._linesDo_((function(each){
  1145. return smalltalk.withContext(function($ctx3) { $1=_st(lineIndex).__eq(_st(anAnnouncement)._line());
  1146. if(smalltalk.assert($1)){
  1147. $2=stream;
  1148. _st($2)._nextPutAll_(_st(each)._copyFrom_to_((1),_st(anAnnouncement)._column()));
  1149. _st($2)._nextPutAll_("<- ");
  1150. _st($2)._nextPutAll_(_st(anAnnouncement)._message());
  1151. _st($2)._nextPutAll_(" ");
  1152. $3=_st($2)._nextPutAll_(_st(each)._copyFrom_to_(_st(_st(anAnnouncement)._column()).__plus((1)),_st(each)._size()));
  1153. $3;
  1154. } else {
  1155. _st(stream)._nextPutAll_(each);
  1156. };
  1157. _st(stream)._nextPutAll_(_st((smalltalk.String || String))._cr());
  1158. lineIndex=_st(lineIndex).__plus((1));
  1159. return lineIndex;
  1160. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1161. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  1162. return self}, function($ctx1) {$ctx1.fill(self,"onParseError:",{anAnnouncement:anAnnouncement,lineIndex:lineIndex,newContents:newContents}, smalltalk.HLSourceCodeWidget)})},
  1163. args: ["anAnnouncement"],
  1164. source: "onParseError: anAnnouncement\x0a\x09| lineIndex newContents |\x0a\x09\x0a\x09lineIndex := 1.\x0a\x09\x0a\x09self contents: (String streamContents: [ :stream |\x0a\x09\x09self contents linesDo: [ :each |\x0a\x09\x09\x09lineIndex = anAnnouncement line \x0a\x09\x09\x09\x09ifTrue: [ \x0a\x09\x09\x09\x09\x09stream \x0a\x09\x09\x09\x09\x09\x09nextPutAll: (each copyFrom: 1 to: anAnnouncement column);\x0a\x09\x09\x09\x09\x09\x09nextPutAll: '<- ';\x0a\x09\x09\x09\x09\x09\x09nextPutAll: anAnnouncement message;\x0a\x09\x09\x09\x09\x09\x09nextPutAll: ' ';\x0a\x09\x09\x09\x09\x09\x09nextPutAll: (each copyFrom: anAnnouncement column + 1 to: each size) ]\x0a\x09\x09\x09\x09ifFalse: [ stream nextPutAll: each ].\x0a\x09\x09\x09stream nextPutAll: String cr.\x0a\x09\x09\x09lineIndex := lineIndex + 1 ] ])",
  1165. messageSends: ["contents:", "streamContents:", "linesDo:", "ifTrue:ifFalse:", "nextPutAll:", "copyFrom:to:", "column", "message", "+", "size", "=", "line", "cr", "contents"],
  1166. referencedClasses: ["String"]
  1167. }),
  1168. smalltalk.HLSourceCodeWidget);
  1169. smalltalk.addMethod(
  1170. "_onSaveIt",
  1171. smalltalk.method({
  1172. selector: "onSaveIt",
  1173. category: 'reactions',
  1174. fn: function (){
  1175. var self=this;
  1176. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  1177. return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLSourceCodeWidget)})},
  1178. args: [],
  1179. source: "onSaveIt\x0a\x09self browserModel save: self contents",
  1180. messageSends: ["save:", "contents", "browserModel"],
  1181. referencedClasses: []
  1182. }),
  1183. smalltalk.HLSourceCodeWidget);
  1184. smalltalk.addMethod(
  1185. "_onUnknownVariableError_",
  1186. smalltalk.method({
  1187. selector: "onUnknownVariableError:",
  1188. category: 'reactions',
  1189. fn: function (anError){
  1190. var self=this;
  1191. var confirm;
  1192. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  1193. confirm=_st(self)._confirm_(_st((smalltalk.String || String))._streamContents_((function(stream){
  1194. return smalltalk.withContext(function($ctx2) { $1=stream;
  1195. _st($1)._nextPutAll_(_st(anError)._messageText());
  1196. _st($1)._nextPutAll_(_st((smalltalk.String || String))._cr());
  1197. $2=_st($1)._nextPutAll_("Would you like to define an instance variable?");
  1198. return $2;
  1199. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  1200. $3=confirm;
  1201. if(! smalltalk.assert($3)){
  1202. $4=self;
  1203. return $4;
  1204. };
  1205. _st(_st(self)._browserModel())._addInstVarNamed_(_st(anError)._variableName());
  1206. return self}, function($ctx1) {$ctx1.fill(self,"onUnknownVariableError:",{anError:anError,confirm:confirm}, smalltalk.HLSourceCodeWidget)})},
  1207. args: ["anError"],
  1208. source: "onUnknownVariableError: anError\x0a\x09| confirm |\x0a\x0a\x09confirm := self confirm: (String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: anError messageText;\x0a\x09\x09\x09nextPutAll: String cr;\x0a\x09\x09\x09nextPutAll: 'Would you like to define an instance variable?' ]).\x0a\x09\x09\x09\x0a\x09confirm ifFalse: [ ^ self ].\x0a\x09\x0a\x09self browserModel addInstVarNamed: anError variableName",
  1209. messageSends: ["confirm:", "streamContents:", "nextPutAll:", "messageText", "cr", "ifFalse:", "addInstVarNamed:", "variableName", "browserModel"],
  1210. referencedClasses: ["String"]
  1211. }),
  1212. smalltalk.HLSourceCodeWidget);
  1213. smalltalk.addMethod(
  1214. "_saveIt",
  1215. smalltalk.method({
  1216. selector: "saveIt",
  1217. category: 'actions',
  1218. fn: function (){
  1219. var self=this;
  1220. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._saveSourceCode();
  1221. return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLSourceCodeWidget)})},
  1222. args: [],
  1223. source: "saveIt\x0a\x09self browserModel saveSourceCode",
  1224. messageSends: ["saveSourceCode", "browserModel"],
  1225. referencedClasses: []
  1226. }),
  1227. smalltalk.HLSourceCodeWidget);
  1228. smalltalk.addMethod(
  1229. "_canBeOpenAsTab",
  1230. smalltalk.method({
  1231. selector: "canBeOpenAsTab",
  1232. category: 'testing',
  1233. fn: function (){
  1234. var self=this;
  1235. return smalltalk.withContext(function($ctx1) { return false;
  1236. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLSourceCodeWidget.klass)})},
  1237. args: [],
  1238. source: "canBeOpenAsTab\x0a\x09^ false",
  1239. messageSends: [],
  1240. referencedClasses: []
  1241. }),
  1242. smalltalk.HLSourceCodeWidget.klass);
  1243. smalltalk.addMethod(
  1244. "_on_",
  1245. smalltalk.method({
  1246. selector: "on:",
  1247. category: 'instance creation',
  1248. fn: function (aBrowserModel){
  1249. var self=this;
  1250. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1251. $2=_st(self)._new();
  1252. _st($2)._browserModel_(aBrowserModel);
  1253. $3=_st($2)._yourself();
  1254. $1=$3;
  1255. return $1;
  1256. }, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget.klass)})},
  1257. args: ["aBrowserModel"],
  1258. source: "on: aBrowserModel\x0a\x09^ self new\x0a\x09\x09browserModel: aBrowserModel;\x0a\x09\x09yourself",
  1259. messageSends: ["browserModel:", "new", "yourself"],
  1260. referencedClasses: []
  1261. }),
  1262. smalltalk.HLSourceCodeWidget.klass);