1
0

Helios-Workspace.deploy.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862
  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. 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:", "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. "_canBeOpenAsTab",
  500. smalltalk.method({
  501. selector: "canBeOpenAsTab",
  502. fn: function (){
  503. var self=this;
  504. return smalltalk.withContext(function($ctx1) { return true;
  505. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLCodeWidget.klass)})},
  506. messageSends: []}),
  507. smalltalk.HLCodeWidget.klass);
  508. smalltalk.addMethod(
  509. "_initialize",
  510. smalltalk.method({
  511. selector: "initialize",
  512. fn: function (){
  513. var self=this;
  514. return smalltalk.withContext(function($ctx1) { var $1,$2;
  515. smalltalk.HLWidget.klass.fn.prototype._initialize.apply(_st(self), []);
  516. $1=self;
  517. _st($1)._setupCodeMirror();
  518. _st($1)._setupCommands();
  519. $2=_st($1)._setupKeyMaps();
  520. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLCodeWidget.klass)})},
  521. messageSends: ["initialize", "setupCodeMirror", "setupCommands", "setupKeyMaps"]}),
  522. smalltalk.HLCodeWidget.klass);
  523. smalltalk.addMethod(
  524. "_keyMap",
  525. smalltalk.method({
  526. selector: "keyMap",
  527. fn: function (){
  528. var self=this;
  529. return smalltalk.withContext(function($ctx1) { var $2,$1;
  530. $2=_st(_st(_st((smalltalk.HLManager || HLManager))._current())._keyBinder())._systemIsMac();
  531. if(smalltalk.assert($2)){
  532. $1=_st(self)._macKeyMap();
  533. } else {
  534. $1=_st(self)._pcKeyMap();
  535. };
  536. return $1;
  537. }, function($ctx1) {$ctx1.fill(self,"keyMap",{}, smalltalk.HLCodeWidget.klass)})},
  538. messageSends: ["ifTrue:ifFalse:", "macKeyMap", "pcKeyMap", "systemIsMac", "keyBinder", "current"]}),
  539. smalltalk.HLCodeWidget.klass);
  540. smalltalk.addMethod(
  541. "_macKeyMap",
  542. smalltalk.method({
  543. selector: "macKeyMap",
  544. fn: function (){
  545. var self=this;
  546. return smalltalk.withContext(function($ctx1) { var $1;
  547. $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"])]);
  548. return $1;
  549. }, function($ctx1) {$ctx1.fill(self,"macKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  550. messageSends: ["->"]}),
  551. smalltalk.HLCodeWidget.klass);
  552. smalltalk.addMethod(
  553. "_pcKeyMap",
  554. smalltalk.method({
  555. selector: "pcKeyMap",
  556. fn: function (){
  557. var self=this;
  558. return smalltalk.withContext(function($ctx1) { var $1;
  559. $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"])];
  560. return $1;
  561. }, function($ctx1) {$ctx1.fill(self,"pcKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  562. messageSends: ["->"]}),
  563. smalltalk.HLCodeWidget.klass);
  564. smalltalk.addMethod(
  565. "_setupCodeMirror",
  566. smalltalk.method({
  567. selector: "setupCodeMirror",
  568. fn: function (){
  569. var self=this;
  570. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap.default.fallthrough = ["basic"] ;
  571. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{}, smalltalk.HLCodeWidget.klass)})},
  572. messageSends: []}),
  573. smalltalk.HLCodeWidget.klass);
  574. smalltalk.addMethod(
  575. "_setupCommands",
  576. smalltalk.method({
  577. selector: "setupCommands",
  578. fn: function (){
  579. var self=this;
  580. return smalltalk.withContext(function($ctx1) { var $1,$2;
  581. $1=_st((smalltalk.CodeMirror || CodeMirror))._basicAt_("commands");
  582. _st($1)._at_put_("doIt",(function(cm){
  583. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._doIt();
  584. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  585. _st($1)._at_put_("inspectIt",(function(cm){
  586. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._inspectIt();
  587. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  588. _st($1)._at_put_("printIt",(function(cm){
  589. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._printIt();
  590. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  591. $2=_st($1)._at_put_("saveIt",(function(cm){
  592. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._saveIt();
  593. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  594. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{}, smalltalk.HLCodeWidget.klass)})},
  595. messageSends: ["at:put:", "doIt", "amberCodeWidget", "basicAt:", "inspectIt", "printIt", "saveIt"]}),
  596. smalltalk.HLCodeWidget.klass);
  597. smalltalk.addMethod(
  598. "_setupKeyMaps",
  599. smalltalk.method({
  600. selector: "setupKeyMaps",
  601. fn: function (){
  602. var self=this;
  603. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap['Amber'] = self._keyMap();
  604. return self}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{}, smalltalk.HLCodeWidget.klass)})},
  605. messageSends: []}),
  606. smalltalk.HLCodeWidget.klass);
  607. smalltalk.addMethod(
  608. "_tabLabel",
  609. smalltalk.method({
  610. selector: "tabLabel",
  611. fn: function (){
  612. var self=this;
  613. return smalltalk.withContext(function($ctx1) { return "Workspace";
  614. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLCodeWidget.klass)})},
  615. messageSends: []}),
  616. smalltalk.HLCodeWidget.klass);
  617. smalltalk.addMethod(
  618. "_tabPriority",
  619. smalltalk.method({
  620. selector: "tabPriority",
  621. fn: function (){
  622. var self=this;
  623. return smalltalk.withContext(function($ctx1) { return (10);
  624. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLCodeWidget.klass)})},
  625. messageSends: []}),
  626. smalltalk.HLCodeWidget.klass);
  627. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, ['browserModel'], 'Helios-Workspace');
  628. smalltalk.addMethod(
  629. "_browserModel",
  630. smalltalk.method({
  631. selector: "browserModel",
  632. fn: function (){
  633. var self=this;
  634. return smalltalk.withContext(function($ctx1) { var $1;
  635. $1=self["@browserModel"];
  636. return $1;
  637. }, function($ctx1) {$ctx1.fill(self,"browserModel",{}, smalltalk.HLSourceCodeWidget)})},
  638. messageSends: []}),
  639. smalltalk.HLSourceCodeWidget);
  640. smalltalk.addMethod(
  641. "_browserModel_",
  642. smalltalk.method({
  643. selector: "browserModel:",
  644. fn: function (aBrowserModel){
  645. var self=this;
  646. return smalltalk.withContext(function($ctx1) { self["@browserModel"]=aBrowserModel;
  647. _st(self)._observeBrowserModel();
  648. return self}, function($ctx1) {$ctx1.fill(self,"browserModel:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget)})},
  649. messageSends: ["observeBrowserModel"]}),
  650. smalltalk.HLSourceCodeWidget);
  651. smalltalk.addMethod(
  652. "_observeBrowserModel",
  653. smalltalk.method({
  654. selector: "observeBrowserModel",
  655. fn: function (){
  656. var self=this;
  657. return smalltalk.withContext(function($ctx1) { var $1,$2;
  658. $1=_st(_st(self)._browserModel())._announcer();
  659. _st($1)._on_do_((smalltalk.HLSaveSourceCode || HLSaveSourceCode),(function(ann){
  660. return smalltalk.withContext(function($ctx2) { return _st(self)._onSaveIt();
  661. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  662. _st($1)._on_do_((smalltalk.HLParseErrorRaised || HLParseErrorRaised),(function(ann){
  663. return smalltalk.withContext(function($ctx2) { return _st(self)._onParseError_(ann);
  664. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  665. _st($1)._on_do_((smalltalk.HLCompileErrorRaised || HLCompileErrorRaised),(function(ann){
  666. return smalltalk.withContext(function($ctx2) { return _st(self)._onCompileError_(_st(ann)._error());
  667. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  668. _st($1)._on_do_((smalltalk.HLUnknownVariableErrorRaised || HLUnknownVariableErrorRaised),(function(ann){
  669. return smalltalk.withContext(function($ctx2) { return _st(self)._onUnknownVariableError_(_st(ann)._error());
  670. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  671. $2=_st($1)._on_do_((smalltalk.HLInstVarAdded || HLInstVarAdded),(function(ann){
  672. return smalltalk.withContext(function($ctx2) { return _st(self)._onInstVarAdded();
  673. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  674. return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{}, smalltalk.HLSourceCodeWidget)})},
  675. messageSends: ["on:do:", "onSaveIt", "announcer", "browserModel", "onParseError:", "onCompileError:", "error", "onUnknownVariableError:", "onInstVarAdded"]}),
  676. smalltalk.HLSourceCodeWidget);
  677. smalltalk.addMethod(
  678. "_onCompileError_",
  679. smalltalk.method({
  680. selector: "onCompileError:",
  681. fn: function (anError){
  682. var self=this;
  683. return smalltalk.withContext(function($ctx1) { _st(self)._alert_(_st(anError)._messageText());
  684. return self}, function($ctx1) {$ctx1.fill(self,"onCompileError:",{anError:anError}, smalltalk.HLSourceCodeWidget)})},
  685. messageSends: ["alert:", "messageText"]}),
  686. smalltalk.HLSourceCodeWidget);
  687. smalltalk.addMethod(
  688. "_onInstVarAdded",
  689. smalltalk.method({
  690. selector: "onInstVarAdded",
  691. fn: function (){
  692. var self=this;
  693. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  694. return self}, function($ctx1) {$ctx1.fill(self,"onInstVarAdded",{}, smalltalk.HLSourceCodeWidget)})},
  695. messageSends: ["save:", "contents", "browserModel"]}),
  696. smalltalk.HLSourceCodeWidget);
  697. smalltalk.addMethod(
  698. "_onParseError_",
  699. smalltalk.method({
  700. selector: "onParseError:",
  701. fn: function (anAnnouncement){
  702. var self=this;
  703. var lineIndex,newContents;
  704. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  705. lineIndex=(1);
  706. _st(self)._contents_(_st((smalltalk.String || String))._streamContents_((function(stream){
  707. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._contents())._linesDo_((function(each){
  708. return smalltalk.withContext(function($ctx3) { $1=_st(lineIndex).__eq(_st(anAnnouncement)._line());
  709. if(smalltalk.assert($1)){
  710. $2=stream;
  711. _st($2)._nextPutAll_(_st(each)._copyFrom_to_((1),_st(anAnnouncement)._column()));
  712. _st($2)._nextPutAll_("<- ");
  713. _st($2)._nextPutAll_(_st(anAnnouncement)._message());
  714. _st($2)._nextPutAll_(" ");
  715. $3=_st($2)._nextPutAll_(_st(each)._copyFrom_to_(_st(_st(anAnnouncement)._column()).__plus((1)),_st(each)._size()));
  716. $3;
  717. } else {
  718. _st(stream)._nextPutAll_(each);
  719. };
  720. _st(stream)._nextPutAll_(_st((smalltalk.String || String))._cr());
  721. lineIndex=_st(lineIndex).__plus((1));
  722. return lineIndex;
  723. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  724. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  725. return self}, function($ctx1) {$ctx1.fill(self,"onParseError:",{anAnnouncement:anAnnouncement,lineIndex:lineIndex,newContents:newContents}, smalltalk.HLSourceCodeWidget)})},
  726. messageSends: ["contents:", "streamContents:", "linesDo:", "ifTrue:ifFalse:", "nextPutAll:", "copyFrom:to:", "column", "message", "+", "size", "=", "line", "cr", "contents"]}),
  727. smalltalk.HLSourceCodeWidget);
  728. smalltalk.addMethod(
  729. "_onSaveIt",
  730. smalltalk.method({
  731. selector: "onSaveIt",
  732. fn: function (){
  733. var self=this;
  734. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  735. return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLSourceCodeWidget)})},
  736. messageSends: ["save:", "contents", "browserModel"]}),
  737. smalltalk.HLSourceCodeWidget);
  738. smalltalk.addMethod(
  739. "_onUnknownVariableError_",
  740. smalltalk.method({
  741. selector: "onUnknownVariableError:",
  742. fn: function (anError){
  743. var self=this;
  744. var confirm;
  745. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  746. confirm=_st(self)._confirm_(_st((smalltalk.String || String))._streamContents_((function(stream){
  747. return smalltalk.withContext(function($ctx2) { $1=stream;
  748. _st($1)._nextPutAll_(_st(anError)._messageText());
  749. _st($1)._nextPutAll_(_st((smalltalk.String || String))._cr());
  750. $2=_st($1)._nextPutAll_("Would you like to define an instance variable?");
  751. return $2;
  752. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  753. $3=confirm;
  754. if(! smalltalk.assert($3)){
  755. $4=self;
  756. return $4;
  757. };
  758. _st(_st(self)._browserModel())._addInstVarNamed_(_st(anError)._variableName());
  759. return self}, function($ctx1) {$ctx1.fill(self,"onUnknownVariableError:",{anError:anError,confirm:confirm}, smalltalk.HLSourceCodeWidget)})},
  760. messageSends: ["confirm:", "streamContents:", "nextPutAll:", "messageText", "cr", "ifFalse:", "addInstVarNamed:", "variableName", "browserModel"]}),
  761. smalltalk.HLSourceCodeWidget);
  762. smalltalk.addMethod(
  763. "_saveIt",
  764. smalltalk.method({
  765. selector: "saveIt",
  766. fn: function (){
  767. var self=this;
  768. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._saveSourceCode();
  769. return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLSourceCodeWidget)})},
  770. messageSends: ["saveSourceCode", "browserModel"]}),
  771. smalltalk.HLSourceCodeWidget);
  772. smalltalk.addMethod(
  773. "_canBeOpenAsTab",
  774. smalltalk.method({
  775. selector: "canBeOpenAsTab",
  776. fn: function (){
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) { return false;
  779. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLSourceCodeWidget.klass)})},
  780. messageSends: []}),
  781. smalltalk.HLSourceCodeWidget.klass);
  782. smalltalk.addMethod(
  783. "_on_",
  784. smalltalk.method({
  785. selector: "on:",
  786. fn: function (aBrowserModel){
  787. var self=this;
  788. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  789. $2=_st(self)._new();
  790. _st($2)._browserModel_(aBrowserModel);
  791. $3=_st($2)._yourself();
  792. $1=$3;
  793. return $1;
  794. }, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget.klass)})},
  795. messageSends: ["browserModel:", "new", "yourself"]}),
  796. smalltalk.HLSourceCodeWidget.klass);