Helios-Workspace.deploy.js 24 KB

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