1
0

Helios-Workspace.js 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  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. _st(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: [ \x0a \x09self model: HLCodeModel new.\x0a\x09\x09model ]",
  399. messageSends: ["ifNil:", "model:", "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. "_initialize",
  695. smalltalk.method({
  696. selector: "initialize",
  697. category: 'initialization',
  698. fn: function (){
  699. var self=this;
  700. return smalltalk.withContext(function($ctx1) { var $1,$2;
  701. smalltalk.HLWidget.klass.fn.prototype._initialize.apply(_st(self), []);
  702. $1=self;
  703. _st($1)._setupCodeMirror();
  704. _st($1)._setupCommands();
  705. $2=_st($1)._setupKeyMaps();
  706. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLCodeWidget.klass)})},
  707. args: [],
  708. source: "initialize\x0a\x09super initialize.\x0a\x09self \x0a\x09\x09setupCodeMirror;\x0a\x09\x09setupCommands;\x0a\x09\x09setupKeyMaps.",
  709. messageSends: ["initialize", "setupCodeMirror", "setupCommands", "setupKeyMaps"],
  710. referencedClasses: []
  711. }),
  712. smalltalk.HLCodeWidget.klass);
  713. smalltalk.addMethod(
  714. "_keyMap",
  715. smalltalk.method({
  716. selector: "keyMap",
  717. category: 'accessing',
  718. fn: function (){
  719. var self=this;
  720. return smalltalk.withContext(function($ctx1) { var $2,$1;
  721. $2=_st(_st(_st((smalltalk.HLManager || HLManager))._current())._keyBinder())._systemIsMac();
  722. if(smalltalk.assert($2)){
  723. $1=_st(self)._macKeyMap();
  724. } else {
  725. $1=_st(self)._pcKeyMap();
  726. };
  727. return $1;
  728. }, function($ctx1) {$ctx1.fill(self,"keyMap",{}, smalltalk.HLCodeWidget.klass)})},
  729. args: [],
  730. source: "keyMap\x0a\x09^ HLManager current keyBinder systemIsMac\x0a\x09\x09ifTrue: [ self macKeyMap ]\x0a\x09\x09ifFalse: [ self pcKeyMap ]",
  731. messageSends: ["ifTrue:ifFalse:", "macKeyMap", "pcKeyMap", "systemIsMac", "keyBinder", "current"],
  732. referencedClasses: ["HLManager"]
  733. }),
  734. smalltalk.HLCodeWidget.klass);
  735. smalltalk.addMethod(
  736. "_macKeyMap",
  737. smalltalk.method({
  738. selector: "macKeyMap",
  739. category: 'accessing',
  740. fn: function (){
  741. var self=this;
  742. return smalltalk.withContext(function($ctx1) { var $1;
  743. $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"])]);
  744. return $1;
  745. }, function($ctx1) {$ctx1.fill(self,"macKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  746. args: [],
  747. 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 }",
  748. messageSends: ["->"],
  749. referencedClasses: []
  750. }),
  751. smalltalk.HLCodeWidget.klass);
  752. smalltalk.addMethod(
  753. "_pcKeyMap",
  754. smalltalk.method({
  755. selector: "pcKeyMap",
  756. category: 'accessing',
  757. fn: function (){
  758. var self=this;
  759. return smalltalk.withContext(function($ctx1) { var $1;
  760. $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"])];
  761. return $1;
  762. }, function($ctx1) {$ctx1.fill(self,"pcKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  763. args: [],
  764. 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}",
  765. messageSends: ["->"],
  766. referencedClasses: []
  767. }),
  768. smalltalk.HLCodeWidget.klass);
  769. smalltalk.addMethod(
  770. "_setupCodeMirror",
  771. smalltalk.method({
  772. selector: "setupCodeMirror",
  773. category: 'initialization',
  774. fn: function (){
  775. var self=this;
  776. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap.default.fallthrough = ["basic"] ;
  777. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{}, smalltalk.HLCodeWidget.klass)})},
  778. args: [],
  779. source: "setupCodeMirror\x0a\x09< CodeMirror.keyMap.default.fallthrough = [\x22basic\x22] >",
  780. messageSends: [],
  781. referencedClasses: []
  782. }),
  783. smalltalk.HLCodeWidget.klass);
  784. smalltalk.addMethod(
  785. "_setupCommands",
  786. smalltalk.method({
  787. selector: "setupCommands",
  788. category: 'initialization',
  789. fn: function (){
  790. var self=this;
  791. return smalltalk.withContext(function($ctx1) { var $1,$2;
  792. $1=_st((smalltalk.CodeMirror || CodeMirror))._basicAt_("commands");
  793. _st($1)._at_put_("doIt",(function(cm){
  794. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._doIt();
  795. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  796. _st($1)._at_put_("inspectIt",(function(cm){
  797. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._inspectIt();
  798. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  799. _st($1)._at_put_("printIt",(function(cm){
  800. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._printIt();
  801. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  802. $2=_st($1)._at_put_("saveIt",(function(cm){
  803. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._saveIt();
  804. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  805. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{}, smalltalk.HLCodeWidget.klass)})},
  806. args: [],
  807. 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 ]",
  808. messageSends: ["at:put:", "doIt", "amberCodeWidget", "basicAt:", "inspectIt", "printIt", "saveIt"],
  809. referencedClasses: ["CodeMirror"]
  810. }),
  811. smalltalk.HLCodeWidget.klass);
  812. smalltalk.addMethod(
  813. "_setupKeyMaps",
  814. smalltalk.method({
  815. selector: "setupKeyMaps",
  816. category: 'initialization',
  817. fn: function (){
  818. var self=this;
  819. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap['Amber'] = self._keyMap();
  820. return self}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{}, smalltalk.HLCodeWidget.klass)})},
  821. args: [],
  822. source: "setupKeyMaps\x0a\x09<CodeMirror.keyMap['Amber'] = self._keyMap()>",
  823. messageSends: [],
  824. referencedClasses: []
  825. }),
  826. smalltalk.HLCodeWidget.klass);
  827. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, [], 'Helios-Workspace');
  828. smalltalk.addMethod(
  829. "_onKeyDown_",
  830. smalltalk.method({
  831. selector: "onKeyDown:",
  832. category: 'reactions',
  833. fn: function (anEvent){
  834. var self=this;
  835. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  836. $1=smalltalk.HLCodeWidget.fn.prototype._onKeyDown_.apply(_st(self), [anEvent]);
  837. if(! smalltalk.assert($1)){
  838. return false;
  839. };
  840. $2=_st(anEvent)._ctrlKey();
  841. if(smalltalk.assert($2)){
  842. $3=_st(_st(anEvent)._keyCode()).__eq((83));
  843. if(smalltalk.assert($3)){
  844. _st(self)._onSave();
  845. _st(anEvent)._preventDefault();
  846. return false;
  847. };
  848. };
  849. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLSourceCodeWidget)})},
  850. args: ["anEvent"],
  851. source: "onKeyDown: anEvent\x0a\x09(super onKeyDown: anEvent) ifFalse: [ ^ false ].\x0a \x0a\x09anEvent ctrlKey ifTrue: [\x0a\x09\x09anEvent keyCode = 83 ifTrue: [\x0a\x09\x09\x09self onSave.\x0a\x09\x09\x09anEvent preventDefault.\x0a\x09\x09\x09^ false ] ]",
  852. messageSends: ["ifFalse:", "onKeyDown:", "ifTrue:", "onSave", "preventDefault", "=", "keyCode", "ctrlKey"],
  853. referencedClasses: []
  854. }),
  855. smalltalk.HLSourceCodeWidget);
  856. smalltalk.addMethod(
  857. "_onSave",
  858. smalltalk.method({
  859. selector: "onSave",
  860. category: 'reactions',
  861. fn: function (){
  862. var self=this;
  863. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSave",{}, smalltalk.HLSourceCodeWidget)})},
  864. args: [],
  865. source: "onSave",
  866. messageSends: [],
  867. referencedClasses: []
  868. }),
  869. smalltalk.HLSourceCodeWidget);
  870. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['model', 'codeWidget'], 'Helios-Workspace');
  871. smalltalk.addMethod(
  872. "_codeWidget",
  873. smalltalk.method({
  874. selector: "codeWidget",
  875. category: 'accessing',
  876. fn: function (){
  877. var self=this;
  878. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$1;
  879. $2=self["@codeWidget"];
  880. if(($receiver = $2) == nil || $receiver == undefined){
  881. $3=_st((smalltalk.HLCodeWidget || HLCodeWidget))._new();
  882. _st($3)._model_(_st(_st(self)._model())._code());
  883. $4=_st($3)._yourself();
  884. self["@codeWidget"]=$4;
  885. $1=self["@codeWidget"];
  886. } else {
  887. $1=$2;
  888. };
  889. return $1;
  890. }, function($ctx1) {$ctx1.fill(self,"codeWidget",{}, smalltalk.HLWorkspace)})},
  891. args: [],
  892. source: "codeWidget\x0a\x09^ codeWidget ifNil: [\x0a\x09\x09codeWidget := HLCodeWidget new\x0a \x09\x09model: self model code;\x0a \x09yourself ]",
  893. messageSends: ["ifNil:", "model:", "code", "model", "new", "yourself"],
  894. referencedClasses: ["HLCodeWidget"]
  895. }),
  896. smalltalk.HLWorkspace);
  897. smalltalk.addMethod(
  898. "_model",
  899. smalltalk.method({
  900. selector: "model",
  901. category: 'accessing',
  902. fn: function (){
  903. var self=this;
  904. return smalltalk.withContext(function($ctx1) { var $2,$1;
  905. $2=self["@model"];
  906. if(($receiver = $2) == nil || $receiver == undefined){
  907. _st(self)._model_(_st((smalltalk.HLWorkspaceModel || HLWorkspaceModel))._new());
  908. $1=self["@model"];
  909. } else {
  910. $1=$2;
  911. };
  912. return $1;
  913. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLWorkspace)})},
  914. args: [],
  915. source: "model\x0a\x09^ model ifNil: [ \x0a \x09self model: HLWorkspaceModel new.\x0a\x09\x09model ]",
  916. messageSends: ["ifNil:", "model:", "new"],
  917. referencedClasses: ["HLWorkspaceModel"]
  918. }),
  919. smalltalk.HLWorkspace);
  920. smalltalk.addMethod(
  921. "_model_",
  922. smalltalk.method({
  923. selector: "model:",
  924. category: 'accessing',
  925. fn: function (aModel){
  926. var self=this;
  927. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  928. _st(_st(self)._codeWidget())._model_(_st(aModel)._code());
  929. _st(self)._observeCodeWidget();
  930. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLWorkspace)})},
  931. args: ["aModel"],
  932. source: "model: aModel\x0a\x09model := aModel.\x0a \x0a self codeWidget model: aModel code.\x0a self observeCodeWidget.\x0a ",
  933. messageSends: ["model:", "code", "codeWidget", "observeCodeWidget"],
  934. referencedClasses: []
  935. }),
  936. smalltalk.HLWorkspace);
  937. smalltalk.addMethod(
  938. "_observeCodeWidget",
  939. smalltalk.method({
  940. selector: "observeCodeWidget",
  941. category: 'actions',
  942. fn: function (){
  943. var self=this;
  944. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"observeCodeWidget",{}, smalltalk.HLWorkspace)})},
  945. args: [],
  946. source: "observeCodeWidget\x0a\x0a",
  947. messageSends: [],
  948. referencedClasses: []
  949. }),
  950. smalltalk.HLWorkspace);
  951. smalltalk.addMethod(
  952. "_onDoIt",
  953. smalltalk.method({
  954. selector: "onDoIt",
  955. category: 'reactions',
  956. fn: function (){
  957. var self=this;
  958. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLWorkspace)})},
  959. args: [],
  960. source: "onDoIt",
  961. messageSends: [],
  962. referencedClasses: []
  963. }),
  964. smalltalk.HLWorkspace);
  965. smalltalk.addMethod(
  966. "_onInspectIt",
  967. smalltalk.method({
  968. selector: "onInspectIt",
  969. category: 'reactions',
  970. fn: function (){
  971. var self=this;
  972. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLWorkspace)})},
  973. args: [],
  974. source: "onInspectIt",
  975. messageSends: [],
  976. referencedClasses: []
  977. }),
  978. smalltalk.HLWorkspace);
  979. smalltalk.addMethod(
  980. "_onPrintIt",
  981. smalltalk.method({
  982. selector: "onPrintIt",
  983. category: 'reactions',
  984. fn: function (){
  985. var self=this;
  986. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLWorkspace)})},
  987. args: [],
  988. source: "onPrintIt",
  989. messageSends: [],
  990. referencedClasses: []
  991. }),
  992. smalltalk.HLWorkspace);
  993. smalltalk.addMethod(
  994. "_renderContentOn_",
  995. smalltalk.method({
  996. selector: "renderContentOn:",
  997. category: 'rendering',
  998. fn: function (html){
  999. var self=this;
  1000. return smalltalk.withContext(function($ctx1) { _st(html)._with_(_st(self)._codeWidget());
  1001. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLWorkspace)})},
  1002. args: ["html"],
  1003. source: "renderContentOn: html\x0a\x09html with: self codeWidget\x0a ",
  1004. messageSends: ["with:", "codeWidget"],
  1005. referencedClasses: []
  1006. }),
  1007. smalltalk.HLWorkspace);
  1008. smalltalk.addMethod(
  1009. "_canBeOpenAsTab",
  1010. smalltalk.method({
  1011. selector: "canBeOpenAsTab",
  1012. category: 'testing',
  1013. fn: function (){
  1014. var self=this;
  1015. return smalltalk.withContext(function($ctx1) { return true;
  1016. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLWorkspace.klass)})},
  1017. args: [],
  1018. source: "canBeOpenAsTab\x0a\x09^ true",
  1019. messageSends: [],
  1020. referencedClasses: []
  1021. }),
  1022. smalltalk.HLWorkspace.klass);
  1023. smalltalk.addMethod(
  1024. "_tabLabel",
  1025. smalltalk.method({
  1026. selector: "tabLabel",
  1027. category: 'accessing',
  1028. fn: function (){
  1029. var self=this;
  1030. return smalltalk.withContext(function($ctx1) { return "Workspace";
  1031. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLWorkspace.klass)})},
  1032. args: [],
  1033. source: "tabLabel\x0a\x09^ 'Workspace'",
  1034. messageSends: [],
  1035. referencedClasses: []
  1036. }),
  1037. smalltalk.HLWorkspace.klass);
  1038. smalltalk.addMethod(
  1039. "_tabPriority",
  1040. smalltalk.method({
  1041. selector: "tabPriority",
  1042. category: 'accessing',
  1043. fn: function (){
  1044. var self=this;
  1045. return smalltalk.withContext(function($ctx1) { return (10);
  1046. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLWorkspace.klass)})},
  1047. args: [],
  1048. source: "tabPriority\x0a\x09^ 10",
  1049. messageSends: [],
  1050. referencedClasses: []
  1051. }),
  1052. smalltalk.HLWorkspace.klass);
  1053. smalltalk.addClass('HLWorkspaceModel', smalltalk.Object, ['announcer', 'environment', 'code'], 'Helios-Workspace');
  1054. smalltalk.addMethod(
  1055. "_announcer",
  1056. smalltalk.method({
  1057. selector: "announcer",
  1058. category: 'accessing',
  1059. fn: function (){
  1060. var self=this;
  1061. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1062. $2=self["@announcer"];
  1063. if(($receiver = $2) == nil || $receiver == undefined){
  1064. self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
  1065. $1=self["@announcer"];
  1066. } else {
  1067. $1=$2;
  1068. };
  1069. return $1;
  1070. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLWorkspaceModel)})},
  1071. args: [],
  1072. source: "announcer\x0a\x09^ announcer ifNil: [ announcer := Announcer new ]",
  1073. messageSends: ["ifNil:", "new"],
  1074. referencedClasses: ["Announcer"]
  1075. }),
  1076. smalltalk.HLWorkspaceModel);
  1077. smalltalk.addMethod(
  1078. "_code",
  1079. smalltalk.method({
  1080. selector: "code",
  1081. category: 'accessing',
  1082. fn: function (){
  1083. var self=this;
  1084. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1085. $2=self["@code"];
  1086. if(($receiver = $2) == nil || $receiver == undefined){
  1087. $1=_st((smalltalk.HLCodeModel || HLCodeModel))._on_(_st(self)._environment());
  1088. } else {
  1089. $1=$2;
  1090. };
  1091. return $1;
  1092. }, function($ctx1) {$ctx1.fill(self,"code",{}, smalltalk.HLWorkspaceModel)})},
  1093. args: [],
  1094. source: "code\x0a\x09\x22Answers the code model working for this workspace model\x22\x0a\x09^ code ifNil:[ HLCodeModel on: self environment ]",
  1095. messageSends: ["ifNil:", "on:", "environment"],
  1096. referencedClasses: ["HLCodeModel"]
  1097. }),
  1098. smalltalk.HLWorkspaceModel);
  1099. smalltalk.addMethod(
  1100. "_environment",
  1101. smalltalk.method({
  1102. selector: "environment",
  1103. category: 'accessing',
  1104. fn: function (){
  1105. var self=this;
  1106. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1107. $2=self["@environment"];
  1108. if(($receiver = $2) == nil || $receiver == undefined){
  1109. $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
  1110. } else {
  1111. $1=$2;
  1112. };
  1113. return $1;
  1114. }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLWorkspaceModel)})},
  1115. args: [],
  1116. source: "environment\x0a\x09^ environment ifNil: [ HLManager current environment ]",
  1117. messageSends: ["ifNil:", "environment", "current"],
  1118. referencedClasses: ["HLManager"]
  1119. }),
  1120. smalltalk.HLWorkspaceModel);
  1121. smalltalk.addMethod(
  1122. "_environment_",
  1123. smalltalk.method({
  1124. selector: "environment:",
  1125. category: 'accessing',
  1126. fn: function (anEnvironment){
  1127. var self=this;
  1128. return smalltalk.withContext(function($ctx1) { self["@environment"]=anEnvironment;
  1129. return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel)})},
  1130. args: ["anEnvironment"],
  1131. source: "environment: anEnvironment\x0a\x09environment := anEnvironment",
  1132. messageSends: [],
  1133. referencedClasses: []
  1134. }),
  1135. smalltalk.HLWorkspaceModel);
  1136. smalltalk.addMethod(
  1137. "_onKeyDown_",
  1138. smalltalk.method({
  1139. selector: "onKeyDown:",
  1140. category: 'reactions',
  1141. fn: function (anEvent){
  1142. var self=this;
  1143. return smalltalk.withContext(function($ctx1) { if(anEvent.ctrlKey) {
  1144. if(anEvent.keyCode === 80) { //ctrl+p
  1145. self._printIt();
  1146. anEvent.preventDefault();
  1147. return false;
  1148. }
  1149. if(anEvent.keyCode === 68) { //ctrl+d
  1150. self._doIt();
  1151. anEvent.preventDefault();
  1152. return false;
  1153. }
  1154. if(anEvent.keyCode === 73) { //ctrl+i
  1155. self._inspectIt();
  1156. anEvent.preventDefault();
  1157. return false;
  1158. }
  1159. };
  1160. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLWorkspaceModel)})},
  1161. args: ["anEvent"],
  1162. source: "onKeyDown: anEvent\x0a\x0a\x09<if(anEvent.ctrlKey) {\x0a\x09\x09if(anEvent.keyCode === 80) { //ctrl+p\x0a\x09\x09\x09self._printIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09if(anEvent.keyCode === 68) { //ctrl+d\x0a\x09\x09\x09self._doIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09if(anEvent.keyCode === 73) { //ctrl+i\x0a\x09\x09\x09self._inspectIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09}>",
  1163. messageSends: [],
  1164. referencedClasses: []
  1165. }),
  1166. smalltalk.HLWorkspaceModel);
  1167. smalltalk.addMethod(
  1168. "_on_",
  1169. smalltalk.method({
  1170. selector: "on:",
  1171. category: 'actions',
  1172. fn: function (anEnvironment){
  1173. var self=this;
  1174. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1175. $2=_st(self)._new();
  1176. _st($2)._environment_(anEnvironment);
  1177. $3=_st($2)._yourself();
  1178. $1=$3;
  1179. return $1;
  1180. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel.klass)})},
  1181. args: ["anEnvironment"],
  1182. source: "on: anEnvironment\x0a\x0a\x09^ self new\x0a \x09environment: anEnvironment;\x0a yourself",
  1183. messageSends: ["environment:", "new", "yourself"],
  1184. referencedClasses: []
  1185. }),
  1186. smalltalk.HLWorkspaceModel.klass);