Helios-Workspace.deploy.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  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, "_val_", [""]);
  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. var $1;
  168. $1 = smalltalk.send(self['@editor'], "_setValue_", [aString]);
  169. return $1;
  170. }
  171. }),
  172. smalltalk.HLCodeWidget);
  173. smalltalk.addMethod(
  174. "_currentLine",
  175. smalltalk.method({
  176. selector: "currentLine",
  177. fn: function () {
  178. var self = this;
  179. var $1;
  180. $1 = smalltalk.send(self['@editor'], "_getLine_", [smalltalk.send(smalltalk.send(self['@editor'], "_getCursor", []), "_line", [])]);
  181. return $1;
  182. }
  183. }),
  184. smalltalk.HLCodeWidget);
  185. smalltalk.addMethod(
  186. "_currentLineOrSelection",
  187. smalltalk.method({
  188. selector: "currentLineOrSelection",
  189. fn: function () {
  190. var self = this;
  191. var $2, $1;
  192. $2 = smalltalk.send(self['@editor'], "_somethingSelected", []);
  193. if (smalltalk.assert($2)) {
  194. $1 = smalltalk.send(self, "_selection", []);
  195. } else {
  196. $1 = smalltalk.send(self, "_currentLine", []);
  197. }
  198. return $1;
  199. }
  200. }),
  201. smalltalk.HLCodeWidget);
  202. smalltalk.addMethod(
  203. "_doIt",
  204. smalltalk.method({
  205. selector: "doIt",
  206. fn: function () {
  207. var self = this;
  208. var result;
  209. smalltalk.send(smalltalk.send(self, "_announcer", []), "_announce_", [smalltalk.send(smalltalk.HLDoItRequested || HLDoItRequested, "_on_", [self['@model']])]);
  210. result = smalltalk.send(self['@model'], "_doIt_", [smalltalk.send(self, "_currentLineOrSelection", [])]);
  211. smalltalk.send(smalltalk.send(self, "_announcer", []), "_announce_", [smalltalk.send(smalltalk.HLDoItExecuted || HLDoItExecuted, "_on_", [self['@model']])]);
  212. return result;
  213. }
  214. }),
  215. smalltalk.HLCodeWidget);
  216. smalltalk.addMethod(
  217. "_editor",
  218. smalltalk.method({
  219. selector: "editor",
  220. fn: function () {
  221. var self = this;
  222. return self['@editor'];
  223. }
  224. }),
  225. smalltalk.HLCodeWidget);
  226. smalltalk.addMethod(
  227. "_focus",
  228. smalltalk.method({
  229. selector: "focus",
  230. fn: function () {
  231. var self = this;
  232. smalltalk.send(smalltalk.send(self, "_editor", []), "_focus", []);
  233. return self;
  234. }
  235. }),
  236. smalltalk.HLCodeWidget);
  237. smalltalk.addMethod(
  238. "_inspectIt",
  239. smalltalk.method({
  240. selector: "inspectIt",
  241. fn: function () {
  242. var self = this;
  243. var newInspector;
  244. smalltalk.send(smalltalk.send(self, "_announcer", []), "_announce_", [smalltalk.send(smalltalk.HLInspectItRequested || HLInspectItRequested, "_on_", [self['@model']])]);
  245. newInspector = smalltalk.send(self, "_makeInspectorOn_", [smalltalk.send(self, "_doIt", [])]);
  246. smalltalk.send(newInspector, "_open", []);
  247. return self;
  248. }
  249. }),
  250. smalltalk.HLCodeWidget);
  251. smalltalk.addMethod(
  252. "_makeInspectorOn_",
  253. smalltalk.method({
  254. selector: "makeInspectorOn:",
  255. fn: function (anObject) {
  256. var self = this;
  257. var $2, $3, $1;
  258. $2 = smalltalk.send(smalltalk.HLInspector || HLInspector, "_new", []);
  259. smalltalk.send($2, "_inspect_", [anObject]);
  260. $3 = smalltalk.send($2, "_yourself", []);
  261. $1 = $3;
  262. return $1;
  263. }
  264. }),
  265. smalltalk.HLCodeWidget);
  266. smalltalk.addMethod(
  267. "_model",
  268. smalltalk.method({
  269. selector: "model",
  270. fn: function () {
  271. var self = this;
  272. var $1;
  273. if (($receiver = self['@model']) == nil || $receiver == undefined) {
  274. self['@model'] = smalltalk.send(smalltalk.HLCodeModel || HLCodeModel, "_new", []);
  275. $1 = self['@model'];
  276. } else {
  277. $1 = self['@model'];
  278. }
  279. return $1;
  280. }
  281. }),
  282. smalltalk.HLCodeWidget);
  283. smalltalk.addMethod(
  284. "_model_",
  285. smalltalk.method({
  286. selector: "model:",
  287. fn: function (aModel) {
  288. var self = this;
  289. self['@model'] = aModel;
  290. return self;
  291. }
  292. }),
  293. smalltalk.HLCodeWidget);
  294. smalltalk.addMethod(
  295. "_observeWrapper",
  296. smalltalk.method({
  297. selector: "observeWrapper",
  298. fn: function () {
  299. var self = this;
  300. smalltalk.send(self['@wrapper'], "_onKeyDown_", [function (e) {return smalltalk.send(self, "_onKeyDown_", [e]);}]);
  301. return self;
  302. }
  303. }),
  304. smalltalk.HLCodeWidget);
  305. smalltalk.addMethod(
  306. "_onDoIt",
  307. smalltalk.method({
  308. selector: "onDoIt",
  309. fn: function () {
  310. var self = this;
  311. smalltalk.send(self, "_doIt", []);
  312. return self;
  313. }
  314. }),
  315. smalltalk.HLCodeWidget);
  316. smalltalk.addMethod(
  317. "_onInspectIt",
  318. smalltalk.method({
  319. selector: "onInspectIt",
  320. fn: function () {
  321. var self = this;
  322. smalltalk.send(self, "_inspectIt", []);
  323. return self;
  324. }
  325. }),
  326. smalltalk.HLCodeWidget);
  327. smalltalk.addMethod(
  328. "_onKeyDown_",
  329. smalltalk.method({
  330. selector: "onKeyDown:",
  331. fn: function (anEvent) {
  332. var self = this;
  333. if (anEvent.ctrlKey) {
  334. if (anEvent.keyCode === 80) {
  335. self._onPrintIt();
  336. anEvent.preventDefault();
  337. return false;
  338. }
  339. if (anEvent.keyCode === 68) {
  340. self._onDoIt();
  341. anEvent.preventDefault();
  342. return false;
  343. }
  344. if (anEvent.keyCode === 73) {
  345. self._onInspectIt();
  346. anEvent.preventDefault();
  347. return false;
  348. }
  349. }
  350. return self;
  351. }
  352. }),
  353. smalltalk.HLCodeWidget);
  354. smalltalk.addMethod(
  355. "_onPrintIt",
  356. smalltalk.method({
  357. selector: "onPrintIt",
  358. fn: function () {
  359. var self = this;
  360. smalltalk.send(self, "_printIt", []);
  361. return self;
  362. }
  363. }),
  364. smalltalk.HLCodeWidget);
  365. smalltalk.addMethod(
  366. "_print_",
  367. smalltalk.method({
  368. selector: "print:",
  369. fn: function (aString) {
  370. var self = this;
  371. var start;
  372. var stop;
  373. start = smalltalk.send(smalltalk.HashedCollection || HashedCollection, "_new", []);
  374. stop = smalltalk.send(smalltalk.HashedCollection || HashedCollection, "_new", []);
  375. smalltalk.send(start, "_at_put_", ["line", smalltalk.send(smalltalk.send(self['@editor'], "_getCursor_", [false]), "_line", [])]);
  376. smalltalk.send(start, "_at_put_", ["ch", smalltalk.send(smalltalk.send(self['@editor'], "_getCursor_", [false]), "_ch", [])]);
  377. smalltalk.send(stop, "_at_put_", ["line", smalltalk.send(start, "_at_", ["line"])]);
  378. smalltalk.send(stop, "_at_put_", ["ch", smalltalk.send(smalltalk.send(smalltalk.send(start, "_at_", ["ch"]), "__plus", [smalltalk.send(aString, "_size", [])]), "__plus", [2])]);
  379. smalltalk.send(self['@editor'], "_replaceSelection_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self['@editor'], "_getSelection", []), "__comma", [" "]), "__comma", [aString]), "__comma", [" "])]);
  380. smalltalk.send(self['@editor'], "_setCursor_", [smalltalk.send(self['@editor'], "_getCursor_", [true])]);
  381. smalltalk.send(self['@editor'], "_setSelection_end_", [stop, start]);
  382. return self;
  383. }
  384. }),
  385. smalltalk.HLCodeWidget);
  386. smalltalk.addMethod(
  387. "_printIt",
  388. smalltalk.method({
  389. selector: "printIt",
  390. fn: function () {
  391. var self = this;
  392. var result;
  393. result = smalltalk.send(self, "_doIt", []);
  394. smalltalk.send(smalltalk.send(self, "_announcer", []), "_announce_", [smalltalk.send(smalltalk.HLPrintItRequested || HLPrintItRequested, "_on_", [self['@model']])]);
  395. smalltalk.send(self, "_print_", [smalltalk.send(result, "_printString", [])]);
  396. smalltalk.send(self, "_focus", []);
  397. return self;
  398. }
  399. }),
  400. smalltalk.HLCodeWidget);
  401. smalltalk.addMethod(
  402. "_receiver",
  403. smalltalk.method({
  404. selector: "receiver",
  405. fn: function () {
  406. var self = this;
  407. var $1;
  408. $1 = smalltalk.send(smalltalk.send(self, "_model", []), "_receiver", []);
  409. return $1;
  410. }
  411. }),
  412. smalltalk.HLCodeWidget);
  413. smalltalk.addMethod(
  414. "_receiver_",
  415. smalltalk.method({
  416. selector: "receiver:",
  417. fn: function (anObject) {
  418. var self = this;
  419. smalltalk.send(smalltalk.send(self, "_model", []), "_receiver_", [anObject]);
  420. return self;
  421. }
  422. }),
  423. smalltalk.HLCodeWidget);
  424. smalltalk.addMethod(
  425. "_renderContentOn_",
  426. smalltalk.method({
  427. selector: "renderContentOn:",
  428. fn: function (html) {
  429. var self = this;
  430. self['@code'] = smalltalk.send(html, "_textarea", []);
  431. smalltalk.send(self, "_setEditorOn_", [smalltalk.send(self['@code'], "_element", [])]);
  432. smalltalk.send(self, "_observeWrapper", []);
  433. return self;
  434. }
  435. }),
  436. smalltalk.HLCodeWidget);
  437. smalltalk.addMethod(
  438. "_renderOn_",
  439. smalltalk.method({
  440. selector: "renderOn:",
  441. fn: function (html) {
  442. var self = this;
  443. self['@wrapper'] = smalltalk.send(smalltalk.send(html, "_div", []), "_class_", ["code"]);
  444. smalltalk.send(self, "_observeWrapper", []);
  445. smalltalk.send(self['@wrapper'], "_with_", [function () {self['@code'] = smalltalk.send(html, "_textarea", []);return self['@code'];}]);
  446. smalltalk.send(self, "_setEditorOn_", [smalltalk.send(self['@code'], "_element", [])]);
  447. return self;
  448. }
  449. }),
  450. smalltalk.HLCodeWidget);
  451. smalltalk.addMethod(
  452. "_selection",
  453. smalltalk.method({
  454. selector: "selection",
  455. fn: function () {
  456. var self = this;
  457. var $1;
  458. $1 = smalltalk.send(self['@editor'], "_getSelection", []);
  459. return $1;
  460. }
  461. }),
  462. smalltalk.HLCodeWidget);
  463. smalltalk.addMethod(
  464. "_selectionEnd",
  465. smalltalk.method({
  466. selector: "selectionEnd",
  467. fn: function () {
  468. var self = this;
  469. var $1;
  470. $1 = smalltalk.send(smalltalk.send(self['@code'], "_element", []), "_selectionEnd", []);
  471. return $1;
  472. }
  473. }),
  474. smalltalk.HLCodeWidget);
  475. smalltalk.addMethod(
  476. "_selectionEnd_",
  477. smalltalk.method({
  478. selector: "selectionEnd:",
  479. fn: function (anInteger) {
  480. var self = this;
  481. smalltalk.send(smalltalk.send(self['@code'], "_element", []), "_selectionEnd_", [anInteger]);
  482. return self;
  483. }
  484. }),
  485. smalltalk.HLCodeWidget);
  486. smalltalk.addMethod(
  487. "_selectionStart",
  488. smalltalk.method({
  489. selector: "selectionStart",
  490. fn: function () {
  491. var self = this;
  492. var $1;
  493. $1 = smalltalk.send(smalltalk.send(self['@code'], "_element", []), "_selectionStart", []);
  494. return $1;
  495. }
  496. }),
  497. smalltalk.HLCodeWidget);
  498. smalltalk.addMethod(
  499. "_selectionStart_",
  500. smalltalk.method({
  501. selector: "selectionStart:",
  502. fn: function (anInteger) {
  503. var self = this;
  504. smalltalk.send(smalltalk.send(self['@code'], "_element", []), "_selectionStart_", [anInteger]);
  505. return self;
  506. }
  507. }),
  508. smalltalk.HLCodeWidget);
  509. smalltalk.addMethod(
  510. "_setEditorOn_",
  511. smalltalk.method({
  512. selector: "setEditorOn:",
  513. fn: function (aTextarea) {
  514. var self = this;
  515. self['@editor'] = CodeMirror.fromTextArea(aTextarea, {theme: "amber", lineNumbers: true, enterMode: "flat", matchBrackets: true, electricChars: false});
  516. return self;
  517. }
  518. }),
  519. smalltalk.HLCodeWidget);
  520. smalltalk.addMethod(
  521. "_val",
  522. smalltalk.method({
  523. selector: "val",
  524. fn: function () {
  525. var self = this;
  526. var $1;
  527. $1 = smalltalk.send(self['@code'], "_getValue", []);
  528. return $1;
  529. }
  530. }),
  531. smalltalk.HLCodeWidget);
  532. smalltalk.addMethod(
  533. "_val_",
  534. smalltalk.method({
  535. selector: "val:",
  536. fn: function (aString) {
  537. var self = this;
  538. smalltalk.send(self['@code'], "_setValue_", [aString]);
  539. return self;
  540. }
  541. }),
  542. smalltalk.HLCodeWidget);
  543. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['model', 'codeWidget'], 'Helios-Workspace');
  544. smalltalk.addMethod(
  545. "_codeWidget",
  546. smalltalk.method({
  547. selector: "codeWidget",
  548. fn: function () {
  549. var self = this;
  550. var $2, $3, $1;
  551. if (($receiver = self['@codeWidget']) == nil || $receiver == undefined) {
  552. $2 = smalltalk.send(smalltalk.HLCodeWidget || HLCodeWidget, "_new", []);
  553. smalltalk.send($2, "_model_", [smalltalk.send(smalltalk.send(self, "_model", []), "_code", [])]);
  554. $3 = smalltalk.send($2, "_yourself", []);
  555. self['@codeWidget'] = $3;
  556. $1 = self['@codeWidget'];
  557. } else {
  558. $1 = self['@codeWidget'];
  559. }
  560. return $1;
  561. }
  562. }),
  563. smalltalk.HLWorkspace);
  564. smalltalk.addMethod(
  565. "_model",
  566. smalltalk.method({
  567. selector: "model",
  568. fn: function () {
  569. var self = this;
  570. var $1;
  571. if (($receiver = self['@model']) == nil || $receiver == undefined) {
  572. smalltalk.send(self, "_model_", [smalltalk.send(smalltalk.HLWorkspaceModel || HLWorkspaceModel, "_new", [])]);
  573. $1 = self['@model'];
  574. } else {
  575. $1 = self['@model'];
  576. }
  577. return $1;
  578. }
  579. }),
  580. smalltalk.HLWorkspace);
  581. smalltalk.addMethod(
  582. "_model_",
  583. smalltalk.method({
  584. selector: "model:",
  585. fn: function (aModel) {
  586. var self = this;
  587. self['@model'] = aModel;
  588. smalltalk.send(smalltalk.send(self, "_codeWidget", []), "_model_", [smalltalk.send(aModel, "_code", [])]);
  589. smalltalk.send(self, "_observeCodeWidget", []);
  590. return self;
  591. }
  592. }),
  593. smalltalk.HLWorkspace);
  594. smalltalk.addMethod(
  595. "_observeCodeWidget",
  596. smalltalk.method({
  597. selector: "observeCodeWidget",
  598. fn: function () {
  599. var self = this;
  600. return self;
  601. }
  602. }),
  603. smalltalk.HLWorkspace);
  604. smalltalk.addMethod(
  605. "_onDoIt",
  606. smalltalk.method({
  607. selector: "onDoIt",
  608. fn: function () {
  609. var self = this;
  610. return self;
  611. }
  612. }),
  613. smalltalk.HLWorkspace);
  614. smalltalk.addMethod(
  615. "_onInspectIt",
  616. smalltalk.method({
  617. selector: "onInspectIt",
  618. fn: function () {
  619. var self = this;
  620. return self;
  621. }
  622. }),
  623. smalltalk.HLWorkspace);
  624. smalltalk.addMethod(
  625. "_onPrintIt",
  626. smalltalk.method({
  627. selector: "onPrintIt",
  628. fn: function () {
  629. var self = this;
  630. return self;
  631. }
  632. }),
  633. smalltalk.HLWorkspace);
  634. smalltalk.addMethod(
  635. "_renderContentOn_",
  636. smalltalk.method({
  637. selector: "renderContentOn:",
  638. fn: function (html) {
  639. var self = this;
  640. smalltalk.send(html, "_with_", [smalltalk.send(self, "_codeWidget", [])]);
  641. return self;
  642. }
  643. }),
  644. smalltalk.HLWorkspace);
  645. smalltalk.addMethod(
  646. "_canBeOpenAsTab",
  647. smalltalk.method({
  648. selector: "canBeOpenAsTab",
  649. fn: function () {
  650. var self = this;
  651. return true;
  652. }
  653. }),
  654. smalltalk.HLWorkspace.klass);
  655. smalltalk.addMethod(
  656. "_tabLabel",
  657. smalltalk.method({
  658. selector: "tabLabel",
  659. fn: function () {
  660. var self = this;
  661. return "Workspace";
  662. }
  663. }),
  664. smalltalk.HLWorkspace.klass);
  665. smalltalk.addMethod(
  666. "_tabPriority",
  667. smalltalk.method({
  668. selector: "tabPriority",
  669. fn: function () {
  670. var self = this;
  671. return 10;
  672. }
  673. }),
  674. smalltalk.HLWorkspace.klass);
  675. smalltalk.addClass('HLWorkspaceModel', smalltalk.Object, ['announcer', 'environment', 'code'], 'Helios-Workspace');
  676. smalltalk.addMethod(
  677. "_announcer",
  678. smalltalk.method({
  679. selector: "announcer",
  680. fn: function () {
  681. var self = this;
  682. var $1;
  683. if (($receiver = self['@announcer']) == nil || $receiver == undefined) {
  684. self['@announcer'] = smalltalk.send(smalltalk.Announcer || Announcer, "_new", []);
  685. $1 = self['@announcer'];
  686. } else {
  687. $1 = self['@announcer'];
  688. }
  689. return $1;
  690. }
  691. }),
  692. smalltalk.HLWorkspaceModel);
  693. smalltalk.addMethod(
  694. "_code",
  695. smalltalk.method({
  696. selector: "code",
  697. fn: function () {
  698. var self = this;
  699. var $1;
  700. if (($receiver = self['@code']) == nil || $receiver == undefined) {
  701. $1 = smalltalk.send(smalltalk.HLCodeModel || HLCodeModel, "_on_", [smalltalk.send(self, "_environment", [])]);
  702. } else {
  703. $1 = self['@code'];
  704. }
  705. return $1;
  706. }
  707. }),
  708. smalltalk.HLWorkspaceModel);
  709. smalltalk.addMethod(
  710. "_environment",
  711. smalltalk.method({
  712. selector: "environment",
  713. fn: function () {
  714. var self = this;
  715. var $1;
  716. if (($receiver = self['@environment']) == nil || $receiver == undefined) {
  717. $1 = smalltalk.send(smalltalk.send(smalltalk.HLManager || HLManager, "_current", []), "_environment", []);
  718. } else {
  719. $1 = self['@environment'];
  720. }
  721. return $1;
  722. }
  723. }),
  724. smalltalk.HLWorkspaceModel);
  725. smalltalk.addMethod(
  726. "_environment_",
  727. smalltalk.method({
  728. selector: "environment:",
  729. fn: function (anEnvironment) {
  730. var self = this;
  731. self['@environment'] = anEnvironment;
  732. return self;
  733. }
  734. }),
  735. smalltalk.HLWorkspaceModel);
  736. smalltalk.addMethod(
  737. "_onKeyDown_",
  738. smalltalk.method({
  739. selector: "onKeyDown:",
  740. fn: function (anEvent) {
  741. var self = this;
  742. if (anEvent.ctrlKey) {
  743. if (anEvent.keyCode === 80) {
  744. self._printIt();
  745. anEvent.preventDefault();
  746. return false;
  747. }
  748. if (anEvent.keyCode === 68) {
  749. self._doIt();
  750. anEvent.preventDefault();
  751. return false;
  752. }
  753. if (anEvent.keyCode === 73) {
  754. self._inspectIt();
  755. anEvent.preventDefault();
  756. return false;
  757. }
  758. }
  759. return self;
  760. }
  761. }),
  762. smalltalk.HLWorkspaceModel);
  763. smalltalk.addMethod(
  764. "_subscribe_",
  765. smalltalk.method({
  766. selector: "subscribe:",
  767. fn: function (aWidget) {
  768. var self = this;
  769. smalltalk.send(aWidget, "_subscribeTo_", [smalltalk.send(self, "_announcer", [])]);
  770. return self;
  771. }
  772. }),
  773. smalltalk.HLWorkspaceModel);
  774. smalltalk.addMethod(
  775. "_on_",
  776. smalltalk.method({
  777. selector: "on:",
  778. fn: function (anEnvironment) {
  779. var self = this;
  780. var $2, $3, $1;
  781. $2 = smalltalk.send(self, "_new", []);
  782. smalltalk.send($2, "_environment_", [anEnvironment]);
  783. $3 = smalltalk.send($2, "_yourself", []);
  784. $1 = $3;
  785. return $1;
  786. }
  787. }),
  788. smalltalk.HLWorkspaceModel.klass);