Helios-Workspace.deploy.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  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(self["@editor"])._focus();
  234. return self}, function($ctx1) {$ctx1.fill(self,"focus",{}, smalltalk.HLCodeWidget)})},
  235. messageSends: ["focus"]}),
  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,currentLine;
  368. return smalltalk.withContext(function($ctx1) { currentLine=_st(_st(self["@editor"])._getCursor_(false))._line();
  369. start=_st((smalltalk.HashedCollection || HashedCollection))._new();
  370. _st(start)._at_put_("line",currentLine);
  371. _st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
  372. _st(_st(self["@editor"])._getSelection())._ifEmpty_((function(){
  373. return smalltalk.withContext(function($ctx2) { _st(start)._at_put_("ch",_st(_st(self["@editor"])._getLine_(currentLine))._size());
  374. return _st(self["@editor"])._setSelection_end_(smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(currentLine),_st("ch").__minus_gt((0))]),start);
  375. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  376. stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
  377. _st(stop)._at_put_("line",currentLine);
  378. _st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
  379. _st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
  380. _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
  381. _st(self["@editor"])._setSelection_end_(stop,start);
  382. return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine}, smalltalk.HLCodeWidget)})},
  383. messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "size", "getLine:", "setSelection:end:", "->", "getSelection", "+", "at:", "replaceSelection:", ",", "setCursor:"]}),
  384. smalltalk.HLCodeWidget);
  385. smalltalk.addMethod(
  386. "_printIt",
  387. smalltalk.method({
  388. selector: "printIt",
  389. fn: function (){
  390. var self=this;
  391. var result;
  392. return smalltalk.withContext(function($ctx1) { result=_st(self)._doIt();
  393. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLPrintItRequested || HLPrintItRequested))._on_(self["@model"]));
  394. _st(self)._print_(_st(result)._printString());
  395. _st(self)._focus();
  396. return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result}, smalltalk.HLCodeWidget)})},
  397. messageSends: ["doIt", "announce:", "on:", "announcer", "print:", "printString", "focus"]}),
  398. smalltalk.HLCodeWidget);
  399. smalltalk.addMethod(
  400. "_receiver",
  401. smalltalk.method({
  402. selector: "receiver",
  403. fn: function (){
  404. var self=this;
  405. return smalltalk.withContext(function($ctx1) { var $1;
  406. $1=_st(_st(self)._model())._receiver();
  407. return $1;
  408. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeWidget)})},
  409. messageSends: ["receiver", "model"]}),
  410. smalltalk.HLCodeWidget);
  411. smalltalk.addMethod(
  412. "_receiver_",
  413. smalltalk.method({
  414. selector: "receiver:",
  415. fn: function (anObject){
  416. var self=this;
  417. return smalltalk.withContext(function($ctx1) { _st(_st(self)._model())._receiver_(anObject);
  418. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  419. messageSends: ["receiver:", "model"]}),
  420. smalltalk.HLCodeWidget);
  421. smalltalk.addMethod(
  422. "_renderContentOn_",
  423. smalltalk.method({
  424. selector: "renderContentOn:",
  425. fn: function (html){
  426. var self=this;
  427. return smalltalk.withContext(function($ctx1) { self["@code"]=_st(html)._textarea();
  428. _st(self)._setEditorOn_(_st(self["@code"])._element());
  429. _st(self)._observeWrapper();
  430. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLCodeWidget)})},
  431. messageSends: ["textarea", "setEditorOn:", "element", "observeWrapper"]}),
  432. smalltalk.HLCodeWidget);
  433. smalltalk.addMethod(
  434. "_selection",
  435. smalltalk.method({
  436. selector: "selection",
  437. fn: function (){
  438. var self=this;
  439. return smalltalk.withContext(function($ctx1) { var $1;
  440. $1=_st(self["@editor"])._getSelection();
  441. return $1;
  442. }, function($ctx1) {$ctx1.fill(self,"selection",{}, smalltalk.HLCodeWidget)})},
  443. messageSends: ["getSelection"]}),
  444. smalltalk.HLCodeWidget);
  445. smalltalk.addMethod(
  446. "_selectionEnd",
  447. smalltalk.method({
  448. selector: "selectionEnd",
  449. fn: function (){
  450. var self=this;
  451. return smalltalk.withContext(function($ctx1) { var $1;
  452. $1=_st(_st(self["@code"])._element())._selectionEnd();
  453. return $1;
  454. }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{}, smalltalk.HLCodeWidget)})},
  455. messageSends: ["selectionEnd", "element"]}),
  456. smalltalk.HLCodeWidget);
  457. smalltalk.addMethod(
  458. "_selectionEnd_",
  459. smalltalk.method({
  460. selector: "selectionEnd:",
  461. fn: function (anInteger){
  462. var self=this;
  463. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionEnd_(anInteger);
  464. return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  465. messageSends: ["selectionEnd:", "element"]}),
  466. smalltalk.HLCodeWidget);
  467. smalltalk.addMethod(
  468. "_selectionStart",
  469. smalltalk.method({
  470. selector: "selectionStart",
  471. fn: function (){
  472. var self=this;
  473. return smalltalk.withContext(function($ctx1) { var $1;
  474. $1=_st(_st(self["@code"])._element())._selectionStart();
  475. return $1;
  476. }, function($ctx1) {$ctx1.fill(self,"selectionStart",{}, smalltalk.HLCodeWidget)})},
  477. messageSends: ["selectionStart", "element"]}),
  478. smalltalk.HLCodeWidget);
  479. smalltalk.addMethod(
  480. "_selectionStart_",
  481. smalltalk.method({
  482. selector: "selectionStart:",
  483. fn: function (anInteger){
  484. var self=this;
  485. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionStart_(anInteger);
  486. return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  487. messageSends: ["selectionStart:", "element"]}),
  488. smalltalk.HLCodeWidget);
  489. smalltalk.addMethod(
  490. "_setEditorOn_",
  491. smalltalk.method({
  492. selector: "setEditorOn:",
  493. fn: function (aTextarea){
  494. var self=this;
  495. return smalltalk.withContext(function($ctx1) { self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  496. theme: 'amber',
  497. lineNumbers: true,
  498. enterMode: 'flat',
  499. indentWithTabs: true,
  500. indentUnit: 4,
  501. matchBrackets: true,
  502. electricChars: false
  503. });
  504. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea}, smalltalk.HLCodeWidget)})},
  505. messageSends: []}),
  506. smalltalk.HLCodeWidget);
  507. smalltalk.addMethod(
  508. "_initialize",
  509. smalltalk.method({
  510. selector: "initialize",
  511. fn: function (){
  512. var self=this;
  513. return smalltalk.withContext(function($ctx1) { smalltalk.HLWidget.klass.fn.prototype._initialize.apply(_st(self), []);
  514. _st(self)._setupCodeMirror();
  515. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLCodeWidget.klass)})},
  516. messageSends: ["initialize", "setupCodeMirror"]}),
  517. smalltalk.HLCodeWidget.klass);
  518. smalltalk.addMethod(
  519. "_setupCodeMirror",
  520. smalltalk.method({
  521. selector: "setupCodeMirror",
  522. fn: function (){
  523. var self=this;
  524. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap.default.fallthrough = ["basic"] ;
  525. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{}, smalltalk.HLCodeWidget.klass)})},
  526. messageSends: []}),
  527. smalltalk.HLCodeWidget.klass);
  528. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, [], 'Helios-Workspace');
  529. smalltalk.addMethod(
  530. "_onKeyDown_",
  531. smalltalk.method({
  532. selector: "onKeyDown:",
  533. fn: function (anEvent){
  534. var self=this;
  535. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  536. $1=smalltalk.HLCodeWidget.fn.prototype._onKeyDown_.apply(_st(self), [anEvent]);
  537. if(! smalltalk.assert($1)){
  538. return false;
  539. };
  540. $2=_st(anEvent)._ctrlKey();
  541. if(smalltalk.assert($2)){
  542. $3=_st(_st(anEvent)._keyCode()).__eq((83));
  543. if(smalltalk.assert($3)){
  544. _st(self)._onSave();
  545. _st(anEvent)._preventDefault();
  546. return false;
  547. };
  548. };
  549. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLSourceCodeWidget)})},
  550. messageSends: ["ifFalse:", "onKeyDown:", "ifTrue:", "onSave", "preventDefault", "=", "keyCode", "ctrlKey"]}),
  551. smalltalk.HLSourceCodeWidget);
  552. smalltalk.addMethod(
  553. "_onSave",
  554. smalltalk.method({
  555. selector: "onSave",
  556. fn: function (){
  557. var self=this;
  558. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSave",{}, smalltalk.HLSourceCodeWidget)})},
  559. messageSends: []}),
  560. smalltalk.HLSourceCodeWidget);
  561. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['model', 'codeWidget'], 'Helios-Workspace');
  562. smalltalk.addMethod(
  563. "_codeWidget",
  564. smalltalk.method({
  565. selector: "codeWidget",
  566. fn: function (){
  567. var self=this;
  568. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$1;
  569. $2=self["@codeWidget"];
  570. if(($receiver = $2) == nil || $receiver == undefined){
  571. $3=_st((smalltalk.HLCodeWidget || HLCodeWidget))._new();
  572. _st($3)._model_(_st(_st(self)._model())._code());
  573. $4=_st($3)._yourself();
  574. self["@codeWidget"]=$4;
  575. $1=self["@codeWidget"];
  576. } else {
  577. $1=$2;
  578. };
  579. return $1;
  580. }, function($ctx1) {$ctx1.fill(self,"codeWidget",{}, smalltalk.HLWorkspace)})},
  581. messageSends: ["ifNil:", "model:", "code", "model", "new", "yourself"]}),
  582. smalltalk.HLWorkspace);
  583. smalltalk.addMethod(
  584. "_model",
  585. smalltalk.method({
  586. selector: "model",
  587. fn: function (){
  588. var self=this;
  589. return smalltalk.withContext(function($ctx1) { var $2,$1;
  590. $2=self["@model"];
  591. if(($receiver = $2) == nil || $receiver == undefined){
  592. _st(self)._model_(_st((smalltalk.HLWorkspaceModel || HLWorkspaceModel))._new());
  593. $1=self["@model"];
  594. } else {
  595. $1=$2;
  596. };
  597. return $1;
  598. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLWorkspace)})},
  599. messageSends: ["ifNil:", "model:", "new"]}),
  600. smalltalk.HLWorkspace);
  601. smalltalk.addMethod(
  602. "_model_",
  603. smalltalk.method({
  604. selector: "model:",
  605. fn: function (aModel){
  606. var self=this;
  607. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  608. _st(_st(self)._codeWidget())._model_(_st(aModel)._code());
  609. _st(self)._observeCodeWidget();
  610. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLWorkspace)})},
  611. messageSends: ["model:", "code", "codeWidget", "observeCodeWidget"]}),
  612. smalltalk.HLWorkspace);
  613. smalltalk.addMethod(
  614. "_observeCodeWidget",
  615. smalltalk.method({
  616. selector: "observeCodeWidget",
  617. fn: function (){
  618. var self=this;
  619. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"observeCodeWidget",{}, smalltalk.HLWorkspace)})},
  620. messageSends: []}),
  621. smalltalk.HLWorkspace);
  622. smalltalk.addMethod(
  623. "_onDoIt",
  624. smalltalk.method({
  625. selector: "onDoIt",
  626. fn: function (){
  627. var self=this;
  628. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLWorkspace)})},
  629. messageSends: []}),
  630. smalltalk.HLWorkspace);
  631. smalltalk.addMethod(
  632. "_onInspectIt",
  633. smalltalk.method({
  634. selector: "onInspectIt",
  635. fn: function (){
  636. var self=this;
  637. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLWorkspace)})},
  638. messageSends: []}),
  639. smalltalk.HLWorkspace);
  640. smalltalk.addMethod(
  641. "_onPrintIt",
  642. smalltalk.method({
  643. selector: "onPrintIt",
  644. fn: function (){
  645. var self=this;
  646. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLWorkspace)})},
  647. messageSends: []}),
  648. smalltalk.HLWorkspace);
  649. smalltalk.addMethod(
  650. "_renderContentOn_",
  651. smalltalk.method({
  652. selector: "renderContentOn:",
  653. fn: function (html){
  654. var self=this;
  655. return smalltalk.withContext(function($ctx1) { _st(html)._with_(_st(self)._codeWidget());
  656. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLWorkspace)})},
  657. messageSends: ["with:", "codeWidget"]}),
  658. smalltalk.HLWorkspace);
  659. smalltalk.addMethod(
  660. "_canBeOpenAsTab",
  661. smalltalk.method({
  662. selector: "canBeOpenAsTab",
  663. fn: function (){
  664. var self=this;
  665. return smalltalk.withContext(function($ctx1) { return true;
  666. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLWorkspace.klass)})},
  667. messageSends: []}),
  668. smalltalk.HLWorkspace.klass);
  669. smalltalk.addMethod(
  670. "_tabLabel",
  671. smalltalk.method({
  672. selector: "tabLabel",
  673. fn: function (){
  674. var self=this;
  675. return smalltalk.withContext(function($ctx1) { return "Workspace";
  676. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLWorkspace.klass)})},
  677. messageSends: []}),
  678. smalltalk.HLWorkspace.klass);
  679. smalltalk.addMethod(
  680. "_tabPriority",
  681. smalltalk.method({
  682. selector: "tabPriority",
  683. fn: function (){
  684. var self=this;
  685. return smalltalk.withContext(function($ctx1) { return (10);
  686. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLWorkspace.klass)})},
  687. messageSends: []}),
  688. smalltalk.HLWorkspace.klass);
  689. smalltalk.addClass('HLWorkspaceModel', smalltalk.Object, ['announcer', 'environment', 'code'], 'Helios-Workspace');
  690. smalltalk.addMethod(
  691. "_announcer",
  692. smalltalk.method({
  693. selector: "announcer",
  694. fn: function (){
  695. var self=this;
  696. return smalltalk.withContext(function($ctx1) { var $2,$1;
  697. $2=self["@announcer"];
  698. if(($receiver = $2) == nil || $receiver == undefined){
  699. self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
  700. $1=self["@announcer"];
  701. } else {
  702. $1=$2;
  703. };
  704. return $1;
  705. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLWorkspaceModel)})},
  706. messageSends: ["ifNil:", "new"]}),
  707. smalltalk.HLWorkspaceModel);
  708. smalltalk.addMethod(
  709. "_code",
  710. smalltalk.method({
  711. selector: "code",
  712. fn: function (){
  713. var self=this;
  714. return smalltalk.withContext(function($ctx1) { var $2,$1;
  715. $2=self["@code"];
  716. if(($receiver = $2) == nil || $receiver == undefined){
  717. $1=_st((smalltalk.HLCodeModel || HLCodeModel))._on_(_st(self)._environment());
  718. } else {
  719. $1=$2;
  720. };
  721. return $1;
  722. }, function($ctx1) {$ctx1.fill(self,"code",{}, smalltalk.HLWorkspaceModel)})},
  723. messageSends: ["ifNil:", "on:", "environment"]}),
  724. smalltalk.HLWorkspaceModel);
  725. smalltalk.addMethod(
  726. "_environment",
  727. smalltalk.method({
  728. selector: "environment",
  729. fn: function (){
  730. var self=this;
  731. return smalltalk.withContext(function($ctx1) { var $2,$1;
  732. $2=self["@environment"];
  733. if(($receiver = $2) == nil || $receiver == undefined){
  734. $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
  735. } else {
  736. $1=$2;
  737. };
  738. return $1;
  739. }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLWorkspaceModel)})},
  740. messageSends: ["ifNil:", "environment", "current"]}),
  741. smalltalk.HLWorkspaceModel);
  742. smalltalk.addMethod(
  743. "_environment_",
  744. smalltalk.method({
  745. selector: "environment:",
  746. fn: function (anEnvironment){
  747. var self=this;
  748. return smalltalk.withContext(function($ctx1) { self["@environment"]=anEnvironment;
  749. return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel)})},
  750. messageSends: []}),
  751. smalltalk.HLWorkspaceModel);
  752. smalltalk.addMethod(
  753. "_onKeyDown_",
  754. smalltalk.method({
  755. selector: "onKeyDown:",
  756. fn: function (anEvent){
  757. var self=this;
  758. return smalltalk.withContext(function($ctx1) { if(anEvent.ctrlKey) {
  759. if(anEvent.keyCode === 80) { //ctrl+p
  760. self._printIt();
  761. anEvent.preventDefault();
  762. return false;
  763. }
  764. if(anEvent.keyCode === 68) { //ctrl+d
  765. self._doIt();
  766. anEvent.preventDefault();
  767. return false;
  768. }
  769. if(anEvent.keyCode === 73) { //ctrl+i
  770. self._inspectIt();
  771. anEvent.preventDefault();
  772. return false;
  773. }
  774. };
  775. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLWorkspaceModel)})},
  776. messageSends: []}),
  777. smalltalk.HLWorkspaceModel);
  778. smalltalk.addMethod(
  779. "_on_",
  780. smalltalk.method({
  781. selector: "on:",
  782. fn: function (anEnvironment){
  783. var self=this;
  784. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  785. $2=_st(self)._new();
  786. _st($2)._environment_(anEnvironment);
  787. $3=_st($2)._yourself();
  788. $1=$3;
  789. return $1;
  790. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel.klass)})},
  791. messageSends: ["environment:", "new", "yourself"]}),
  792. smalltalk.HLWorkspaceModel.klass);