1
0

Helios-Workspace.js 45 KB

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