Helios-Workspace.js 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162
  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. "_clear",
  190. smalltalk.method({
  191. selector: "clear",
  192. category: 'actions',
  193. fn: function (){
  194. var self=this;
  195. return smalltalk.withContext(function($ctx1) { _st(self)._contents_("");
  196. return self}, function($ctx1) {$ctx1.fill(self,"clear",{}, smalltalk.HLCodeWidget)})},
  197. args: [],
  198. source: "clear\x0a self contents: ''",
  199. messageSends: ["contents:"],
  200. referencedClasses: []
  201. }),
  202. smalltalk.HLCodeWidget);
  203. smalltalk.addMethod(
  204. "_configureEditor",
  205. smalltalk.method({
  206. selector: "configureEditor",
  207. category: 'actions',
  208. fn: function (){
  209. var self=this;
  210. return smalltalk.withContext(function($ctx1) { _st(_st(self)._editor())._at_put_("amberCodeWidget",self);
  211. return self}, function($ctx1) {$ctx1.fill(self,"configureEditor",{}, smalltalk.HLCodeWidget)})},
  212. args: [],
  213. source: "configureEditor\x0a\x09self editor at: 'amberCodeWidget' put: self",
  214. messageSends: ["at:put:", "editor"],
  215. referencedClasses: []
  216. }),
  217. smalltalk.HLCodeWidget);
  218. smalltalk.addMethod(
  219. "_contents",
  220. smalltalk.method({
  221. selector: "contents",
  222. category: 'accessing',
  223. fn: function (){
  224. var self=this;
  225. return smalltalk.withContext(function($ctx1) { var $1;
  226. $1=_st(self["@editor"])._getValue();
  227. return $1;
  228. }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.HLCodeWidget)})},
  229. args: [],
  230. source: "contents\x0a\x09^ editor getValue",
  231. messageSends: ["getValue"],
  232. referencedClasses: []
  233. }),
  234. smalltalk.HLCodeWidget);
  235. smalltalk.addMethod(
  236. "_contents_",
  237. smalltalk.method({
  238. selector: "contents:",
  239. category: 'accessing',
  240. fn: function (aString){
  241. var self=this;
  242. return smalltalk.withContext(function($ctx1) { _st(self["@editor"])._setValue_(aString);
  243. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString}, smalltalk.HLCodeWidget)})},
  244. args: ["aString"],
  245. source: "contents: aString\x0a\x09editor setValue: aString",
  246. messageSends: ["setValue:"],
  247. referencedClasses: []
  248. }),
  249. smalltalk.HLCodeWidget);
  250. smalltalk.addMethod(
  251. "_currentLine",
  252. smalltalk.method({
  253. selector: "currentLine",
  254. category: 'accessing',
  255. fn: function (){
  256. var self=this;
  257. return smalltalk.withContext(function($ctx1) { var $1;
  258. $1=_st(self["@editor"])._getLine_(_st(_st(self["@editor"])._getCursor())._line());
  259. return $1;
  260. }, function($ctx1) {$ctx1.fill(self,"currentLine",{}, smalltalk.HLCodeWidget)})},
  261. args: [],
  262. source: "currentLine\x0a ^editor getLine: (editor getCursor line)",
  263. messageSends: ["getLine:", "line", "getCursor"],
  264. referencedClasses: []
  265. }),
  266. smalltalk.HLCodeWidget);
  267. smalltalk.addMethod(
  268. "_currentLineOrSelection",
  269. smalltalk.method({
  270. selector: "currentLineOrSelection",
  271. category: 'accessing',
  272. fn: function (){
  273. var self=this;
  274. return smalltalk.withContext(function($ctx1) { var $2,$1;
  275. $2=_st(self["@editor"])._somethingSelected();
  276. if(smalltalk.assert($2)){
  277. $1=_st(self)._selection();
  278. } else {
  279. $1=_st(self)._currentLine();
  280. };
  281. return $1;
  282. }, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{}, smalltalk.HLCodeWidget)})},
  283. args: [],
  284. source: "currentLineOrSelection\x0a ^editor somethingSelected\x0a\x09\x09ifFalse: [ self currentLine ]\x0a\x09\x09ifTrue: [ self selection ]",
  285. messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"],
  286. referencedClasses: []
  287. }),
  288. smalltalk.HLCodeWidget);
  289. smalltalk.addMethod(
  290. "_doIt",
  291. smalltalk.method({
  292. selector: "doIt",
  293. category: 'actions',
  294. fn: function (){
  295. var self=this;
  296. var result;
  297. return smalltalk.withContext(function($ctx1) { var $1;
  298. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItRequested || HLDoItRequested))._on_(self["@model"]));
  299. result=_st(self["@model"])._doIt_(_st(self)._currentLineOrSelection());
  300. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItExecuted || HLDoItExecuted))._on_(self["@model"]));
  301. $1=result;
  302. return $1;
  303. }, function($ctx1) {$ctx1.fill(self,"doIt",{result:result}, smalltalk.HLCodeWidget)})},
  304. args: [],
  305. 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 ",
  306. messageSends: ["announce:", "on:", "announcer", "doIt:", "currentLineOrSelection"],
  307. referencedClasses: ["HLDoItRequested", "HLDoItExecuted"]
  308. }),
  309. smalltalk.HLCodeWidget);
  310. smalltalk.addMethod(
  311. "_editor",
  312. smalltalk.method({
  313. selector: "editor",
  314. category: 'actions',
  315. fn: function (){
  316. var self=this;
  317. return smalltalk.withContext(function($ctx1) { var $1;
  318. $1=self["@editor"];
  319. return $1;
  320. }, function($ctx1) {$ctx1.fill(self,"editor",{}, smalltalk.HLCodeWidget)})},
  321. args: [],
  322. source: "editor\x0a\x09^editor",
  323. messageSends: [],
  324. referencedClasses: []
  325. }),
  326. smalltalk.HLCodeWidget);
  327. smalltalk.addMethod(
  328. "_focus",
  329. smalltalk.method({
  330. selector: "focus",
  331. category: 'actions',
  332. fn: function (){
  333. var self=this;
  334. return smalltalk.withContext(function($ctx1) { _st(self["@editor"])._focus();
  335. return self}, function($ctx1) {$ctx1.fill(self,"focus",{}, smalltalk.HLCodeWidget)})},
  336. args: [],
  337. source: "focus\x0a\x09editor focus",
  338. messageSends: ["focus"],
  339. referencedClasses: []
  340. }),
  341. smalltalk.HLCodeWidget);
  342. smalltalk.addMethod(
  343. "_inspectIt",
  344. smalltalk.method({
  345. selector: "inspectIt",
  346. category: 'actions',
  347. fn: function (){
  348. var self=this;
  349. var newInspector;
  350. return smalltalk.withContext(function($ctx1) { _st(_st(self)._announcer())._announce_(_st((smalltalk.HLInspectItRequested || HLInspectItRequested))._on_(self["@model"]));
  351. newInspector=_st(self)._makeInspectorOn_(_st(self)._doIt());
  352. _st(newInspector)._open();
  353. return self}, function($ctx1) {$ctx1.fill(self,"inspectIt",{newInspector:newInspector}, smalltalk.HLCodeWidget)})},
  354. args: [],
  355. source: "inspectIt\x0a\x09| newInspector |\x0a \x0a\x09self announcer announce: (HLInspectItRequested on: model).\x0a\x09newInspector := self makeInspectorOn: self doIt.\x0a\x09newInspector open",
  356. messageSends: ["announce:", "on:", "announcer", "makeInspectorOn:", "doIt", "open"],
  357. referencedClasses: ["HLInspectItRequested"]
  358. }),
  359. smalltalk.HLCodeWidget);
  360. smalltalk.addMethod(
  361. "_makeInspectorOn_",
  362. smalltalk.method({
  363. selector: "makeInspectorOn:",
  364. category: 'actions',
  365. fn: function (anObject){
  366. var self=this;
  367. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  368. $2=_st((smalltalk.HLInspector || HLInspector))._new();
  369. _st($2)._inspect_(anObject);
  370. $3=_st($2)._yourself();
  371. $1=$3;
  372. return $1;
  373. }, function($ctx1) {$ctx1.fill(self,"makeInspectorOn:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  374. args: ["anObject"],
  375. source: "makeInspectorOn: anObject\x0a\x0a\x09^ HLInspector new \x0a\x09\x09inspect: anObject;\x0a\x09\x09yourself",
  376. messageSends: ["inspect:", "new", "yourself"],
  377. referencedClasses: ["HLInspector"]
  378. }),
  379. smalltalk.HLCodeWidget);
  380. smalltalk.addMethod(
  381. "_model",
  382. smalltalk.method({
  383. selector: "model",
  384. category: 'accessing',
  385. fn: function (){
  386. var self=this;
  387. return smalltalk.withContext(function($ctx1) { var $2,$1;
  388. $2=self["@model"];
  389. if(($receiver = $2) == nil || $receiver == undefined){
  390. self["@model"]=_st((smalltalk.HLCodeModel || HLCodeModel))._new();
  391. $1=self["@model"];
  392. } else {
  393. $1=$2;
  394. };
  395. return $1;
  396. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLCodeWidget)})},
  397. args: [],
  398. source: "model\x0a\x09^ model ifNil: [ model := HLCodeModel new ]",
  399. messageSends: ["ifNil:", "new"],
  400. referencedClasses: ["HLCodeModel"]
  401. }),
  402. smalltalk.HLCodeWidget);
  403. smalltalk.addMethod(
  404. "_model_",
  405. smalltalk.method({
  406. selector: "model:",
  407. category: 'accessing',
  408. fn: function (aModel){
  409. var self=this;
  410. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  411. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLCodeWidget)})},
  412. args: ["aModel"],
  413. source: "model: aModel\x0a\x09model := aModel",
  414. messageSends: [],
  415. referencedClasses: []
  416. }),
  417. smalltalk.HLCodeWidget);
  418. smalltalk.addMethod(
  419. "_onDoIt",
  420. smalltalk.method({
  421. selector: "onDoIt",
  422. category: 'reactions',
  423. fn: function (){
  424. var self=this;
  425. return smalltalk.withContext(function($ctx1) { _st(self)._doIt();
  426. return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLCodeWidget)})},
  427. args: [],
  428. source: "onDoIt\x0a\x09\x0a self doIt",
  429. messageSends: ["doIt"],
  430. referencedClasses: []
  431. }),
  432. smalltalk.HLCodeWidget);
  433. smalltalk.addMethod(
  434. "_onInspectIt",
  435. smalltalk.method({
  436. selector: "onInspectIt",
  437. category: 'reactions',
  438. fn: function (){
  439. var self=this;
  440. return smalltalk.withContext(function($ctx1) { _st(self)._inspectIt();
  441. return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLCodeWidget)})},
  442. args: [],
  443. source: "onInspectIt\x0a\x0a\x09self inspectIt",
  444. messageSends: ["inspectIt"],
  445. referencedClasses: []
  446. }),
  447. smalltalk.HLCodeWidget);
  448. smalltalk.addMethod(
  449. "_onPrintIt",
  450. smalltalk.method({
  451. selector: "onPrintIt",
  452. category: 'reactions',
  453. fn: function (){
  454. var self=this;
  455. return smalltalk.withContext(function($ctx1) { _st(self)._printIt();
  456. return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLCodeWidget)})},
  457. args: [],
  458. source: "onPrintIt\x0a\x0a\x09self printIt",
  459. messageSends: ["printIt"],
  460. referencedClasses: []
  461. }),
  462. smalltalk.HLCodeWidget);
  463. smalltalk.addMethod(
  464. "_onSaveIt",
  465. smalltalk.method({
  466. selector: "onSaveIt",
  467. category: 'reactions',
  468. fn: function (){
  469. var self=this;
  470. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLCodeWidget)})},
  471. args: [],
  472. source: "onSaveIt\x0a\x09\x22I do not do anything\x22",
  473. messageSends: [],
  474. referencedClasses: []
  475. }),
  476. smalltalk.HLCodeWidget);
  477. smalltalk.addMethod(
  478. "_print_",
  479. smalltalk.method({
  480. selector: "print:",
  481. category: 'actions',
  482. fn: function (aString){
  483. var self=this;
  484. var start,stop,currentLine;
  485. return smalltalk.withContext(function($ctx1) { currentLine=_st(_st(self["@editor"])._getCursor_(false))._line();
  486. start=_st((smalltalk.HashedCollection || HashedCollection))._new();
  487. _st(start)._at_put_("line",currentLine);
  488. _st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
  489. _st(_st(self["@editor"])._getSelection())._ifEmpty_((function(){
  490. return smalltalk.withContext(function($ctx2) { _st(start)._at_put_("ch",_st(_st(self["@editor"])._getLine_(currentLine))._size());
  491. return _st(self["@editor"])._setSelection_end_(smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(currentLine),_st("ch").__minus_gt((0))]),start);
  492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  493. stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
  494. _st(stop)._at_put_("line",currentLine);
  495. _st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
  496. _st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
  497. _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
  498. _st(self["@editor"])._setSelection_end_(stop,start);
  499. return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine}, smalltalk.HLCodeWidget)})},
  500. args: ["aString"],
  501. 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",
  502. messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "size", "getLine:", "setSelection:end:", "->", "getSelection", "+", "at:", "replaceSelection:", ",", "setCursor:"],
  503. referencedClasses: ["HashedCollection"]
  504. }),
  505. smalltalk.HLCodeWidget);
  506. smalltalk.addMethod(
  507. "_printIt",
  508. smalltalk.method({
  509. selector: "printIt",
  510. category: 'actions',
  511. fn: function (){
  512. var self=this;
  513. var result;
  514. return smalltalk.withContext(function($ctx1) { result=_st(self)._doIt();
  515. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLPrintItRequested || HLPrintItRequested))._on_(self["@model"]));
  516. _st(self)._print_(_st(result)._printString());
  517. _st(self)._focus();
  518. return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result}, smalltalk.HLCodeWidget)})},
  519. args: [],
  520. 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.",
  521. messageSends: ["doIt", "announce:", "on:", "announcer", "print:", "printString", "focus"],
  522. referencedClasses: ["HLPrintItRequested"]
  523. }),
  524. smalltalk.HLCodeWidget);
  525. smalltalk.addMethod(
  526. "_receiver",
  527. smalltalk.method({
  528. selector: "receiver",
  529. category: 'accessing',
  530. fn: function (){
  531. var self=this;
  532. return smalltalk.withContext(function($ctx1) { var $1;
  533. $1=_st(_st(self)._model())._receiver();
  534. return $1;
  535. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeWidget)})},
  536. args: [],
  537. source: "receiver\x0a\x09^ self model receiver",
  538. messageSends: ["receiver", "model"],
  539. referencedClasses: []
  540. }),
  541. smalltalk.HLCodeWidget);
  542. smalltalk.addMethod(
  543. "_receiver_",
  544. smalltalk.method({
  545. selector: "receiver:",
  546. category: 'accessing',
  547. fn: function (anObject){
  548. var self=this;
  549. return smalltalk.withContext(function($ctx1) { _st(_st(self)._model())._receiver_(anObject);
  550. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  551. args: ["anObject"],
  552. source: "receiver: anObject\x0a\x09self model receiver: anObject",
  553. messageSends: ["receiver:", "model"],
  554. referencedClasses: []
  555. }),
  556. smalltalk.HLCodeWidget);
  557. smalltalk.addMethod(
  558. "_renderContentOn_",
  559. smalltalk.method({
  560. selector: "renderContentOn:",
  561. category: 'rendering',
  562. fn: function (html){
  563. var self=this;
  564. return smalltalk.withContext(function($ctx1) { self["@code"]=_st(html)._textarea();
  565. _st(self)._setEditorOn_(_st(self["@code"])._element());
  566. _st(self)._configureEditor();
  567. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLCodeWidget)})},
  568. args: ["html"],
  569. source: "renderContentOn: html\x0a code := html textarea.\x0a self setEditorOn: code element.\x0a self configureEditor",
  570. messageSends: ["textarea", "setEditorOn:", "element", "configureEditor"],
  571. referencedClasses: []
  572. }),
  573. smalltalk.HLCodeWidget);
  574. smalltalk.addMethod(
  575. "_saveIt",
  576. smalltalk.method({
  577. selector: "saveIt",
  578. category: 'actions',
  579. fn: function (){
  580. var self=this;
  581. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLCodeWidget)})},
  582. args: [],
  583. source: "saveIt\x0a\x09\x22I do not do anything\x22",
  584. messageSends: [],
  585. referencedClasses: []
  586. }),
  587. smalltalk.HLCodeWidget);
  588. smalltalk.addMethod(
  589. "_selection",
  590. smalltalk.method({
  591. selector: "selection",
  592. category: 'accessing',
  593. fn: function (){
  594. var self=this;
  595. return smalltalk.withContext(function($ctx1) { var $1;
  596. $1=_st(self["@editor"])._getSelection();
  597. return $1;
  598. }, function($ctx1) {$ctx1.fill(self,"selection",{}, smalltalk.HLCodeWidget)})},
  599. args: [],
  600. source: "selection\x0a\x09^editor getSelection",
  601. messageSends: ["getSelection"],
  602. referencedClasses: []
  603. }),
  604. smalltalk.HLCodeWidget);
  605. smalltalk.addMethod(
  606. "_selectionEnd",
  607. smalltalk.method({
  608. selector: "selectionEnd",
  609. category: 'accessing',
  610. fn: function (){
  611. var self=this;
  612. return smalltalk.withContext(function($ctx1) { var $1;
  613. $1=_st(_st(self["@code"])._element())._selectionEnd();
  614. return $1;
  615. }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{}, smalltalk.HLCodeWidget)})},
  616. args: [],
  617. source: "selectionEnd\x0a ^code element selectionEnd",
  618. messageSends: ["selectionEnd", "element"],
  619. referencedClasses: []
  620. }),
  621. smalltalk.HLCodeWidget);
  622. smalltalk.addMethod(
  623. "_selectionEnd_",
  624. smalltalk.method({
  625. selector: "selectionEnd:",
  626. category: 'accessing',
  627. fn: function (anInteger){
  628. var self=this;
  629. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionEnd_(anInteger);
  630. return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  631. args: ["anInteger"],
  632. source: "selectionEnd: anInteger\x0a code element selectionEnd: anInteger",
  633. messageSends: ["selectionEnd:", "element"],
  634. referencedClasses: []
  635. }),
  636. smalltalk.HLCodeWidget);
  637. smalltalk.addMethod(
  638. "_selectionStart",
  639. smalltalk.method({
  640. selector: "selectionStart",
  641. category: 'accessing',
  642. fn: function (){
  643. var self=this;
  644. return smalltalk.withContext(function($ctx1) { var $1;
  645. $1=_st(_st(self["@code"])._element())._selectionStart();
  646. return $1;
  647. }, function($ctx1) {$ctx1.fill(self,"selectionStart",{}, smalltalk.HLCodeWidget)})},
  648. args: [],
  649. source: "selectionStart\x0a ^code element selectionStart",
  650. messageSends: ["selectionStart", "element"],
  651. referencedClasses: []
  652. }),
  653. smalltalk.HLCodeWidget);
  654. smalltalk.addMethod(
  655. "_selectionStart_",
  656. smalltalk.method({
  657. selector: "selectionStart:",
  658. category: 'accessing',
  659. fn: function (anInteger){
  660. var self=this;
  661. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionStart_(anInteger);
  662. return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  663. args: ["anInteger"],
  664. source: "selectionStart: anInteger\x0a code element selectionStart: anInteger",
  665. messageSends: ["selectionStart:", "element"],
  666. referencedClasses: []
  667. }),
  668. smalltalk.HLCodeWidget);
  669. smalltalk.addMethod(
  670. "_setEditorOn_",
  671. smalltalk.method({
  672. selector: "setEditorOn:",
  673. category: 'actions',
  674. fn: function (aTextarea){
  675. var self=this;
  676. return smalltalk.withContext(function($ctx1) { self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  677. theme: 'amber',
  678. lineNumbers: true,
  679. enterMode: 'flat',
  680. indentWithTabs: true,
  681. indentUnit: 4,
  682. matchBrackets: true,
  683. electricChars: false,
  684. keyMap: 'Amber'
  685. });
  686. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea}, smalltalk.HLCodeWidget)})},
  687. args: ["aTextarea"],
  688. 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})>",
  689. messageSends: [],
  690. referencedClasses: []
  691. }),
  692. smalltalk.HLCodeWidget);
  693. smalltalk.addMethod(
  694. "_canBeOpenAsTab",
  695. smalltalk.method({
  696. selector: "canBeOpenAsTab",
  697. category: 'testing',
  698. fn: function (){
  699. var self=this;
  700. return smalltalk.withContext(function($ctx1) { return true;
  701. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLCodeWidget.klass)})},
  702. args: [],
  703. source: "canBeOpenAsTab\x0a\x09^ true",
  704. messageSends: [],
  705. referencedClasses: []
  706. }),
  707. smalltalk.HLCodeWidget.klass);
  708. smalltalk.addMethod(
  709. "_initialize",
  710. smalltalk.method({
  711. selector: "initialize",
  712. category: 'initialization',
  713. fn: function (){
  714. var self=this;
  715. return smalltalk.withContext(function($ctx1) { var $1,$2;
  716. smalltalk.HLWidget.klass.fn.prototype._initialize.apply(_st(self), []);
  717. $1=self;
  718. _st($1)._setupCodeMirror();
  719. _st($1)._setupCommands();
  720. $2=_st($1)._setupKeyMaps();
  721. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLCodeWidget.klass)})},
  722. args: [],
  723. source: "initialize\x0a\x09super initialize.\x0a\x09self \x0a\x09\x09setupCodeMirror;\x0a\x09\x09setupCommands;\x0a\x09\x09setupKeyMaps.",
  724. messageSends: ["initialize", "setupCodeMirror", "setupCommands", "setupKeyMaps"],
  725. referencedClasses: []
  726. }),
  727. smalltalk.HLCodeWidget.klass);
  728. smalltalk.addMethod(
  729. "_keyMap",
  730. smalltalk.method({
  731. selector: "keyMap",
  732. category: 'accessing',
  733. fn: function (){
  734. var self=this;
  735. return smalltalk.withContext(function($ctx1) { var $2,$1;
  736. $2=_st(_st(_st((smalltalk.HLManager || HLManager))._current())._keyBinder())._systemIsMac();
  737. if(smalltalk.assert($2)){
  738. $1=_st(self)._macKeyMap();
  739. } else {
  740. $1=_st(self)._pcKeyMap();
  741. };
  742. return $1;
  743. }, function($ctx1) {$ctx1.fill(self,"keyMap",{}, smalltalk.HLCodeWidget.klass)})},
  744. args: [],
  745. source: "keyMap\x0a\x09^ HLManager current keyBinder systemIsMac\x0a\x09\x09ifTrue: [ self macKeyMap ]\x0a\x09\x09ifFalse: [ self pcKeyMap ]",
  746. messageSends: ["ifTrue:ifFalse:", "macKeyMap", "pcKeyMap", "systemIsMac", "keyBinder", "current"],
  747. referencedClasses: ["HLManager"]
  748. }),
  749. smalltalk.HLCodeWidget.klass);
  750. smalltalk.addMethod(
  751. "_macKeyMap",
  752. smalltalk.method({
  753. selector: "macKeyMap",
  754. category: 'accessing',
  755. fn: function (){
  756. var self=this;
  757. return smalltalk.withContext(function($ctx1) { var $1;
  758. $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"])]);
  759. return $1;
  760. }, function($ctx1) {$ctx1.fill(self,"macKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  761. args: [],
  762. 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' }\x0a }",
  763. messageSends: ["->"],
  764. referencedClasses: []
  765. }),
  766. smalltalk.HLCodeWidget.klass);
  767. smalltalk.addMethod(
  768. "_pcKeyMap",
  769. smalltalk.method({
  770. selector: "pcKeyMap",
  771. category: 'accessing',
  772. fn: function (){
  773. var self=this;
  774. return smalltalk.withContext(function($ctx1) { var $1;
  775. $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"])];
  776. return $1;
  777. }, function($ctx1) {$ctx1.fill(self,"pcKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  778. args: [],
  779. 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}",
  780. messageSends: ["->"],
  781. referencedClasses: []
  782. }),
  783. smalltalk.HLCodeWidget.klass);
  784. smalltalk.addMethod(
  785. "_setupCodeMirror",
  786. smalltalk.method({
  787. selector: "setupCodeMirror",
  788. category: 'initialization',
  789. fn: function (){
  790. var self=this;
  791. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap.default.fallthrough = ["basic"] ;
  792. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{}, smalltalk.HLCodeWidget.klass)})},
  793. args: [],
  794. source: "setupCodeMirror\x0a\x09< CodeMirror.keyMap.default.fallthrough = [\x22basic\x22] >",
  795. messageSends: [],
  796. referencedClasses: []
  797. }),
  798. smalltalk.HLCodeWidget.klass);
  799. smalltalk.addMethod(
  800. "_setupCommands",
  801. smalltalk.method({
  802. selector: "setupCommands",
  803. category: 'initialization',
  804. fn: function (){
  805. var self=this;
  806. return smalltalk.withContext(function($ctx1) { var $1,$2;
  807. $1=_st((smalltalk.CodeMirror || CodeMirror))._basicAt_("commands");
  808. _st($1)._at_put_("doIt",(function(cm){
  809. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._doIt();
  810. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  811. _st($1)._at_put_("inspectIt",(function(cm){
  812. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._inspectIt();
  813. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  814. _st($1)._at_put_("printIt",(function(cm){
  815. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._printIt();
  816. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  817. $2=_st($1)._at_put_("saveIt",(function(cm){
  818. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._saveIt();
  819. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  820. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{}, smalltalk.HLCodeWidget.klass)})},
  821. args: [],
  822. 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 ]",
  823. messageSends: ["at:put:", "doIt", "amberCodeWidget", "basicAt:", "inspectIt", "printIt", "saveIt"],
  824. referencedClasses: ["CodeMirror"]
  825. }),
  826. smalltalk.HLCodeWidget.klass);
  827. smalltalk.addMethod(
  828. "_setupKeyMaps",
  829. smalltalk.method({
  830. selector: "setupKeyMaps",
  831. category: 'initialization',
  832. fn: function (){
  833. var self=this;
  834. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap['Amber'] = self._keyMap();
  835. return self}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{}, smalltalk.HLCodeWidget.klass)})},
  836. args: [],
  837. source: "setupKeyMaps\x0a\x09<CodeMirror.keyMap['Amber'] = self._keyMap()>",
  838. messageSends: [],
  839. referencedClasses: []
  840. }),
  841. smalltalk.HLCodeWidget.klass);
  842. smalltalk.addMethod(
  843. "_tabLabel",
  844. smalltalk.method({
  845. selector: "tabLabel",
  846. category: 'accessing',
  847. fn: function (){
  848. var self=this;
  849. return smalltalk.withContext(function($ctx1) { return "Workspace";
  850. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLCodeWidget.klass)})},
  851. args: [],
  852. source: "tabLabel\x0a\x09^ 'Workspace'",
  853. messageSends: [],
  854. referencedClasses: []
  855. }),
  856. smalltalk.HLCodeWidget.klass);
  857. smalltalk.addMethod(
  858. "_tabPriority",
  859. smalltalk.method({
  860. selector: "tabPriority",
  861. category: 'accessing',
  862. fn: function (){
  863. var self=this;
  864. return smalltalk.withContext(function($ctx1) { return (10);
  865. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLCodeWidget.klass)})},
  866. args: [],
  867. source: "tabPriority\x0a\x09^ 10",
  868. messageSends: [],
  869. referencedClasses: []
  870. }),
  871. smalltalk.HLCodeWidget.klass);
  872. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, ['browserModel'], 'Helios-Workspace');
  873. smalltalk.addMethod(
  874. "_browserModel",
  875. smalltalk.method({
  876. selector: "browserModel",
  877. category: 'accessing',
  878. fn: function (){
  879. var self=this;
  880. return smalltalk.withContext(function($ctx1) { var $1;
  881. $1=self["@browserModel"];
  882. return $1;
  883. }, function($ctx1) {$ctx1.fill(self,"browserModel",{}, smalltalk.HLSourceCodeWidget)})},
  884. args: [],
  885. source: "browserModel\x0a\x09^ browserModel",
  886. messageSends: [],
  887. referencedClasses: []
  888. }),
  889. smalltalk.HLSourceCodeWidget);
  890. smalltalk.addMethod(
  891. "_browserModel_",
  892. smalltalk.method({
  893. selector: "browserModel:",
  894. category: 'accessing',
  895. fn: function (aBrowserModel){
  896. var self=this;
  897. return smalltalk.withContext(function($ctx1) { self["@browserModel"]=aBrowserModel;
  898. _st(self)._observeBrowserModel();
  899. return self}, function($ctx1) {$ctx1.fill(self,"browserModel:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget)})},
  900. args: ["aBrowserModel"],
  901. source: "browserModel: aBrowserModel\x0a\x09browserModel := aBrowserModel.\x0a\x09self observeBrowserModel",
  902. messageSends: ["observeBrowserModel"],
  903. referencedClasses: []
  904. }),
  905. smalltalk.HLSourceCodeWidget);
  906. smalltalk.addMethod(
  907. "_observeBrowserModel",
  908. smalltalk.method({
  909. selector: "observeBrowserModel",
  910. category: 'actions',
  911. fn: function (){
  912. var self=this;
  913. return smalltalk.withContext(function($ctx1) { var $1,$2;
  914. $1=_st(_st(self)._browserModel())._announcer();
  915. _st($1)._on_do_((smalltalk.HLSaveSourceCode || HLSaveSourceCode),(function(ann){
  916. return smalltalk.withContext(function($ctx2) { return _st(self)._onSaveIt();
  917. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  918. _st($1)._on_do_((smalltalk.HLParseErrorRaised || HLParseErrorRaised),(function(ann){
  919. return smalltalk.withContext(function($ctx2) { return _st(self)._onParseError_(ann);
  920. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  921. _st($1)._on_do_((smalltalk.HLCompileErrorRaised || HLCompileErrorRaised),(function(ann){
  922. return smalltalk.withContext(function($ctx2) { return _st(self)._onCompileError_(_st(ann)._error());
  923. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  924. _st($1)._on_do_((smalltalk.HLUnknownVariableErrorRaised || HLUnknownVariableErrorRaised),(function(ann){
  925. return smalltalk.withContext(function($ctx2) { return _st(self)._onUnknownVariableError_(_st(ann)._error());
  926. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  927. $2=_st($1)._on_do_((smalltalk.HLInstVarAdded || HLInstVarAdded),(function(ann){
  928. return smalltalk.withContext(function($ctx2) { return _st(self)._onInstVarAdded();
  929. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  930. return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{}, smalltalk.HLSourceCodeWidget)})},
  931. args: [],
  932. 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 ]",
  933. messageSends: ["on:do:", "onSaveIt", "announcer", "browserModel", "onParseError:", "onCompileError:", "error", "onUnknownVariableError:", "onInstVarAdded"],
  934. referencedClasses: ["HLSaveSourceCode", "HLParseErrorRaised", "HLCompileErrorRaised", "HLUnknownVariableErrorRaised", "HLInstVarAdded"]
  935. }),
  936. smalltalk.HLSourceCodeWidget);
  937. smalltalk.addMethod(
  938. "_onCompileError_",
  939. smalltalk.method({
  940. selector: "onCompileError:",
  941. category: 'reactions',
  942. fn: function (anError){
  943. var self=this;
  944. return smalltalk.withContext(function($ctx1) { _st(self)._alert_(_st(anError)._messageText());
  945. return self}, function($ctx1) {$ctx1.fill(self,"onCompileError:",{anError:anError}, smalltalk.HLSourceCodeWidget)})},
  946. args: ["anError"],
  947. source: "onCompileError: anError\x0a\x09self alert: anError messageText",
  948. messageSends: ["alert:", "messageText"],
  949. referencedClasses: []
  950. }),
  951. smalltalk.HLSourceCodeWidget);
  952. smalltalk.addMethod(
  953. "_onInstVarAdded",
  954. smalltalk.method({
  955. selector: "onInstVarAdded",
  956. category: 'reactions',
  957. fn: function (){
  958. var self=this;
  959. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  960. return self}, function($ctx1) {$ctx1.fill(self,"onInstVarAdded",{}, smalltalk.HLSourceCodeWidget)})},
  961. args: [],
  962. source: "onInstVarAdded\x0a\x09self browserModel save: self contents",
  963. messageSends: ["save:", "contents", "browserModel"],
  964. referencedClasses: []
  965. }),
  966. smalltalk.HLSourceCodeWidget);
  967. smalltalk.addMethod(
  968. "_onParseError_",
  969. smalltalk.method({
  970. selector: "onParseError:",
  971. category: 'reactions',
  972. fn: function (anAnnouncement){
  973. var self=this;
  974. var lineIndex,newContents;
  975. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  976. lineIndex=(1);
  977. _st(self)._contents_(_st((smalltalk.String || String))._streamContents_((function(stream){
  978. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._contents())._linesDo_((function(each){
  979. return smalltalk.withContext(function($ctx3) { $1=_st(lineIndex).__eq(_st(anAnnouncement)._line());
  980. if(smalltalk.assert($1)){
  981. $2=stream;
  982. _st($2)._nextPutAll_(_st(each)._copyFrom_to_((1),_st(anAnnouncement)._column()));
  983. _st($2)._nextPutAll_("<- ");
  984. _st($2)._nextPutAll_(_st(anAnnouncement)._message());
  985. _st($2)._nextPutAll_(" ");
  986. $3=_st($2)._nextPutAll_(_st(each)._copyFrom_to_(_st(_st(anAnnouncement)._column()).__plus((1)),_st(each)._size()));
  987. $3;
  988. } else {
  989. _st(stream)._nextPutAll_(each);
  990. };
  991. _st(stream)._nextPutAll_(_st((smalltalk.String || String))._cr());
  992. lineIndex=_st(lineIndex).__plus((1));
  993. return lineIndex;
  994. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  995. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  996. return self}, function($ctx1) {$ctx1.fill(self,"onParseError:",{anAnnouncement:anAnnouncement,lineIndex:lineIndex,newContents:newContents}, smalltalk.HLSourceCodeWidget)})},
  997. args: ["anAnnouncement"],
  998. 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 ] ])",
  999. messageSends: ["contents:", "streamContents:", "linesDo:", "ifTrue:ifFalse:", "nextPutAll:", "copyFrom:to:", "column", "message", "+", "size", "=", "line", "cr", "contents"],
  1000. referencedClasses: ["String"]
  1001. }),
  1002. smalltalk.HLSourceCodeWidget);
  1003. smalltalk.addMethod(
  1004. "_onSaveIt",
  1005. smalltalk.method({
  1006. selector: "onSaveIt",
  1007. category: 'reactions',
  1008. fn: function (){
  1009. var self=this;
  1010. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  1011. return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLSourceCodeWidget)})},
  1012. args: [],
  1013. source: "onSaveIt\x0a\x09self browserModel save: self contents",
  1014. messageSends: ["save:", "contents", "browserModel"],
  1015. referencedClasses: []
  1016. }),
  1017. smalltalk.HLSourceCodeWidget);
  1018. smalltalk.addMethod(
  1019. "_onUnknownVariableError_",
  1020. smalltalk.method({
  1021. selector: "onUnknownVariableError:",
  1022. category: 'reactions',
  1023. fn: function (anError){
  1024. var self=this;
  1025. var confirm;
  1026. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  1027. confirm=_st(self)._confirm_(_st((smalltalk.String || String))._streamContents_((function(stream){
  1028. return smalltalk.withContext(function($ctx2) { $1=stream;
  1029. _st($1)._nextPutAll_(_st(anError)._messageText());
  1030. _st($1)._nextPutAll_(_st((smalltalk.String || String))._cr());
  1031. $2=_st($1)._nextPutAll_("Would you like to define an instance variable?");
  1032. return $2;
  1033. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  1034. $3=confirm;
  1035. if(! smalltalk.assert($3)){
  1036. $4=self;
  1037. return $4;
  1038. };
  1039. _st(_st(self)._browserModel())._addInstVarNamed_(_st(anError)._variableName());
  1040. return self}, function($ctx1) {$ctx1.fill(self,"onUnknownVariableError:",{anError:anError,confirm:confirm}, smalltalk.HLSourceCodeWidget)})},
  1041. args: ["anError"],
  1042. 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",
  1043. messageSends: ["confirm:", "streamContents:", "nextPutAll:", "messageText", "cr", "ifFalse:", "addInstVarNamed:", "variableName", "browserModel"],
  1044. referencedClasses: ["String"]
  1045. }),
  1046. smalltalk.HLSourceCodeWidget);
  1047. smalltalk.addMethod(
  1048. "_saveIt",
  1049. smalltalk.method({
  1050. selector: "saveIt",
  1051. category: 'actions',
  1052. fn: function (){
  1053. var self=this;
  1054. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._saveSourceCode();
  1055. return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLSourceCodeWidget)})},
  1056. args: [],
  1057. source: "saveIt\x0a\x09self browserModel saveSourceCode",
  1058. messageSends: ["saveSourceCode", "browserModel"],
  1059. referencedClasses: []
  1060. }),
  1061. smalltalk.HLSourceCodeWidget);
  1062. smalltalk.addMethod(
  1063. "_canBeOpenAsTab",
  1064. smalltalk.method({
  1065. selector: "canBeOpenAsTab",
  1066. category: 'testing',
  1067. fn: function (){
  1068. var self=this;
  1069. return smalltalk.withContext(function($ctx1) { return false;
  1070. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLSourceCodeWidget.klass)})},
  1071. args: [],
  1072. source: "canBeOpenAsTab\x0a\x09^ false",
  1073. messageSends: [],
  1074. referencedClasses: []
  1075. }),
  1076. smalltalk.HLSourceCodeWidget.klass);
  1077. smalltalk.addMethod(
  1078. "_on_",
  1079. smalltalk.method({
  1080. selector: "on:",
  1081. category: 'instance creation',
  1082. fn: function (aBrowserModel){
  1083. var self=this;
  1084. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1085. $2=_st(self)._new();
  1086. _st($2)._browserModel_(aBrowserModel);
  1087. $3=_st($2)._yourself();
  1088. $1=$3;
  1089. return $1;
  1090. }, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget.klass)})},
  1091. args: ["aBrowserModel"],
  1092. source: "on: aBrowserModel\x0a\x09^ self new\x0a\x09\x09browserModel: aBrowserModel;\x0a\x09\x09yourself",
  1093. messageSends: ["browserModel:", "new", "yourself"],
  1094. referencedClasses: []
  1095. }),
  1096. smalltalk.HLSourceCodeWidget.klass);