1
0

Helios-Workspace.deploy.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  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. fn: function () {
  8. var self = this;
  9. var $1;
  10. if (($receiver = self['@announcer']) == nil || $receiver == undefined) {
  11. self['@announcer'] = smalltalk.send(smalltalk.Announcer || Announcer, "_new", []);
  12. $1 = self['@announcer'];
  13. } else {
  14. $1 = self['@announcer'];
  15. }
  16. return $1;
  17. }
  18. }),
  19. smalltalk.HLCodeModel);
  20. smalltalk.addMethod(
  21. "_defaultReceiver",
  22. smalltalk.method({
  23. selector: "defaultReceiver",
  24. fn: function () {
  25. var self = this;
  26. var $1;
  27. $1 = smalltalk.send(smalltalk.DoIt || DoIt, "_new", []);
  28. return $1;
  29. }
  30. }),
  31. smalltalk.HLCodeModel);
  32. smalltalk.addMethod(
  33. "_doIt_",
  34. smalltalk.method({
  35. selector: "doIt:",
  36. fn: function (someCode) {
  37. var self = this;
  38. var $1;
  39. $1 = smalltalk.send(smalltalk.send(self, "_environment", []), "_eval_on_", [someCode, smalltalk.send(self, "_receiver", [])]);
  40. return $1;
  41. }
  42. }),
  43. smalltalk.HLCodeModel);
  44. smalltalk.addMethod(
  45. "_environment",
  46. smalltalk.method({
  47. selector: "environment",
  48. fn: function () {
  49. var self = this;
  50. var $1;
  51. if (($receiver = self['@environment']) == nil || $receiver == undefined) {
  52. $1 = smalltalk.send(smalltalk.send(smalltalk.HLManager || HLManager, "_current", []), "_environment", []);
  53. } else {
  54. $1 = self['@environment'];
  55. }
  56. return $1;
  57. }
  58. }),
  59. smalltalk.HLCodeModel);
  60. smalltalk.addMethod(
  61. "_environment_",
  62. smalltalk.method({
  63. selector: "environment:",
  64. fn: function (anEnvironment) {
  65. var self = this;
  66. self['@environment'] = anEnvironment;
  67. return self;
  68. }
  69. }),
  70. smalltalk.HLCodeModel);
  71. smalltalk.addMethod(
  72. "_receiver",
  73. smalltalk.method({
  74. selector: "receiver",
  75. fn: function () {
  76. var self = this;
  77. var $1;
  78. if (($receiver = self['@receiver']) == nil || $receiver == undefined) {
  79. self['@receiver'] = smalltalk.send(self, "_defaultReceiver", []);
  80. $1 = self['@receiver'];
  81. } else {
  82. $1 = self['@receiver'];
  83. }
  84. return $1;
  85. }
  86. }),
  87. smalltalk.HLCodeModel);
  88. smalltalk.addMethod(
  89. "_receiver_",
  90. smalltalk.method({
  91. selector: "receiver:",
  92. fn: function (anObject) {
  93. var self = this;
  94. self['@receiver'] = anObject;
  95. return self;
  96. }
  97. }),
  98. smalltalk.HLCodeModel);
  99. smalltalk.addMethod(
  100. "_subscribe_",
  101. smalltalk.method({
  102. selector: "subscribe:",
  103. fn: function (aWidget) {
  104. var self = this;
  105. smalltalk.send(aWidget, "_subscribeTo_", [smalltalk.send(self, "_announcer", [])]);
  106. return self;
  107. }
  108. }),
  109. smalltalk.HLCodeModel);
  110. smalltalk.addMethod(
  111. "_on_",
  112. smalltalk.method({
  113. selector: "on:",
  114. fn: function (anEnvironment) {
  115. var self = this;
  116. var $2, $3, $1;
  117. $2 = smalltalk.send(self, "_new", []);
  118. smalltalk.send($2, "_environment_", [anEnvironment]);
  119. $3 = smalltalk.send($2, "_yourself", []);
  120. $1 = $3;
  121. return $1;
  122. }
  123. }),
  124. smalltalk.HLCodeModel.klass);
  125. smalltalk.addClass('HLCodeWidget', smalltalk.HLWidget, ['model', 'wrapper', 'code', 'editor'], 'Helios-Workspace');
  126. smalltalk.addMethod(
  127. "_announcer",
  128. smalltalk.method({
  129. selector: "announcer",
  130. fn: function () {
  131. var self = this;
  132. var $1;
  133. $1 = smalltalk.send(smalltalk.send(self, "_model", []), "_announcer", []);
  134. return $1;
  135. }
  136. }),
  137. smalltalk.HLCodeWidget);
  138. smalltalk.addMethod(
  139. "_clear",
  140. smalltalk.method({
  141. selector: "clear",
  142. fn: function () {
  143. var self = this;
  144. smalltalk.send(self, "_contents_", [""]);
  145. return self;
  146. }
  147. }),
  148. smalltalk.HLCodeWidget);
  149. smalltalk.addMethod(
  150. "_contents",
  151. smalltalk.method({
  152. selector: "contents",
  153. fn: function (){
  154. var self=this;
  155. var $1;
  156. $1=smalltalk.send(self["@editor"],"_getValue",[]);
  157. return $1;
  158. }
  159. }),
  160. smalltalk.HLCodeWidget);
  161. smalltalk.addMethod(
  162. "_contents_",
  163. smalltalk.method({
  164. selector: "contents:",
  165. fn: function (aString){
  166. var self=this;
  167. smalltalk.send(self["@editor"],"_setValue_",[aString]);
  168. return self}
  169. }),
  170. smalltalk.HLCodeWidget);
  171. smalltalk.addMethod(
  172. "_currentLine",
  173. smalltalk.method({
  174. selector: "currentLine",
  175. fn: function () {
  176. var self = this;
  177. var $1;
  178. $1 = smalltalk.send(self['@editor'], "_getLine_", [smalltalk.send(smalltalk.send(self['@editor'], "_getCursor", []), "_line", [])]);
  179. return $1;
  180. }
  181. }),
  182. smalltalk.HLCodeWidget);
  183. smalltalk.addMethod(
  184. "_currentLineOrSelection",
  185. smalltalk.method({
  186. selector: "currentLineOrSelection",
  187. fn: function () {
  188. var self = this;
  189. var $2, $1;
  190. $2 = smalltalk.send(self['@editor'], "_somethingSelected", []);
  191. if (smalltalk.assert($2)) {
  192. $1 = smalltalk.send(self, "_selection", []);
  193. } else {
  194. $1 = smalltalk.send(self, "_currentLine", []);
  195. }
  196. return $1;
  197. }
  198. }),
  199. smalltalk.HLCodeWidget);
  200. smalltalk.addMethod(
  201. "_doIt",
  202. smalltalk.method({
  203. selector: "doIt",
  204. fn: function () {
  205. var self = this;
  206. var result;
  207. smalltalk.send(smalltalk.send(self, "_announcer", []), "_announce_", [smalltalk.send(smalltalk.HLDoItRequested || HLDoItRequested, "_on_", [self['@model']])]);
  208. result = smalltalk.send(self['@model'], "_doIt_", [smalltalk.send(self, "_currentLineOrSelection", [])]);
  209. smalltalk.send(smalltalk.send(self, "_announcer", []), "_announce_", [smalltalk.send(smalltalk.HLDoItExecuted || HLDoItExecuted, "_on_", [self['@model']])]);
  210. return result;
  211. }
  212. }),
  213. smalltalk.HLCodeWidget);
  214. smalltalk.addMethod(
  215. "_editor",
  216. smalltalk.method({
  217. selector: "editor",
  218. fn: function () {
  219. var self = this;
  220. return self['@editor'];
  221. }
  222. }),
  223. smalltalk.HLCodeWidget);
  224. smalltalk.addMethod(
  225. "_focus",
  226. smalltalk.method({
  227. selector: "focus",
  228. fn: function () {
  229. var self = this;
  230. smalltalk.send(smalltalk.send(self, "_editor", []), "_focus", []);
  231. return self;
  232. }
  233. }),
  234. smalltalk.HLCodeWidget);
  235. smalltalk.addMethod(
  236. "_inspectIt",
  237. smalltalk.method({
  238. selector: "inspectIt",
  239. fn: function () {
  240. var self = this;
  241. var newInspector;
  242. smalltalk.send(smalltalk.send(self, "_announcer", []), "_announce_", [smalltalk.send(smalltalk.HLInspectItRequested || HLInspectItRequested, "_on_", [self['@model']])]);
  243. newInspector = smalltalk.send(self, "_makeInspectorOn_", [smalltalk.send(self, "_doIt", [])]);
  244. smalltalk.send(newInspector, "_open", []);
  245. return self;
  246. }
  247. }),
  248. smalltalk.HLCodeWidget);
  249. smalltalk.addMethod(
  250. "_makeInspectorOn_",
  251. smalltalk.method({
  252. selector: "makeInspectorOn:",
  253. fn: function (anObject) {
  254. var self = this;
  255. var $2, $3, $1;
  256. $2 = smalltalk.send(smalltalk.HLInspector || HLInspector, "_new", []);
  257. smalltalk.send($2, "_inspect_", [anObject]);
  258. $3 = smalltalk.send($2, "_yourself", []);
  259. $1 = $3;
  260. return $1;
  261. }
  262. }),
  263. smalltalk.HLCodeWidget);
  264. smalltalk.addMethod(
  265. "_model",
  266. smalltalk.method({
  267. selector: "model",
  268. fn: function () {
  269. var self = this;
  270. var $1;
  271. if (($receiver = self['@model']) == nil || $receiver == undefined) {
  272. smalltalk.send(self, "_model_", [smalltalk.send(smalltalk.HLCodeModel || HLCodeModel, "_new", [])]);
  273. $1 = self['@model'];
  274. } else {
  275. $1 = self['@model'];
  276. }
  277. return $1;
  278. }
  279. }),
  280. smalltalk.HLCodeWidget);
  281. smalltalk.addMethod(
  282. "_model_",
  283. smalltalk.method({
  284. selector: "model:",
  285. fn: function (aModel){
  286. var self=this;
  287. self["@model"]=aModel;
  288. return self}
  289. }),
  290. smalltalk.HLCodeWidget);
  291. smalltalk.addMethod(
  292. "_observeWrapper",
  293. smalltalk.method({
  294. selector: "observeWrapper",
  295. fn: function () {
  296. var self = this;
  297. smalltalk.send(self['@wrapper'], "_onKeyDown_", [function (e) {return smalltalk.send(self, "_onKeyDown_", [e]);}]);
  298. return self;
  299. }
  300. }),
  301. smalltalk.HLCodeWidget);
  302. smalltalk.addMethod(
  303. "_onDoIt",
  304. smalltalk.method({
  305. selector: "onDoIt",
  306. fn: function () {
  307. var self = this;
  308. smalltalk.send(self, "_doIt", []);
  309. return self;
  310. }
  311. }),
  312. smalltalk.HLCodeWidget);
  313. smalltalk.addMethod(
  314. "_onInspectIt",
  315. smalltalk.method({
  316. selector: "onInspectIt",
  317. fn: function () {
  318. var self = this;
  319. smalltalk.send(self, "_inspectIt", []);
  320. return self;
  321. }
  322. }),
  323. smalltalk.HLCodeWidget);
  324. smalltalk.addMethod(
  325. "_onKeyDown_",
  326. smalltalk.method({
  327. selector: "onKeyDown:",
  328. fn: function (anEvent) {
  329. var self = this;
  330. if (anEvent.ctrlKey) {
  331. if (anEvent.keyCode === 80) {
  332. self._onPrintIt();
  333. anEvent.preventDefault();
  334. return false;
  335. }
  336. if (anEvent.keyCode === 68) {
  337. self._onDoIt();
  338. anEvent.preventDefault();
  339. return false;
  340. }
  341. if (anEvent.keyCode === 73) {
  342. self._onInspectIt();
  343. anEvent.preventDefault();
  344. return false;
  345. }
  346. }
  347. return self;
  348. }
  349. }),
  350. smalltalk.HLCodeWidget);
  351. smalltalk.addMethod(
  352. "_onPrintIt",
  353. smalltalk.method({
  354. selector: "onPrintIt",
  355. fn: function () {
  356. var self = this;
  357. smalltalk.send(self, "_printIt", []);
  358. return self;
  359. }
  360. }),
  361. smalltalk.HLCodeWidget);
  362. smalltalk.addMethod(
  363. "_print_",
  364. smalltalk.method({
  365. selector: "print:",
  366. fn: function (aString) {
  367. var self = this;
  368. var start;
  369. var stop;
  370. start = smalltalk.send(smalltalk.HashedCollection || HashedCollection, "_new", []);
  371. stop = smalltalk.send(smalltalk.HashedCollection || HashedCollection, "_new", []);
  372. smalltalk.send(start, "_at_put_", ["line", smalltalk.send(smalltalk.send(self['@editor'], "_getCursor_", [false]), "_line", [])]);
  373. smalltalk.send(start, "_at_put_", ["ch", smalltalk.send(smalltalk.send(self['@editor'], "_getCursor_", [false]), "_ch", [])]);
  374. smalltalk.send(stop, "_at_put_", ["line", smalltalk.send(start, "_at_", ["line"])]);
  375. smalltalk.send(stop, "_at_put_", ["ch", smalltalk.send(smalltalk.send(smalltalk.send(start, "_at_", ["ch"]), "__plus", [smalltalk.send(aString, "_size", [])]), "__plus", [2])]);
  376. smalltalk.send(self['@editor'], "_replaceSelection_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self['@editor'], "_getSelection", []), "__comma", [" "]), "__comma", [aString]), "__comma", [" "])]);
  377. smalltalk.send(self['@editor'], "_setCursor_", [smalltalk.send(self['@editor'], "_getCursor_", [true])]);
  378. smalltalk.send(self['@editor'], "_setSelection_end_", [stop, start]);
  379. return self;
  380. }
  381. }),
  382. smalltalk.HLCodeWidget);
  383. smalltalk.addMethod(
  384. "_printIt",
  385. smalltalk.method({
  386. selector: "printIt",
  387. fn: function () {
  388. var self = this;
  389. var result;
  390. result = smalltalk.send(self, "_doIt", []);
  391. smalltalk.send(smalltalk.send(self, "_announcer", []), "_announce_", [smalltalk.send(smalltalk.HLPrintItRequested || HLPrintItRequested, "_on_", [self['@model']])]);
  392. smalltalk.send(self, "_print_", [smalltalk.send(result, "_printString", [])]);
  393. smalltalk.send(self, "_focus", []);
  394. return self;
  395. }
  396. }),
  397. smalltalk.HLCodeWidget);
  398. smalltalk.addMethod(
  399. "_receiver",
  400. smalltalk.method({
  401. selector: "receiver",
  402. fn: function () {
  403. var self = this;
  404. var $1;
  405. $1 = smalltalk.send(smalltalk.send(self, "_model", []), "_receiver", []);
  406. return $1;
  407. }
  408. }),
  409. smalltalk.HLCodeWidget);
  410. smalltalk.addMethod(
  411. "_receiver_",
  412. smalltalk.method({
  413. selector: "receiver:",
  414. fn: function (anObject) {
  415. var self = this;
  416. smalltalk.send(smalltalk.send(self, "_model", []), "_receiver_", [anObject]);
  417. return self;
  418. }
  419. }),
  420. smalltalk.HLCodeWidget);
  421. smalltalk.addMethod(
  422. "_renderContentOn_",
  423. smalltalk.method({
  424. selector: "renderContentOn:",
  425. fn: function (html){
  426. var self=this;
  427. self["@code"]=smalltalk.send(html,"_textarea",[]);
  428. smalltalk.send(self,"_setEditorOn_",[smalltalk.send(self["@code"],"_element",[])]);
  429. smalltalk.send(self,"_observeWrapper",[]);
  430. return self}
  431. }),
  432. smalltalk.HLCodeWidget);
  433. smalltalk.addMethod(
  434. "_selection",
  435. smalltalk.method({
  436. selector: "selection",
  437. fn: function () {
  438. var self = this;
  439. var $1;
  440. $1 = smalltalk.send(self['@editor'], "_getSelection", []);
  441. return $1;
  442. }
  443. }),
  444. smalltalk.HLCodeWidget);
  445. smalltalk.addMethod(
  446. "_selectionEnd",
  447. smalltalk.method({
  448. selector: "selectionEnd",
  449. fn: function () {
  450. var self = this;
  451. var $1;
  452. $1 = smalltalk.send(smalltalk.send(self['@code'], "_element", []), "_selectionEnd", []);
  453. return $1;
  454. }
  455. }),
  456. smalltalk.HLCodeWidget);
  457. smalltalk.addMethod(
  458. "_selectionEnd_",
  459. smalltalk.method({
  460. selector: "selectionEnd:",
  461. fn: function (anInteger) {
  462. var self = this;
  463. smalltalk.send(smalltalk.send(self['@code'], "_element", []), "_selectionEnd_", [anInteger]);
  464. return self;
  465. }
  466. }),
  467. smalltalk.HLCodeWidget);
  468. smalltalk.addMethod(
  469. "_selectionStart",
  470. smalltalk.method({
  471. selector: "selectionStart",
  472. fn: function () {
  473. var self = this;
  474. var $1;
  475. $1 = smalltalk.send(smalltalk.send(self['@code'], "_element", []), "_selectionStart", []);
  476. return $1;
  477. }
  478. }),
  479. smalltalk.HLCodeWidget);
  480. smalltalk.addMethod(
  481. "_selectionStart_",
  482. smalltalk.method({
  483. selector: "selectionStart:",
  484. fn: function (anInteger) {
  485. var self = this;
  486. smalltalk.send(smalltalk.send(self['@code'], "_element", []), "_selectionStart_", [anInteger]);
  487. return self;
  488. }
  489. }),
  490. smalltalk.HLCodeWidget);
  491. smalltalk.addMethod(
  492. "_setEditorOn_",
  493. smalltalk.method({
  494. selector: "setEditorOn:",
  495. fn: function (aTextarea) {
  496. var self = this;
  497. self['@editor'] = CodeMirror.fromTextArea(aTextarea, {theme: "amber", lineNumbers: true, enterMode: "flat", matchBrackets: true, electricChars: false});
  498. return self;
  499. }
  500. }),
  501. smalltalk.HLCodeWidget);
  502. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['model', 'codeWidget'], 'Helios-Workspace');
  503. smalltalk.addMethod(
  504. "_codeWidget",
  505. smalltalk.method({
  506. selector: "codeWidget",
  507. fn: function () {
  508. var self = this;
  509. var $2, $3, $1;
  510. if (($receiver = self['@codeWidget']) == nil || $receiver == undefined) {
  511. $2 = smalltalk.send(smalltalk.HLCodeWidget || HLCodeWidget, "_new", []);
  512. smalltalk.send($2, "_model_", [smalltalk.send(smalltalk.send(self, "_model", []), "_code", [])]);
  513. $3 = smalltalk.send($2, "_yourself", []);
  514. self['@codeWidget'] = $3;
  515. $1 = self['@codeWidget'];
  516. } else {
  517. $1 = self['@codeWidget'];
  518. }
  519. return $1;
  520. }
  521. }),
  522. smalltalk.HLWorkspace);
  523. smalltalk.addMethod(
  524. "_model",
  525. smalltalk.method({
  526. selector: "model",
  527. fn: function () {
  528. var self = this;
  529. var $1;
  530. if (($receiver = self['@model']) == nil || $receiver == undefined) {
  531. smalltalk.send(self, "_model_", [smalltalk.send(smalltalk.HLWorkspaceModel || HLWorkspaceModel, "_new", [])]);
  532. $1 = self['@model'];
  533. } else {
  534. $1 = self['@model'];
  535. }
  536. return $1;
  537. }
  538. }),
  539. smalltalk.HLWorkspace);
  540. smalltalk.addMethod(
  541. "_model_",
  542. smalltalk.method({
  543. selector: "model:",
  544. fn: function (aModel) {
  545. var self = this;
  546. self['@model'] = aModel;
  547. smalltalk.send(smalltalk.send(self, "_codeWidget", []), "_model_", [smalltalk.send(aModel, "_code", [])]);
  548. smalltalk.send(self, "_observeCodeWidget", []);
  549. return self;
  550. }
  551. }),
  552. smalltalk.HLWorkspace);
  553. smalltalk.addMethod(
  554. "_observeCodeWidget",
  555. smalltalk.method({
  556. selector: "observeCodeWidget",
  557. fn: function () {
  558. var self = this;
  559. return self;
  560. }
  561. }),
  562. smalltalk.HLWorkspace);
  563. smalltalk.addMethod(
  564. "_onDoIt",
  565. smalltalk.method({
  566. selector: "onDoIt",
  567. fn: function () {
  568. var self = this;
  569. return self;
  570. }
  571. }),
  572. smalltalk.HLWorkspace);
  573. smalltalk.addMethod(
  574. "_onInspectIt",
  575. smalltalk.method({
  576. selector: "onInspectIt",
  577. fn: function () {
  578. var self = this;
  579. return self;
  580. }
  581. }),
  582. smalltalk.HLWorkspace);
  583. smalltalk.addMethod(
  584. "_onPrintIt",
  585. smalltalk.method({
  586. selector: "onPrintIt",
  587. fn: function () {
  588. var self = this;
  589. return self;
  590. }
  591. }),
  592. smalltalk.HLWorkspace);
  593. smalltalk.addMethod(
  594. "_renderContentOn_",
  595. smalltalk.method({
  596. selector: "renderContentOn:",
  597. fn: function (html) {
  598. var self = this;
  599. smalltalk.send(html, "_with_", [smalltalk.send(self, "_codeWidget", [])]);
  600. return self;
  601. }
  602. }),
  603. smalltalk.HLWorkspace);
  604. smalltalk.addMethod(
  605. "_canBeOpenAsTab",
  606. smalltalk.method({
  607. selector: "canBeOpenAsTab",
  608. fn: function () {
  609. var self = this;
  610. return true;
  611. }
  612. }),
  613. smalltalk.HLWorkspace.klass);
  614. smalltalk.addMethod(
  615. "_tabLabel",
  616. smalltalk.method({
  617. selector: "tabLabel",
  618. fn: function () {
  619. var self = this;
  620. return "Workspace";
  621. }
  622. }),
  623. smalltalk.HLWorkspace.klass);
  624. smalltalk.addMethod(
  625. "_tabPriority",
  626. smalltalk.method({
  627. selector: "tabPriority",
  628. fn: function () {
  629. var self = this;
  630. return 10;
  631. }
  632. }),
  633. smalltalk.HLWorkspace.klass);
  634. smalltalk.addClass('HLWorkspaceModel', smalltalk.Object, ['announcer', 'environment', 'code'], 'Helios-Workspace');
  635. smalltalk.addMethod(
  636. "_announcer",
  637. smalltalk.method({
  638. selector: "announcer",
  639. fn: function () {
  640. var self = this;
  641. var $1;
  642. if (($receiver = self['@announcer']) == nil || $receiver == undefined) {
  643. self['@announcer'] = smalltalk.send(smalltalk.Announcer || Announcer, "_new", []);
  644. $1 = self['@announcer'];
  645. } else {
  646. $1 = self['@announcer'];
  647. }
  648. return $1;
  649. }
  650. }),
  651. smalltalk.HLWorkspaceModel);
  652. smalltalk.addMethod(
  653. "_code",
  654. smalltalk.method({
  655. selector: "code",
  656. fn: function () {
  657. var self = this;
  658. var $1;
  659. if (($receiver = self['@code']) == nil || $receiver == undefined) {
  660. $1 = smalltalk.send(smalltalk.HLCodeModel || HLCodeModel, "_on_", [smalltalk.send(self, "_environment", [])]);
  661. } else {
  662. $1 = self['@code'];
  663. }
  664. return $1;
  665. }
  666. }),
  667. smalltalk.HLWorkspaceModel);
  668. smalltalk.addMethod(
  669. "_environment",
  670. smalltalk.method({
  671. selector: "environment",
  672. fn: function () {
  673. var self = this;
  674. var $1;
  675. if (($receiver = self['@environment']) == nil || $receiver == undefined) {
  676. $1 = smalltalk.send(smalltalk.send(smalltalk.HLManager || HLManager, "_current", []), "_environment", []);
  677. } else {
  678. $1 = self['@environment'];
  679. }
  680. return $1;
  681. }
  682. }),
  683. smalltalk.HLWorkspaceModel);
  684. smalltalk.addMethod(
  685. "_environment_",
  686. smalltalk.method({
  687. selector: "environment:",
  688. fn: function (anEnvironment) {
  689. var self = this;
  690. self['@environment'] = anEnvironment;
  691. return self;
  692. }
  693. }),
  694. smalltalk.HLWorkspaceModel);
  695. smalltalk.addMethod(
  696. "_onKeyDown_",
  697. smalltalk.method({
  698. selector: "onKeyDown:",
  699. fn: function (anEvent) {
  700. var self = this;
  701. if (anEvent.ctrlKey) {
  702. if (anEvent.keyCode === 80) {
  703. self._printIt();
  704. anEvent.preventDefault();
  705. return false;
  706. }
  707. if (anEvent.keyCode === 68) {
  708. self._doIt();
  709. anEvent.preventDefault();
  710. return false;
  711. }
  712. if (anEvent.keyCode === 73) {
  713. self._inspectIt();
  714. anEvent.preventDefault();
  715. return false;
  716. }
  717. }
  718. return self;
  719. }
  720. }),
  721. smalltalk.HLWorkspaceModel);
  722. smalltalk.addMethod(
  723. "_on_",
  724. smalltalk.method({
  725. selector: "on:",
  726. fn: function (anEnvironment) {
  727. var self = this;
  728. var $2, $3, $1;
  729. $2 = smalltalk.send(self, "_new", []);
  730. smalltalk.send($2, "_environment_", [anEnvironment]);
  731. $3 = smalltalk.send($2, "_yourself", []);
  732. $1 = $3;
  733. return $1;
  734. }
  735. }),
  736. smalltalk.HLWorkspaceModel.klass);