Helios-Workspace.deploy.js 26 KB

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