Helios-Workspace.deploy.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  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('HLSourceCodeWidget', smalltalk.HLCodeWidget, [], 'Helios-Workspace');
  501. smalltalk.addMethod(
  502. "_onKeyDown_",
  503. smalltalk.method({
  504. selector: "onKeyDown:",
  505. fn: function (anEvent){
  506. var self=this;
  507. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  508. $1=smalltalk.HLCodeWidget.fn.prototype._onKeyDown_.apply(_st(self), [anEvent]);
  509. if(! smalltalk.assert($1)){
  510. return false;
  511. };
  512. $2=_st(anEvent)._ctrlKey();
  513. if(smalltalk.assert($2)){
  514. $3=_st(_st(anEvent)._keyCode()).__eq((83));
  515. if(smalltalk.assert($3)){
  516. _st(self)._onSave();
  517. _st(anEvent)._preventDefault();
  518. return false;
  519. };
  520. };
  521. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLSourceCodeWidget)})},
  522. messageSends: ["ifFalse:", "onKeyDown:", "ifTrue:", "onSave", "preventDefault", "=", "keyCode", "ctrlKey"]}),
  523. smalltalk.HLSourceCodeWidget);
  524. smalltalk.addMethod(
  525. "_onSave",
  526. smalltalk.method({
  527. selector: "onSave",
  528. fn: function (){
  529. var self=this;
  530. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSave",{}, smalltalk.HLSourceCodeWidget)})},
  531. messageSends: []}),
  532. smalltalk.HLSourceCodeWidget);
  533. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['model', 'codeWidget'], 'Helios-Workspace');
  534. smalltalk.addMethod(
  535. "_codeWidget",
  536. smalltalk.method({
  537. selector: "codeWidget",
  538. fn: function (){
  539. var self=this;
  540. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$1;
  541. $2=self["@codeWidget"];
  542. if(($receiver = $2) == nil || $receiver == undefined){
  543. $3=_st((smalltalk.HLCodeWidget || HLCodeWidget))._new();
  544. _st($3)._model_(_st(_st(self)._model())._code());
  545. $4=_st($3)._yourself();
  546. self["@codeWidget"]=$4;
  547. $1=self["@codeWidget"];
  548. } else {
  549. $1=$2;
  550. };
  551. return $1;
  552. }, function($ctx1) {$ctx1.fill(self,"codeWidget",{}, smalltalk.HLWorkspace)})},
  553. messageSends: ["ifNil:", "model:", "code", "model", "new", "yourself"]}),
  554. smalltalk.HLWorkspace);
  555. smalltalk.addMethod(
  556. "_model",
  557. smalltalk.method({
  558. selector: "model",
  559. fn: function (){
  560. var self=this;
  561. return smalltalk.withContext(function($ctx1) { var $2,$1;
  562. $2=self["@model"];
  563. if(($receiver = $2) == nil || $receiver == undefined){
  564. _st(self)._model_(_st((smalltalk.HLWorkspaceModel || HLWorkspaceModel))._new());
  565. $1=self["@model"];
  566. } else {
  567. $1=$2;
  568. };
  569. return $1;
  570. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLWorkspace)})},
  571. messageSends: ["ifNil:", "model:", "new"]}),
  572. smalltalk.HLWorkspace);
  573. smalltalk.addMethod(
  574. "_model_",
  575. smalltalk.method({
  576. selector: "model:",
  577. fn: function (aModel){
  578. var self=this;
  579. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  580. _st(_st(self)._codeWidget())._model_(_st(aModel)._code());
  581. _st(self)._observeCodeWidget();
  582. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLWorkspace)})},
  583. messageSends: ["model:", "code", "codeWidget", "observeCodeWidget"]}),
  584. smalltalk.HLWorkspace);
  585. smalltalk.addMethod(
  586. "_observeCodeWidget",
  587. smalltalk.method({
  588. selector: "observeCodeWidget",
  589. fn: function (){
  590. var self=this;
  591. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"observeCodeWidget",{}, smalltalk.HLWorkspace)})},
  592. messageSends: []}),
  593. smalltalk.HLWorkspace);
  594. smalltalk.addMethod(
  595. "_onDoIt",
  596. smalltalk.method({
  597. selector: "onDoIt",
  598. fn: function (){
  599. var self=this;
  600. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLWorkspace)})},
  601. messageSends: []}),
  602. smalltalk.HLWorkspace);
  603. smalltalk.addMethod(
  604. "_onInspectIt",
  605. smalltalk.method({
  606. selector: "onInspectIt",
  607. fn: function (){
  608. var self=this;
  609. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLWorkspace)})},
  610. messageSends: []}),
  611. smalltalk.HLWorkspace);
  612. smalltalk.addMethod(
  613. "_onPrintIt",
  614. smalltalk.method({
  615. selector: "onPrintIt",
  616. fn: function (){
  617. var self=this;
  618. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLWorkspace)})},
  619. messageSends: []}),
  620. smalltalk.HLWorkspace);
  621. smalltalk.addMethod(
  622. "_renderContentOn_",
  623. smalltalk.method({
  624. selector: "renderContentOn:",
  625. fn: function (html){
  626. var self=this;
  627. return smalltalk.withContext(function($ctx1) { _st(html)._with_(_st(self)._codeWidget());
  628. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLWorkspace)})},
  629. messageSends: ["with:", "codeWidget"]}),
  630. smalltalk.HLWorkspace);
  631. smalltalk.addMethod(
  632. "_canBeOpenAsTab",
  633. smalltalk.method({
  634. selector: "canBeOpenAsTab",
  635. fn: function (){
  636. var self=this;
  637. return smalltalk.withContext(function($ctx1) { return true;
  638. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLWorkspace.klass)})},
  639. messageSends: []}),
  640. smalltalk.HLWorkspace.klass);
  641. smalltalk.addMethod(
  642. "_tabLabel",
  643. smalltalk.method({
  644. selector: "tabLabel",
  645. fn: function (){
  646. var self=this;
  647. return smalltalk.withContext(function($ctx1) { return "Workspace";
  648. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLWorkspace.klass)})},
  649. messageSends: []}),
  650. smalltalk.HLWorkspace.klass);
  651. smalltalk.addMethod(
  652. "_tabPriority",
  653. smalltalk.method({
  654. selector: "tabPriority",
  655. fn: function (){
  656. var self=this;
  657. return smalltalk.withContext(function($ctx1) { return (10);
  658. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLWorkspace.klass)})},
  659. messageSends: []}),
  660. smalltalk.HLWorkspace.klass);
  661. smalltalk.addClass('HLWorkspaceModel', smalltalk.Object, ['announcer', 'environment', 'code'], 'Helios-Workspace');
  662. smalltalk.addMethod(
  663. "_announcer",
  664. smalltalk.method({
  665. selector: "announcer",
  666. fn: function (){
  667. var self=this;
  668. return smalltalk.withContext(function($ctx1) { var $2,$1;
  669. $2=self["@announcer"];
  670. if(($receiver = $2) == nil || $receiver == undefined){
  671. self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
  672. $1=self["@announcer"];
  673. } else {
  674. $1=$2;
  675. };
  676. return $1;
  677. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLWorkspaceModel)})},
  678. messageSends: ["ifNil:", "new"]}),
  679. smalltalk.HLWorkspaceModel);
  680. smalltalk.addMethod(
  681. "_code",
  682. smalltalk.method({
  683. selector: "code",
  684. fn: function (){
  685. var self=this;
  686. return smalltalk.withContext(function($ctx1) { var $2,$1;
  687. $2=self["@code"];
  688. if(($receiver = $2) == nil || $receiver == undefined){
  689. $1=_st((smalltalk.HLCodeModel || HLCodeModel))._on_(_st(self)._environment());
  690. } else {
  691. $1=$2;
  692. };
  693. return $1;
  694. }, function($ctx1) {$ctx1.fill(self,"code",{}, smalltalk.HLWorkspaceModel)})},
  695. messageSends: ["ifNil:", "on:", "environment"]}),
  696. smalltalk.HLWorkspaceModel);
  697. smalltalk.addMethod(
  698. "_environment",
  699. smalltalk.method({
  700. selector: "environment",
  701. fn: function (){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) { var $2,$1;
  704. $2=self["@environment"];
  705. if(($receiver = $2) == nil || $receiver == undefined){
  706. $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
  707. } else {
  708. $1=$2;
  709. };
  710. return $1;
  711. }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLWorkspaceModel)})},
  712. messageSends: ["ifNil:", "environment", "current"]}),
  713. smalltalk.HLWorkspaceModel);
  714. smalltalk.addMethod(
  715. "_environment_",
  716. smalltalk.method({
  717. selector: "environment:",
  718. fn: function (anEnvironment){
  719. var self=this;
  720. return smalltalk.withContext(function($ctx1) { self["@environment"]=anEnvironment;
  721. return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel)})},
  722. messageSends: []}),
  723. smalltalk.HLWorkspaceModel);
  724. smalltalk.addMethod(
  725. "_onKeyDown_",
  726. smalltalk.method({
  727. selector: "onKeyDown:",
  728. fn: function (anEvent){
  729. var self=this;
  730. return smalltalk.withContext(function($ctx1) { if(anEvent.ctrlKey) {
  731. if(anEvent.keyCode === 80) { //ctrl+p
  732. self._printIt();
  733. anEvent.preventDefault();
  734. return false;
  735. }
  736. if(anEvent.keyCode === 68) { //ctrl+d
  737. self._doIt();
  738. anEvent.preventDefault();
  739. return false;
  740. }
  741. if(anEvent.keyCode === 73) { //ctrl+i
  742. self._inspectIt();
  743. anEvent.preventDefault();
  744. return false;
  745. }
  746. };
  747. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLWorkspaceModel)})},
  748. messageSends: []}),
  749. smalltalk.HLWorkspaceModel);
  750. smalltalk.addMethod(
  751. "_on_",
  752. smalltalk.method({
  753. selector: "on:",
  754. fn: function (anEnvironment){
  755. var self=this;
  756. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  757. $2=_st(self)._new();
  758. _st($2)._environment_(anEnvironment);
  759. $3=_st($2)._yourself();
  760. $1=$3;
  761. return $1;
  762. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel.klass)})},
  763. messageSends: ["environment:", "new", "yourself"]}),
  764. smalltalk.HLWorkspaceModel.klass);