Helios-Workspace.deploy.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936
  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. "_configureEditor",
  150. smalltalk.method({
  151. selector: "configureEditor",
  152. fn: function (){
  153. var self=this;
  154. return smalltalk.withContext(function($ctx1) { _st(_st(self)._editor())._at_put_("amberCodeWidget",self);
  155. return self}, function($ctx1) {$ctx1.fill(self,"configureEditor",{}, smalltalk.HLCodeWidget)})},
  156. messageSends: ["at:put:", "editor"]}),
  157. smalltalk.HLCodeWidget);
  158. smalltalk.addMethod(
  159. "_contents",
  160. smalltalk.method({
  161. selector: "contents",
  162. fn: function (){
  163. var self=this;
  164. return smalltalk.withContext(function($ctx1) { var $1;
  165. $1=_st(self["@editor"])._getValue();
  166. return $1;
  167. }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.HLCodeWidget)})},
  168. messageSends: ["getValue"]}),
  169. smalltalk.HLCodeWidget);
  170. smalltalk.addMethod(
  171. "_contents_",
  172. smalltalk.method({
  173. selector: "contents:",
  174. fn: function (aString){
  175. var self=this;
  176. return smalltalk.withContext(function($ctx1) { _st(self["@editor"])._setValue_(aString);
  177. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString}, smalltalk.HLCodeWidget)})},
  178. messageSends: ["setValue:"]}),
  179. smalltalk.HLCodeWidget);
  180. smalltalk.addMethod(
  181. "_currentLine",
  182. smalltalk.method({
  183. selector: "currentLine",
  184. fn: function (){
  185. var self=this;
  186. return smalltalk.withContext(function($ctx1) { var $1;
  187. $1=_st(self["@editor"])._getLine_(_st(_st(self["@editor"])._getCursor())._line());
  188. return $1;
  189. }, function($ctx1) {$ctx1.fill(self,"currentLine",{}, smalltalk.HLCodeWidget)})},
  190. messageSends: ["getLine:", "line", "getCursor"]}),
  191. smalltalk.HLCodeWidget);
  192. smalltalk.addMethod(
  193. "_currentLineOrSelection",
  194. smalltalk.method({
  195. selector: "currentLineOrSelection",
  196. fn: function (){
  197. var self=this;
  198. return smalltalk.withContext(function($ctx1) { var $2,$1;
  199. $2=_st(self["@editor"])._somethingSelected();
  200. if(smalltalk.assert($2)){
  201. $1=_st(self)._selection();
  202. } else {
  203. $1=_st(self)._currentLine();
  204. };
  205. return $1;
  206. }, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{}, smalltalk.HLCodeWidget)})},
  207. messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"]}),
  208. smalltalk.HLCodeWidget);
  209. smalltalk.addMethod(
  210. "_doIt",
  211. smalltalk.method({
  212. selector: "doIt",
  213. fn: function (){
  214. var self=this;
  215. var result;
  216. return smalltalk.withContext(function($ctx1) { var $1;
  217. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItRequested || HLDoItRequested))._on_(self["@model"]));
  218. result=_st(self["@model"])._doIt_(_st(self)._currentLineOrSelection());
  219. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItExecuted || HLDoItExecuted))._on_(self["@model"]));
  220. $1=result;
  221. return $1;
  222. }, function($ctx1) {$ctx1.fill(self,"doIt",{result:result}, smalltalk.HLCodeWidget)})},
  223. messageSends: ["announce:", "on:", "announcer", "doIt:", "currentLineOrSelection"]}),
  224. smalltalk.HLCodeWidget);
  225. smalltalk.addMethod(
  226. "_editor",
  227. smalltalk.method({
  228. selector: "editor",
  229. fn: function (){
  230. var self=this;
  231. return smalltalk.withContext(function($ctx1) { var $1;
  232. $1=self["@editor"];
  233. return $1;
  234. }, function($ctx1) {$ctx1.fill(self,"editor",{}, smalltalk.HLCodeWidget)})},
  235. messageSends: []}),
  236. smalltalk.HLCodeWidget);
  237. smalltalk.addMethod(
  238. "_focus",
  239. smalltalk.method({
  240. selector: "focus",
  241. fn: function (){
  242. var self=this;
  243. return smalltalk.withContext(function($ctx1) { _st(self["@editor"])._focus();
  244. return self}, function($ctx1) {$ctx1.fill(self,"focus",{}, smalltalk.HLCodeWidget)})},
  245. messageSends: ["focus"]}),
  246. smalltalk.HLCodeWidget);
  247. smalltalk.addMethod(
  248. "_inspectIt",
  249. smalltalk.method({
  250. selector: "inspectIt",
  251. fn: function (){
  252. var self=this;
  253. var newInspector;
  254. return smalltalk.withContext(function($ctx1) { _st(_st(self)._announcer())._announce_(_st((smalltalk.HLInspectItRequested || HLInspectItRequested))._on_(self["@model"]));
  255. newInspector=_st(self)._makeInspectorOn_(_st(self)._doIt());
  256. _st(newInspector)._open();
  257. return self}, function($ctx1) {$ctx1.fill(self,"inspectIt",{newInspector:newInspector}, smalltalk.HLCodeWidget)})},
  258. messageSends: ["announce:", "on:", "announcer", "makeInspectorOn:", "doIt", "open"]}),
  259. smalltalk.HLCodeWidget);
  260. smalltalk.addMethod(
  261. "_makeInspectorOn_",
  262. smalltalk.method({
  263. selector: "makeInspectorOn:",
  264. fn: function (anObject){
  265. var self=this;
  266. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  267. $2=_st((smalltalk.HLInspector || HLInspector))._new();
  268. _st($2)._inspect_(anObject);
  269. $3=_st($2)._yourself();
  270. $1=$3;
  271. return $1;
  272. }, function($ctx1) {$ctx1.fill(self,"makeInspectorOn:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  273. messageSends: ["inspect:", "new", "yourself"]}),
  274. smalltalk.HLCodeWidget);
  275. smalltalk.addMethod(
  276. "_model",
  277. smalltalk.method({
  278. selector: "model",
  279. fn: function (){
  280. var self=this;
  281. return smalltalk.withContext(function($ctx1) { var $2,$1;
  282. $2=self["@model"];
  283. if(($receiver = $2) == nil || $receiver == undefined){
  284. _st(self)._model_(_st((smalltalk.HLCodeModel || HLCodeModel))._new());
  285. $1=self["@model"];
  286. } else {
  287. $1=$2;
  288. };
  289. return $1;
  290. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLCodeWidget)})},
  291. messageSends: ["ifNil:", "model:", "new"]}),
  292. smalltalk.HLCodeWidget);
  293. smalltalk.addMethod(
  294. "_model_",
  295. smalltalk.method({
  296. selector: "model:",
  297. fn: function (aModel){
  298. var self=this;
  299. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  300. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLCodeWidget)})},
  301. messageSends: []}),
  302. smalltalk.HLCodeWidget);
  303. smalltalk.addMethod(
  304. "_onDoIt",
  305. smalltalk.method({
  306. selector: "onDoIt",
  307. fn: function (){
  308. var self=this;
  309. return smalltalk.withContext(function($ctx1) { _st(self)._doIt();
  310. return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLCodeWidget)})},
  311. messageSends: ["doIt"]}),
  312. smalltalk.HLCodeWidget);
  313. smalltalk.addMethod(
  314. "_onInspectIt",
  315. smalltalk.method({
  316. selector: "onInspectIt",
  317. fn: function (){
  318. var self=this;
  319. return smalltalk.withContext(function($ctx1) { _st(self)._inspectIt();
  320. return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLCodeWidget)})},
  321. messageSends: ["inspectIt"]}),
  322. smalltalk.HLCodeWidget);
  323. smalltalk.addMethod(
  324. "_onPrintIt",
  325. smalltalk.method({
  326. selector: "onPrintIt",
  327. fn: function (){
  328. var self=this;
  329. return smalltalk.withContext(function($ctx1) { _st(self)._printIt();
  330. return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLCodeWidget)})},
  331. messageSends: ["printIt"]}),
  332. smalltalk.HLCodeWidget);
  333. smalltalk.addMethod(
  334. "_onSaveIt",
  335. smalltalk.method({
  336. selector: "onSaveIt",
  337. fn: function (){
  338. var self=this;
  339. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLCodeWidget)})},
  340. messageSends: []}),
  341. smalltalk.HLCodeWidget);
  342. smalltalk.addMethod(
  343. "_print_",
  344. smalltalk.method({
  345. selector: "print:",
  346. fn: function (aString){
  347. var self=this;
  348. var start,stop,currentLine;
  349. return smalltalk.withContext(function($ctx1) { currentLine=_st(_st(self["@editor"])._getCursor_(false))._line();
  350. start=_st((smalltalk.HashedCollection || HashedCollection))._new();
  351. _st(start)._at_put_("line",currentLine);
  352. _st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
  353. _st(_st(self["@editor"])._getSelection())._ifEmpty_((function(){
  354. return smalltalk.withContext(function($ctx2) { _st(start)._at_put_("ch",_st(_st(self["@editor"])._getLine_(currentLine))._size());
  355. return _st(self["@editor"])._setSelection_end_(smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(currentLine),_st("ch").__minus_gt((0))]),start);
  356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  357. stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
  358. _st(stop)._at_put_("line",currentLine);
  359. _st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
  360. _st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
  361. _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
  362. _st(self["@editor"])._setSelection_end_(stop,start);
  363. return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine}, smalltalk.HLCodeWidget)})},
  364. messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "size", "getLine:", "setSelection:end:", "->", "getSelection", "+", "at:", "replaceSelection:", ",", "setCursor:"]}),
  365. smalltalk.HLCodeWidget);
  366. smalltalk.addMethod(
  367. "_printIt",
  368. smalltalk.method({
  369. selector: "printIt",
  370. fn: function (){
  371. var self=this;
  372. var result;
  373. return smalltalk.withContext(function($ctx1) { result=_st(self)._doIt();
  374. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLPrintItRequested || HLPrintItRequested))._on_(self["@model"]));
  375. _st(self)._print_(_st(result)._printString());
  376. _st(self)._focus();
  377. return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result}, smalltalk.HLCodeWidget)})},
  378. messageSends: ["doIt", "announce:", "on:", "announcer", "print:", "printString", "focus"]}),
  379. smalltalk.HLCodeWidget);
  380. smalltalk.addMethod(
  381. "_receiver",
  382. smalltalk.method({
  383. selector: "receiver",
  384. fn: function (){
  385. var self=this;
  386. return smalltalk.withContext(function($ctx1) { var $1;
  387. $1=_st(_st(self)._model())._receiver();
  388. return $1;
  389. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeWidget)})},
  390. messageSends: ["receiver", "model"]}),
  391. smalltalk.HLCodeWidget);
  392. smalltalk.addMethod(
  393. "_receiver_",
  394. smalltalk.method({
  395. selector: "receiver:",
  396. fn: function (anObject){
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) { _st(_st(self)._model())._receiver_(anObject);
  399. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  400. messageSends: ["receiver:", "model"]}),
  401. smalltalk.HLCodeWidget);
  402. smalltalk.addMethod(
  403. "_renderContentOn_",
  404. smalltalk.method({
  405. selector: "renderContentOn:",
  406. fn: function (html){
  407. var self=this;
  408. return smalltalk.withContext(function($ctx1) { self["@code"]=_st(html)._textarea();
  409. _st(self)._setEditorOn_(_st(self["@code"])._element());
  410. _st(self)._configureEditor();
  411. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLCodeWidget)})},
  412. messageSends: ["textarea", "setEditorOn:", "element", "configureEditor"]}),
  413. smalltalk.HLCodeWidget);
  414. smalltalk.addMethod(
  415. "_saveIt",
  416. smalltalk.method({
  417. selector: "saveIt",
  418. fn: function (){
  419. var self=this;
  420. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLCodeWidget)})},
  421. messageSends: []}),
  422. smalltalk.HLCodeWidget);
  423. smalltalk.addMethod(
  424. "_selection",
  425. smalltalk.method({
  426. selector: "selection",
  427. fn: function (){
  428. var self=this;
  429. return smalltalk.withContext(function($ctx1) { var $1;
  430. $1=_st(self["@editor"])._getSelection();
  431. return $1;
  432. }, function($ctx1) {$ctx1.fill(self,"selection",{}, smalltalk.HLCodeWidget)})},
  433. messageSends: ["getSelection"]}),
  434. smalltalk.HLCodeWidget);
  435. smalltalk.addMethod(
  436. "_selectionEnd",
  437. smalltalk.method({
  438. selector: "selectionEnd",
  439. fn: function (){
  440. var self=this;
  441. return smalltalk.withContext(function($ctx1) { var $1;
  442. $1=_st(_st(self["@code"])._element())._selectionEnd();
  443. return $1;
  444. }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{}, smalltalk.HLCodeWidget)})},
  445. messageSends: ["selectionEnd", "element"]}),
  446. smalltalk.HLCodeWidget);
  447. smalltalk.addMethod(
  448. "_selectionEnd_",
  449. smalltalk.method({
  450. selector: "selectionEnd:",
  451. fn: function (anInteger){
  452. var self=this;
  453. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionEnd_(anInteger);
  454. return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  455. messageSends: ["selectionEnd:", "element"]}),
  456. smalltalk.HLCodeWidget);
  457. smalltalk.addMethod(
  458. "_selectionStart",
  459. smalltalk.method({
  460. selector: "selectionStart",
  461. fn: function (){
  462. var self=this;
  463. return smalltalk.withContext(function($ctx1) { var $1;
  464. $1=_st(_st(self["@code"])._element())._selectionStart();
  465. return $1;
  466. }, function($ctx1) {$ctx1.fill(self,"selectionStart",{}, smalltalk.HLCodeWidget)})},
  467. messageSends: ["selectionStart", "element"]}),
  468. smalltalk.HLCodeWidget);
  469. smalltalk.addMethod(
  470. "_selectionStart_",
  471. smalltalk.method({
  472. selector: "selectionStart:",
  473. fn: function (anInteger){
  474. var self=this;
  475. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionStart_(anInteger);
  476. return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  477. messageSends: ["selectionStart:", "element"]}),
  478. smalltalk.HLCodeWidget);
  479. smalltalk.addMethod(
  480. "_setEditorOn_",
  481. smalltalk.method({
  482. selector: "setEditorOn:",
  483. fn: function (aTextarea){
  484. var self=this;
  485. return smalltalk.withContext(function($ctx1) { self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  486. theme: 'amber',
  487. lineNumbers: true,
  488. enterMode: 'flat',
  489. indentWithTabs: true,
  490. indentUnit: 4,
  491. matchBrackets: true,
  492. electricChars: false,
  493. keyMap: 'Amber'
  494. });
  495. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea}, smalltalk.HLCodeWidget)})},
  496. messageSends: []}),
  497. smalltalk.HLCodeWidget);
  498. smalltalk.addMethod(
  499. "_initialize",
  500. smalltalk.method({
  501. selector: "initialize",
  502. fn: function (){
  503. var self=this;
  504. return smalltalk.withContext(function($ctx1) { var $1,$2;
  505. smalltalk.HLWidget.klass.fn.prototype._initialize.apply(_st(self), []);
  506. $1=self;
  507. _st($1)._setupCodeMirror();
  508. _st($1)._setupCommands();
  509. $2=_st($1)._setupKeyMaps();
  510. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLCodeWidget.klass)})},
  511. messageSends: ["initialize", "setupCodeMirror", "setupCommands", "setupKeyMaps"]}),
  512. smalltalk.HLCodeWidget.klass);
  513. smalltalk.addMethod(
  514. "_keyMap",
  515. smalltalk.method({
  516. selector: "keyMap",
  517. fn: function (){
  518. var self=this;
  519. return smalltalk.withContext(function($ctx1) { var $2,$1;
  520. $2=_st(_st(_st((smalltalk.HLManager || HLManager))._current())._keyBinder())._systemIsMac();
  521. if(smalltalk.assert($2)){
  522. $1=_st(self)._macKeyMap();
  523. } else {
  524. $1=_st(self)._pcKeyMap();
  525. };
  526. return $1;
  527. }, function($ctx1) {$ctx1.fill(self,"keyMap",{}, smalltalk.HLCodeWidget.klass)})},
  528. messageSends: ["ifTrue:ifFalse:", "macKeyMap", "pcKeyMap", "systemIsMac", "keyBinder", "current"]}),
  529. smalltalk.HLCodeWidget.klass);
  530. smalltalk.addMethod(
  531. "_macKeyMap",
  532. smalltalk.method({
  533. selector: "macKeyMap",
  534. fn: function (){
  535. var self=this;
  536. return smalltalk.withContext(function($ctx1) { var $1;
  537. $1=smalltalk.HashedCollection._fromPairs_([_st("Alt-Backspace").__minus_gt("delWordBefore"),_st("Alt-Delete").__minus_gt("delWordAfter"),_st("Alt-Left").__minus_gt("goWordBoundaryLeft"),_st("Alt-Right").__minus_gt("goWordBoundaryRight"),_st("Cmd-A").__minus_gt("selectAll"),_st("Cmd-Alt-F").__minus_gt("replace"),_st("Cmd-D").__minus_gt("doIt"),_st("Cmd-Down").__minus_gt("goDocEnd"),_st("Cmd-End").__minus_gt("goDocEnd"),_st("Cmd-F").__minus_gt("find"),_st("Cmd-G").__minus_gt("findNext"),_st("Cmd-I").__minus_gt("inspectIt"),_st("Cmd-Left").__minus_gt("goLineStart"),_st("Cmd-P").__minus_gt("printIt"),_st("Cmd-Right").__minus_gt("goLineEnd"),_st("Cmd-S").__minus_gt("saveIt"),_st("Cmd-Up").__minus_gt("goDocStart"),_st("Cmd-Y").__minus_gt("redo"),_st("Cmd-Z").__minus_gt("undo"),_st("Cmd-[").__minus_gt("indentLess"),_st("Cmd-]").__minus_gt("indentMore"),_st("Ctrl-Alt-Backspace").__minus_gt("delWordAfter"),_st("Shift-Cmd-Alt-F").__minus_gt("replaceAll"),_st("Shift-Cmd-G").__minus_gt("findPrev"),_st("Shift-Cmd-Z").__minus_gt("redo"),_st("fallthrough").__minus_gt(["basic"])]);
  538. return $1;
  539. }, function($ctx1) {$ctx1.fill(self,"macKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  540. messageSends: ["->"]}),
  541. smalltalk.HLCodeWidget.klass);
  542. smalltalk.addMethod(
  543. "_pcKeyMap",
  544. smalltalk.method({
  545. selector: "pcKeyMap",
  546. fn: function (){
  547. var self=this;
  548. return smalltalk.withContext(function($ctx1) { var $1;
  549. $1=[_st("Alt-Left").__minus_gt("goLineStart"),_st("Alt-Right").__minus_gt("goLineEnd"),_st("Alt-Up").__minus_gt("goDocStart"),_st("Ctrl-A").__minus_gt("selectAll"),_st("Ctrl-Backspace").__minus_gt("delWordBefore"),_st("Ctrl-D").__minus_gt("doIt"),_st("Ctrl-Delete").__minus_gt("delWordAfter"),_st("Ctrl-Down").__minus_gt("goDocEnd"),_st("Ctrl-End").__minus_gt("goDocEnd"),_st("Ctrl-F").__minus_gt("find"),_st("Ctrl-G").__minus_gt("findNext"),_st("Ctrl-I").__minus_gt("inspectIt"),_st("Ctrl-Home").__minus_gt("goDocStart"),_st("Ctrl-Left").__minus_gt("goWordBoundaryLeft"),_st("Ctrl-P").__minus_gt("printIt"),_st("Ctrl-Right").__minus_gt("goWordBoundaryRight"),_st("Ctrl-S").__minus_gt("saveIt"),_st("Ctrl-Y").__minus_gt("redo"),_st("Ctrl-Z").__minus_gt("undo"),_st("Ctrl-[").__minus_gt("indentLess"),_st("Ctrl-]").__minus_gt("indentMore"),_st("Shift-Ctrl-F").__minus_gt("replace"),_st("Shift-Ctrl-G").__minus_gt("findPrev"),_st("Shift-Ctrl-R").__minus_gt("replaceAll"),_st("Shift-Ctrl-Z").__minus_gt("redo"),_st("fallthrough").__minus_gt(["basic"])];
  550. return $1;
  551. }, function($ctx1) {$ctx1.fill(self,"pcKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  552. messageSends: ["->"]}),
  553. smalltalk.HLCodeWidget.klass);
  554. smalltalk.addMethod(
  555. "_setupCodeMirror",
  556. smalltalk.method({
  557. selector: "setupCodeMirror",
  558. fn: function (){
  559. var self=this;
  560. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap.default.fallthrough = ["basic"] ;
  561. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{}, smalltalk.HLCodeWidget.klass)})},
  562. messageSends: []}),
  563. smalltalk.HLCodeWidget.klass);
  564. smalltalk.addMethod(
  565. "_setupCommands",
  566. smalltalk.method({
  567. selector: "setupCommands",
  568. fn: function (){
  569. var self=this;
  570. return smalltalk.withContext(function($ctx1) { var $1,$2;
  571. $1=_st((smalltalk.CodeMirror || CodeMirror))._basicAt_("commands");
  572. _st($1)._at_put_("doIt",(function(cm){
  573. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._doIt();
  574. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  575. _st($1)._at_put_("inspectIt",(function(cm){
  576. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._inspectIt();
  577. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  578. _st($1)._at_put_("printIt",(function(cm){
  579. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._printIt();
  580. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  581. $2=_st($1)._at_put_("saveIt",(function(cm){
  582. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._saveIt();
  583. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  584. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{}, smalltalk.HLCodeWidget.klass)})},
  585. messageSends: ["at:put:", "doIt", "amberCodeWidget", "basicAt:", "inspectIt", "printIt", "saveIt"]}),
  586. smalltalk.HLCodeWidget.klass);
  587. smalltalk.addMethod(
  588. "_setupKeyMaps",
  589. smalltalk.method({
  590. selector: "setupKeyMaps",
  591. fn: function (){
  592. var self=this;
  593. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap['Amber'] = self._keyMap();
  594. return self}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{}, smalltalk.HLCodeWidget.klass)})},
  595. messageSends: []}),
  596. smalltalk.HLCodeWidget.klass);
  597. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, [], 'Helios-Workspace');
  598. smalltalk.addMethod(
  599. "_onKeyDown_",
  600. smalltalk.method({
  601. selector: "onKeyDown:",
  602. fn: function (anEvent){
  603. var self=this;
  604. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  605. $1=smalltalk.HLCodeWidget.fn.prototype._onKeyDown_.apply(_st(self), [anEvent]);
  606. if(! smalltalk.assert($1)){
  607. return false;
  608. };
  609. $2=_st(anEvent)._ctrlKey();
  610. if(smalltalk.assert($2)){
  611. $3=_st(_st(anEvent)._keyCode()).__eq((83));
  612. if(smalltalk.assert($3)){
  613. _st(self)._onSave();
  614. _st(anEvent)._preventDefault();
  615. return false;
  616. };
  617. };
  618. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLSourceCodeWidget)})},
  619. messageSends: ["ifFalse:", "onKeyDown:", "ifTrue:", "onSave", "preventDefault", "=", "keyCode", "ctrlKey"]}),
  620. smalltalk.HLSourceCodeWidget);
  621. smalltalk.addMethod(
  622. "_onSave",
  623. smalltalk.method({
  624. selector: "onSave",
  625. fn: function (){
  626. var self=this;
  627. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSave",{}, smalltalk.HLSourceCodeWidget)})},
  628. messageSends: []}),
  629. smalltalk.HLSourceCodeWidget);
  630. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['model', 'codeWidget'], 'Helios-Workspace');
  631. smalltalk.addMethod(
  632. "_codeWidget",
  633. smalltalk.method({
  634. selector: "codeWidget",
  635. fn: function (){
  636. var self=this;
  637. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$1;
  638. $2=self["@codeWidget"];
  639. if(($receiver = $2) == nil || $receiver == undefined){
  640. $3=_st((smalltalk.HLCodeWidget || HLCodeWidget))._new();
  641. _st($3)._model_(_st(_st(self)._model())._code());
  642. $4=_st($3)._yourself();
  643. self["@codeWidget"]=$4;
  644. $1=self["@codeWidget"];
  645. } else {
  646. $1=$2;
  647. };
  648. return $1;
  649. }, function($ctx1) {$ctx1.fill(self,"codeWidget",{}, smalltalk.HLWorkspace)})},
  650. messageSends: ["ifNil:", "model:", "code", "model", "new", "yourself"]}),
  651. smalltalk.HLWorkspace);
  652. smalltalk.addMethod(
  653. "_model",
  654. smalltalk.method({
  655. selector: "model",
  656. fn: function (){
  657. var self=this;
  658. return smalltalk.withContext(function($ctx1) { var $2,$1;
  659. $2=self["@model"];
  660. if(($receiver = $2) == nil || $receiver == undefined){
  661. _st(self)._model_(_st((smalltalk.HLWorkspaceModel || HLWorkspaceModel))._new());
  662. $1=self["@model"];
  663. } else {
  664. $1=$2;
  665. };
  666. return $1;
  667. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLWorkspace)})},
  668. messageSends: ["ifNil:", "model:", "new"]}),
  669. smalltalk.HLWorkspace);
  670. smalltalk.addMethod(
  671. "_model_",
  672. smalltalk.method({
  673. selector: "model:",
  674. fn: function (aModel){
  675. var self=this;
  676. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  677. _st(_st(self)._codeWidget())._model_(_st(aModel)._code());
  678. _st(self)._observeCodeWidget();
  679. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLWorkspace)})},
  680. messageSends: ["model:", "code", "codeWidget", "observeCodeWidget"]}),
  681. smalltalk.HLWorkspace);
  682. smalltalk.addMethod(
  683. "_observeCodeWidget",
  684. smalltalk.method({
  685. selector: "observeCodeWidget",
  686. fn: function (){
  687. var self=this;
  688. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"observeCodeWidget",{}, smalltalk.HLWorkspace)})},
  689. messageSends: []}),
  690. smalltalk.HLWorkspace);
  691. smalltalk.addMethod(
  692. "_onDoIt",
  693. smalltalk.method({
  694. selector: "onDoIt",
  695. fn: function (){
  696. var self=this;
  697. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLWorkspace)})},
  698. messageSends: []}),
  699. smalltalk.HLWorkspace);
  700. smalltalk.addMethod(
  701. "_onInspectIt",
  702. smalltalk.method({
  703. selector: "onInspectIt",
  704. fn: function (){
  705. var self=this;
  706. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLWorkspace)})},
  707. messageSends: []}),
  708. smalltalk.HLWorkspace);
  709. smalltalk.addMethod(
  710. "_onPrintIt",
  711. smalltalk.method({
  712. selector: "onPrintIt",
  713. fn: function (){
  714. var self=this;
  715. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLWorkspace)})},
  716. messageSends: []}),
  717. smalltalk.HLWorkspace);
  718. smalltalk.addMethod(
  719. "_renderContentOn_",
  720. smalltalk.method({
  721. selector: "renderContentOn:",
  722. fn: function (html){
  723. var self=this;
  724. return smalltalk.withContext(function($ctx1) { _st(html)._with_(_st(self)._codeWidget());
  725. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLWorkspace)})},
  726. messageSends: ["with:", "codeWidget"]}),
  727. smalltalk.HLWorkspace);
  728. smalltalk.addMethod(
  729. "_canBeOpenAsTab",
  730. smalltalk.method({
  731. selector: "canBeOpenAsTab",
  732. fn: function (){
  733. var self=this;
  734. return smalltalk.withContext(function($ctx1) { return true;
  735. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLWorkspace.klass)})},
  736. messageSends: []}),
  737. smalltalk.HLWorkspace.klass);
  738. smalltalk.addMethod(
  739. "_tabLabel",
  740. smalltalk.method({
  741. selector: "tabLabel",
  742. fn: function (){
  743. var self=this;
  744. return smalltalk.withContext(function($ctx1) { return "Workspace";
  745. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLWorkspace.klass)})},
  746. messageSends: []}),
  747. smalltalk.HLWorkspace.klass);
  748. smalltalk.addMethod(
  749. "_tabPriority",
  750. smalltalk.method({
  751. selector: "tabPriority",
  752. fn: function (){
  753. var self=this;
  754. return smalltalk.withContext(function($ctx1) { return (10);
  755. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLWorkspace.klass)})},
  756. messageSends: []}),
  757. smalltalk.HLWorkspace.klass);
  758. smalltalk.addClass('HLWorkspaceModel', smalltalk.Object, ['announcer', 'environment', 'code'], 'Helios-Workspace');
  759. smalltalk.addMethod(
  760. "_announcer",
  761. smalltalk.method({
  762. selector: "announcer",
  763. fn: function (){
  764. var self=this;
  765. return smalltalk.withContext(function($ctx1) { var $2,$1;
  766. $2=self["@announcer"];
  767. if(($receiver = $2) == nil || $receiver == undefined){
  768. self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
  769. $1=self["@announcer"];
  770. } else {
  771. $1=$2;
  772. };
  773. return $1;
  774. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLWorkspaceModel)})},
  775. messageSends: ["ifNil:", "new"]}),
  776. smalltalk.HLWorkspaceModel);
  777. smalltalk.addMethod(
  778. "_code",
  779. smalltalk.method({
  780. selector: "code",
  781. fn: function (){
  782. var self=this;
  783. return smalltalk.withContext(function($ctx1) { var $2,$1;
  784. $2=self["@code"];
  785. if(($receiver = $2) == nil || $receiver == undefined){
  786. $1=_st((smalltalk.HLCodeModel || HLCodeModel))._on_(_st(self)._environment());
  787. } else {
  788. $1=$2;
  789. };
  790. return $1;
  791. }, function($ctx1) {$ctx1.fill(self,"code",{}, smalltalk.HLWorkspaceModel)})},
  792. messageSends: ["ifNil:", "on:", "environment"]}),
  793. smalltalk.HLWorkspaceModel);
  794. smalltalk.addMethod(
  795. "_environment",
  796. smalltalk.method({
  797. selector: "environment",
  798. fn: function (){
  799. var self=this;
  800. return smalltalk.withContext(function($ctx1) { var $2,$1;
  801. $2=self["@environment"];
  802. if(($receiver = $2) == nil || $receiver == undefined){
  803. $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
  804. } else {
  805. $1=$2;
  806. };
  807. return $1;
  808. }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLWorkspaceModel)})},
  809. messageSends: ["ifNil:", "environment", "current"]}),
  810. smalltalk.HLWorkspaceModel);
  811. smalltalk.addMethod(
  812. "_environment_",
  813. smalltalk.method({
  814. selector: "environment:",
  815. fn: function (anEnvironment){
  816. var self=this;
  817. return smalltalk.withContext(function($ctx1) { self["@environment"]=anEnvironment;
  818. return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel)})},
  819. messageSends: []}),
  820. smalltalk.HLWorkspaceModel);
  821. smalltalk.addMethod(
  822. "_onKeyDown_",
  823. smalltalk.method({
  824. selector: "onKeyDown:",
  825. fn: function (anEvent){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) { if(anEvent.ctrlKey) {
  828. if(anEvent.keyCode === 80) { //ctrl+p
  829. self._printIt();
  830. anEvent.preventDefault();
  831. return false;
  832. }
  833. if(anEvent.keyCode === 68) { //ctrl+d
  834. self._doIt();
  835. anEvent.preventDefault();
  836. return false;
  837. }
  838. if(anEvent.keyCode === 73) { //ctrl+i
  839. self._inspectIt();
  840. anEvent.preventDefault();
  841. return false;
  842. }
  843. };
  844. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLWorkspaceModel)})},
  845. messageSends: []}),
  846. smalltalk.HLWorkspaceModel);
  847. smalltalk.addMethod(
  848. "_on_",
  849. smalltalk.method({
  850. selector: "on:",
  851. fn: function (anEnvironment){
  852. var self=this;
  853. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  854. $2=_st(self)._new();
  855. _st($2)._environment_(anEnvironment);
  856. $3=_st($2)._yourself();
  857. $1=$3;
  858. return $1;
  859. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel.klass)})},
  860. messageSends: ["environment:", "new", "yourself"]}),
  861. smalltalk.HLWorkspaceModel.klass);