Helios-Workspace.deploy.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875
  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. "_hasFocus",
  249. smalltalk.method({
  250. selector: "hasFocus",
  251. fn: function (){
  252. var self=this;
  253. return smalltalk.withContext(function($ctx1) { var $1;
  254. $1=_st(_st(self["@code"])._asJQuery())._is_(":active");
  255. return $1;
  256. }, function($ctx1) {$ctx1.fill(self,"hasFocus",{}, smalltalk.HLCodeWidget)})},
  257. messageSends: ["is:", "asJQuery"]}),
  258. smalltalk.HLCodeWidget);
  259. smalltalk.addMethod(
  260. "_inspectIt",
  261. smalltalk.method({
  262. selector: "inspectIt",
  263. fn: function (){
  264. var self=this;
  265. var newInspector;
  266. return smalltalk.withContext(function($ctx1) { _st(_st(self)._announcer())._announce_(_st((smalltalk.HLInspectItRequested || HLInspectItRequested))._on_(self["@model"]));
  267. newInspector=_st(self)._makeInspectorOn_(_st(self)._doIt());
  268. _st(newInspector)._open();
  269. return self}, function($ctx1) {$ctx1.fill(self,"inspectIt",{newInspector:newInspector}, smalltalk.HLCodeWidget)})},
  270. messageSends: ["announce:", "on:", "announcer", "makeInspectorOn:", "doIt", "open"]}),
  271. smalltalk.HLCodeWidget);
  272. smalltalk.addMethod(
  273. "_makeInspectorOn_",
  274. smalltalk.method({
  275. selector: "makeInspectorOn:",
  276. fn: function (anObject){
  277. var self=this;
  278. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  279. $2=_st((smalltalk.HLInspector || HLInspector))._new();
  280. _st($2)._inspect_(anObject);
  281. $3=_st($2)._yourself();
  282. $1=$3;
  283. return $1;
  284. }, function($ctx1) {$ctx1.fill(self,"makeInspectorOn:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  285. messageSends: ["inspect:", "new", "yourself"]}),
  286. smalltalk.HLCodeWidget);
  287. smalltalk.addMethod(
  288. "_model",
  289. smalltalk.method({
  290. selector: "model",
  291. fn: function (){
  292. var self=this;
  293. return smalltalk.withContext(function($ctx1) { var $2,$1;
  294. $2=self["@model"];
  295. if(($receiver = $2) == nil || $receiver == undefined){
  296. self["@model"]=_st((smalltalk.HLCodeModel || HLCodeModel))._new();
  297. $1=self["@model"];
  298. } else {
  299. $1=$2;
  300. };
  301. return $1;
  302. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLCodeWidget)})},
  303. messageSends: ["ifNil:", "new"]}),
  304. smalltalk.HLCodeWidget);
  305. smalltalk.addMethod(
  306. "_model_",
  307. smalltalk.method({
  308. selector: "model:",
  309. fn: function (aModel){
  310. var self=this;
  311. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  312. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLCodeWidget)})},
  313. messageSends: []}),
  314. smalltalk.HLCodeWidget);
  315. smalltalk.addMethod(
  316. "_onDoIt",
  317. smalltalk.method({
  318. selector: "onDoIt",
  319. fn: function (){
  320. var self=this;
  321. return smalltalk.withContext(function($ctx1) { _st(self)._doIt();
  322. return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLCodeWidget)})},
  323. messageSends: ["doIt"]}),
  324. smalltalk.HLCodeWidget);
  325. smalltalk.addMethod(
  326. "_onInspectIt",
  327. smalltalk.method({
  328. selector: "onInspectIt",
  329. fn: function (){
  330. var self=this;
  331. return smalltalk.withContext(function($ctx1) { _st(self)._inspectIt();
  332. return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLCodeWidget)})},
  333. messageSends: ["inspectIt"]}),
  334. smalltalk.HLCodeWidget);
  335. smalltalk.addMethod(
  336. "_onPrintIt",
  337. smalltalk.method({
  338. selector: "onPrintIt",
  339. fn: function (){
  340. var self=this;
  341. return smalltalk.withContext(function($ctx1) { _st(self)._printIt();
  342. return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLCodeWidget)})},
  343. messageSends: ["printIt"]}),
  344. smalltalk.HLCodeWidget);
  345. smalltalk.addMethod(
  346. "_onSaveIt",
  347. smalltalk.method({
  348. selector: "onSaveIt",
  349. fn: function (){
  350. var self=this;
  351. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLCodeWidget)})},
  352. messageSends: []}),
  353. smalltalk.HLCodeWidget);
  354. smalltalk.addMethod(
  355. "_print_",
  356. smalltalk.method({
  357. selector: "print:",
  358. fn: function (aString){
  359. var self=this;
  360. var start,stop,currentLine;
  361. return smalltalk.withContext(function($ctx1) { currentLine=_st(_st(self["@editor"])._getCursor_(false))._line();
  362. start=_st((smalltalk.HashedCollection || HashedCollection))._new();
  363. _st(start)._at_put_("line",currentLine);
  364. _st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
  365. _st(_st(self["@editor"])._getSelection())._ifEmpty_((function(){
  366. return smalltalk.withContext(function($ctx2) { _st(start)._at_put_("ch",_st(_st(self["@editor"])._getLine_(currentLine))._size());
  367. return _st(self["@editor"])._setSelection_end_(smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(currentLine),_st("ch").__minus_gt((0))]),start);
  368. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  369. stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
  370. _st(stop)._at_put_("line",currentLine);
  371. _st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
  372. _st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
  373. _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
  374. _st(self["@editor"])._setSelection_end_(stop,start);
  375. return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine}, smalltalk.HLCodeWidget)})},
  376. messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "size", "getLine:", "setSelection:end:", "->", "getSelection", "+", "at:", "replaceSelection:", ",", "setCursor:"]}),
  377. smalltalk.HLCodeWidget);
  378. smalltalk.addMethod(
  379. "_printIt",
  380. smalltalk.method({
  381. selector: "printIt",
  382. fn: function (){
  383. var self=this;
  384. var result;
  385. return smalltalk.withContext(function($ctx1) { result=_st(self)._doIt();
  386. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLPrintItRequested || HLPrintItRequested))._on_(self["@model"]));
  387. _st(self)._print_(_st(result)._printString());
  388. _st(self)._focus();
  389. return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result}, smalltalk.HLCodeWidget)})},
  390. messageSends: ["doIt", "announce:", "on:", "announcer", "print:", "printString", "focus"]}),
  391. smalltalk.HLCodeWidget);
  392. smalltalk.addMethod(
  393. "_receiver",
  394. smalltalk.method({
  395. selector: "receiver",
  396. fn: function (){
  397. var self=this;
  398. return smalltalk.withContext(function($ctx1) { var $1;
  399. $1=_st(_st(self)._model())._receiver();
  400. return $1;
  401. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeWidget)})},
  402. messageSends: ["receiver", "model"]}),
  403. smalltalk.HLCodeWidget);
  404. smalltalk.addMethod(
  405. "_receiver_",
  406. smalltalk.method({
  407. selector: "receiver:",
  408. fn: function (anObject){
  409. var self=this;
  410. return smalltalk.withContext(function($ctx1) { _st(_st(self)._model())._receiver_(anObject);
  411. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  412. messageSends: ["receiver:", "model"]}),
  413. smalltalk.HLCodeWidget);
  414. smalltalk.addMethod(
  415. "_renderContentOn_",
  416. smalltalk.method({
  417. selector: "renderContentOn:",
  418. fn: function (html){
  419. var self=this;
  420. return smalltalk.withContext(function($ctx1) { self["@code"]=_st(html)._textarea();
  421. _st(self)._setEditorOn_(_st(self["@code"])._element());
  422. _st(self)._configureEditor();
  423. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLCodeWidget)})},
  424. messageSends: ["textarea", "setEditorOn:", "element", "configureEditor"]}),
  425. smalltalk.HLCodeWidget);
  426. smalltalk.addMethod(
  427. "_saveIt",
  428. smalltalk.method({
  429. selector: "saveIt",
  430. fn: function (){
  431. var self=this;
  432. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLCodeWidget)})},
  433. messageSends: []}),
  434. smalltalk.HLCodeWidget);
  435. smalltalk.addMethod(
  436. "_selection",
  437. smalltalk.method({
  438. selector: "selection",
  439. fn: function (){
  440. var self=this;
  441. return smalltalk.withContext(function($ctx1) { var $1;
  442. $1=_st(self["@editor"])._getSelection();
  443. return $1;
  444. }, function($ctx1) {$ctx1.fill(self,"selection",{}, smalltalk.HLCodeWidget)})},
  445. messageSends: ["getSelection"]}),
  446. smalltalk.HLCodeWidget);
  447. smalltalk.addMethod(
  448. "_selectionEnd",
  449. smalltalk.method({
  450. selector: "selectionEnd",
  451. fn: function (){
  452. var self=this;
  453. return smalltalk.withContext(function($ctx1) { var $1;
  454. $1=_st(_st(self["@code"])._element())._selectionEnd();
  455. return $1;
  456. }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{}, smalltalk.HLCodeWidget)})},
  457. messageSends: ["selectionEnd", "element"]}),
  458. smalltalk.HLCodeWidget);
  459. smalltalk.addMethod(
  460. "_selectionEnd_",
  461. smalltalk.method({
  462. selector: "selectionEnd:",
  463. fn: function (anInteger){
  464. var self=this;
  465. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionEnd_(anInteger);
  466. return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  467. messageSends: ["selectionEnd:", "element"]}),
  468. smalltalk.HLCodeWidget);
  469. smalltalk.addMethod(
  470. "_selectionStart",
  471. smalltalk.method({
  472. selector: "selectionStart",
  473. fn: function (){
  474. var self=this;
  475. return smalltalk.withContext(function($ctx1) { var $1;
  476. $1=_st(_st(self["@code"])._element())._selectionStart();
  477. return $1;
  478. }, function($ctx1) {$ctx1.fill(self,"selectionStart",{}, smalltalk.HLCodeWidget)})},
  479. messageSends: ["selectionStart", "element"]}),
  480. smalltalk.HLCodeWidget);
  481. smalltalk.addMethod(
  482. "_selectionStart_",
  483. smalltalk.method({
  484. selector: "selectionStart:",
  485. fn: function (anInteger){
  486. var self=this;
  487. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionStart_(anInteger);
  488. return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  489. messageSends: ["selectionStart:", "element"]}),
  490. smalltalk.HLCodeWidget);
  491. smalltalk.addMethod(
  492. "_setEditorOn_",
  493. smalltalk.method({
  494. selector: "setEditorOn:",
  495. fn: function (aTextarea){
  496. var self=this;
  497. return smalltalk.withContext(function($ctx1) { self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  498. theme: 'amber',
  499. lineNumbers: true,
  500. enterMode: 'flat',
  501. indentWithTabs: true,
  502. indentUnit: 4,
  503. matchBrackets: true,
  504. electricChars: false,
  505. keyMap: 'Amber'
  506. });
  507. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea}, smalltalk.HLCodeWidget)})},
  508. messageSends: []}),
  509. smalltalk.HLCodeWidget);
  510. smalltalk.addMethod(
  511. "_canBeOpenAsTab",
  512. smalltalk.method({
  513. selector: "canBeOpenAsTab",
  514. fn: function (){
  515. var self=this;
  516. return smalltalk.withContext(function($ctx1) { return true;
  517. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLCodeWidget.klass)})},
  518. messageSends: []}),
  519. smalltalk.HLCodeWidget.klass);
  520. smalltalk.addMethod(
  521. "_initialize",
  522. smalltalk.method({
  523. selector: "initialize",
  524. fn: function (){
  525. var self=this;
  526. return smalltalk.withContext(function($ctx1) { var $1,$2;
  527. smalltalk.HLWidget.klass.fn.prototype._initialize.apply(_st(self), []);
  528. $1=self;
  529. _st($1)._setupCodeMirror();
  530. _st($1)._setupCommands();
  531. $2=_st($1)._setupKeyMaps();
  532. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLCodeWidget.klass)})},
  533. messageSends: ["initialize", "setupCodeMirror", "setupCommands", "setupKeyMaps"]}),
  534. smalltalk.HLCodeWidget.klass);
  535. smalltalk.addMethod(
  536. "_keyMap",
  537. smalltalk.method({
  538. selector: "keyMap",
  539. fn: function (){
  540. var self=this;
  541. return smalltalk.withContext(function($ctx1) { var $2,$1;
  542. $2=_st(_st(_st((smalltalk.HLManager || HLManager))._current())._keyBinder())._systemIsMac();
  543. if(smalltalk.assert($2)){
  544. $1=_st(self)._macKeyMap();
  545. } else {
  546. $1=_st(self)._pcKeyMap();
  547. };
  548. return $1;
  549. }, function($ctx1) {$ctx1.fill(self,"keyMap",{}, smalltalk.HLCodeWidget.klass)})},
  550. messageSends: ["ifTrue:ifFalse:", "macKeyMap", "pcKeyMap", "systemIsMac", "keyBinder", "current"]}),
  551. smalltalk.HLCodeWidget.klass);
  552. smalltalk.addMethod(
  553. "_macKeyMap",
  554. smalltalk.method({
  555. selector: "macKeyMap",
  556. fn: function (){
  557. var self=this;
  558. return smalltalk.withContext(function($ctx1) { var $1;
  559. $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"])]);
  560. return $1;
  561. }, function($ctx1) {$ctx1.fill(self,"macKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  562. messageSends: ["->"]}),
  563. smalltalk.HLCodeWidget.klass);
  564. smalltalk.addMethod(
  565. "_pcKeyMap",
  566. smalltalk.method({
  567. selector: "pcKeyMap",
  568. fn: function (){
  569. var self=this;
  570. return smalltalk.withContext(function($ctx1) { var $1;
  571. $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"])];
  572. return $1;
  573. }, function($ctx1) {$ctx1.fill(self,"pcKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  574. messageSends: ["->"]}),
  575. smalltalk.HLCodeWidget.klass);
  576. smalltalk.addMethod(
  577. "_setupCodeMirror",
  578. smalltalk.method({
  579. selector: "setupCodeMirror",
  580. fn: function (){
  581. var self=this;
  582. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap.default.fallthrough = ["basic"] ;
  583. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{}, smalltalk.HLCodeWidget.klass)})},
  584. messageSends: []}),
  585. smalltalk.HLCodeWidget.klass);
  586. smalltalk.addMethod(
  587. "_setupCommands",
  588. smalltalk.method({
  589. selector: "setupCommands",
  590. fn: function (){
  591. var self=this;
  592. return smalltalk.withContext(function($ctx1) { var $1,$2;
  593. $1=_st((smalltalk.CodeMirror || CodeMirror))._basicAt_("commands");
  594. _st($1)._at_put_("doIt",(function(cm){
  595. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._doIt();
  596. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  597. _st($1)._at_put_("inspectIt",(function(cm){
  598. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._inspectIt();
  599. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  600. _st($1)._at_put_("printIt",(function(cm){
  601. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._printIt();
  602. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  603. $2=_st($1)._at_put_("saveIt",(function(cm){
  604. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._saveIt();
  605. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  606. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{}, smalltalk.HLCodeWidget.klass)})},
  607. messageSends: ["at:put:", "doIt", "amberCodeWidget", "basicAt:", "inspectIt", "printIt", "saveIt"]}),
  608. smalltalk.HLCodeWidget.klass);
  609. smalltalk.addMethod(
  610. "_setupKeyMaps",
  611. smalltalk.method({
  612. selector: "setupKeyMaps",
  613. fn: function (){
  614. var self=this;
  615. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap['Amber'] = self._keyMap();
  616. return self}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{}, smalltalk.HLCodeWidget.klass)})},
  617. messageSends: []}),
  618. smalltalk.HLCodeWidget.klass);
  619. smalltalk.addMethod(
  620. "_tabLabel",
  621. smalltalk.method({
  622. selector: "tabLabel",
  623. fn: function (){
  624. var self=this;
  625. return smalltalk.withContext(function($ctx1) { return "Workspace";
  626. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLCodeWidget.klass)})},
  627. messageSends: []}),
  628. smalltalk.HLCodeWidget.klass);
  629. smalltalk.addMethod(
  630. "_tabPriority",
  631. smalltalk.method({
  632. selector: "tabPriority",
  633. fn: function (){
  634. var self=this;
  635. return smalltalk.withContext(function($ctx1) { return (10);
  636. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLCodeWidget.klass)})},
  637. messageSends: []}),
  638. smalltalk.HLCodeWidget.klass);
  639. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, ['browserModel'], 'Helios-Workspace');
  640. smalltalk.addMethod(
  641. "_browserModel",
  642. smalltalk.method({
  643. selector: "browserModel",
  644. fn: function (){
  645. var self=this;
  646. return smalltalk.withContext(function($ctx1) { var $1;
  647. $1=self["@browserModel"];
  648. return $1;
  649. }, function($ctx1) {$ctx1.fill(self,"browserModel",{}, smalltalk.HLSourceCodeWidget)})},
  650. messageSends: []}),
  651. smalltalk.HLSourceCodeWidget);
  652. smalltalk.addMethod(
  653. "_browserModel_",
  654. smalltalk.method({
  655. selector: "browserModel:",
  656. fn: function (aBrowserModel){
  657. var self=this;
  658. return smalltalk.withContext(function($ctx1) { self["@browserModel"]=aBrowserModel;
  659. _st(self)._observeBrowserModel();
  660. return self}, function($ctx1) {$ctx1.fill(self,"browserModel:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget)})},
  661. messageSends: ["observeBrowserModel"]}),
  662. smalltalk.HLSourceCodeWidget);
  663. smalltalk.addMethod(
  664. "_observeBrowserModel",
  665. smalltalk.method({
  666. selector: "observeBrowserModel",
  667. fn: function (){
  668. var self=this;
  669. return smalltalk.withContext(function($ctx1) { var $1,$2;
  670. $1=_st(_st(self)._browserModel())._announcer();
  671. _st($1)._on_do_((smalltalk.HLSaveSourceCode || HLSaveSourceCode),(function(ann){
  672. return smalltalk.withContext(function($ctx2) { return _st(self)._onSaveIt();
  673. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  674. _st($1)._on_do_((smalltalk.HLParseErrorRaised || HLParseErrorRaised),(function(ann){
  675. return smalltalk.withContext(function($ctx2) { return _st(self)._onParseError_(ann);
  676. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  677. _st($1)._on_do_((smalltalk.HLCompileErrorRaised || HLCompileErrorRaised),(function(ann){
  678. return smalltalk.withContext(function($ctx2) { return _st(self)._onCompileError_(_st(ann)._error());
  679. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  680. _st($1)._on_do_((smalltalk.HLUnknownVariableErrorRaised || HLUnknownVariableErrorRaised),(function(ann){
  681. return smalltalk.withContext(function($ctx2) { return _st(self)._onUnknownVariableError_(_st(ann)._error());
  682. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  683. $2=_st($1)._on_do_((smalltalk.HLInstVarAdded || HLInstVarAdded),(function(ann){
  684. return smalltalk.withContext(function($ctx2) { return _st(self)._onInstVarAdded();
  685. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  686. return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{}, smalltalk.HLSourceCodeWidget)})},
  687. messageSends: ["on:do:", "onSaveIt", "announcer", "browserModel", "onParseError:", "onCompileError:", "error", "onUnknownVariableError:", "onInstVarAdded"]}),
  688. smalltalk.HLSourceCodeWidget);
  689. smalltalk.addMethod(
  690. "_onCompileError_",
  691. smalltalk.method({
  692. selector: "onCompileError:",
  693. fn: function (anError){
  694. var self=this;
  695. return smalltalk.withContext(function($ctx1) { _st(self)._alert_(_st(anError)._messageText());
  696. return self}, function($ctx1) {$ctx1.fill(self,"onCompileError:",{anError:anError}, smalltalk.HLSourceCodeWidget)})},
  697. messageSends: ["alert:", "messageText"]}),
  698. smalltalk.HLSourceCodeWidget);
  699. smalltalk.addMethod(
  700. "_onInstVarAdded",
  701. smalltalk.method({
  702. selector: "onInstVarAdded",
  703. fn: function (){
  704. var self=this;
  705. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  706. return self}, function($ctx1) {$ctx1.fill(self,"onInstVarAdded",{}, smalltalk.HLSourceCodeWidget)})},
  707. messageSends: ["save:", "contents", "browserModel"]}),
  708. smalltalk.HLSourceCodeWidget);
  709. smalltalk.addMethod(
  710. "_onParseError_",
  711. smalltalk.method({
  712. selector: "onParseError:",
  713. fn: function (anAnnouncement){
  714. var self=this;
  715. var lineIndex,newContents;
  716. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  717. lineIndex=(1);
  718. _st(self)._contents_(_st((smalltalk.String || String))._streamContents_((function(stream){
  719. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._contents())._linesDo_((function(each){
  720. return smalltalk.withContext(function($ctx3) { $1=_st(lineIndex).__eq(_st(anAnnouncement)._line());
  721. if(smalltalk.assert($1)){
  722. $2=stream;
  723. _st($2)._nextPutAll_(_st(each)._copyFrom_to_((1),_st(anAnnouncement)._column()));
  724. _st($2)._nextPutAll_("<- ");
  725. _st($2)._nextPutAll_(_st(anAnnouncement)._message());
  726. _st($2)._nextPutAll_(" ");
  727. $3=_st($2)._nextPutAll_(_st(each)._copyFrom_to_(_st(_st(anAnnouncement)._column()).__plus((1)),_st(each)._size()));
  728. $3;
  729. } else {
  730. _st(stream)._nextPutAll_(each);
  731. };
  732. _st(stream)._nextPutAll_(_st((smalltalk.String || String))._cr());
  733. lineIndex=_st(lineIndex).__plus((1));
  734. return lineIndex;
  735. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  736. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  737. return self}, function($ctx1) {$ctx1.fill(self,"onParseError:",{anAnnouncement:anAnnouncement,lineIndex:lineIndex,newContents:newContents}, smalltalk.HLSourceCodeWidget)})},
  738. messageSends: ["contents:", "streamContents:", "linesDo:", "ifTrue:ifFalse:", "nextPutAll:", "copyFrom:to:", "column", "message", "+", "size", "=", "line", "cr", "contents"]}),
  739. smalltalk.HLSourceCodeWidget);
  740. smalltalk.addMethod(
  741. "_onSaveIt",
  742. smalltalk.method({
  743. selector: "onSaveIt",
  744. fn: function (){
  745. var self=this;
  746. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  747. return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLSourceCodeWidget)})},
  748. messageSends: ["save:", "contents", "browserModel"]}),
  749. smalltalk.HLSourceCodeWidget);
  750. smalltalk.addMethod(
  751. "_onUnknownVariableError_",
  752. smalltalk.method({
  753. selector: "onUnknownVariableError:",
  754. fn: function (anError){
  755. var self=this;
  756. var confirm;
  757. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  758. confirm=_st(self)._confirm_(_st((smalltalk.String || String))._streamContents_((function(stream){
  759. return smalltalk.withContext(function($ctx2) { $1=stream;
  760. _st($1)._nextPutAll_(_st(anError)._messageText());
  761. _st($1)._nextPutAll_(_st((smalltalk.String || String))._cr());
  762. $2=_st($1)._nextPutAll_("Would you like to define an instance variable?");
  763. return $2;
  764. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  765. $3=confirm;
  766. if(! smalltalk.assert($3)){
  767. $4=self;
  768. return $4;
  769. };
  770. _st(_st(self)._browserModel())._addInstVarNamed_(_st(anError)._variableName());
  771. return self}, function($ctx1) {$ctx1.fill(self,"onUnknownVariableError:",{anError:anError,confirm:confirm}, smalltalk.HLSourceCodeWidget)})},
  772. messageSends: ["confirm:", "streamContents:", "nextPutAll:", "messageText", "cr", "ifFalse:", "addInstVarNamed:", "variableName", "browserModel"]}),
  773. smalltalk.HLSourceCodeWidget);
  774. smalltalk.addMethod(
  775. "_saveIt",
  776. smalltalk.method({
  777. selector: "saveIt",
  778. fn: function (){
  779. var self=this;
  780. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._saveSourceCode();
  781. return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLSourceCodeWidget)})},
  782. messageSends: ["saveSourceCode", "browserModel"]}),
  783. smalltalk.HLSourceCodeWidget);
  784. smalltalk.addMethod(
  785. "_canBeOpenAsTab",
  786. smalltalk.method({
  787. selector: "canBeOpenAsTab",
  788. fn: function (){
  789. var self=this;
  790. return smalltalk.withContext(function($ctx1) { return false;
  791. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLSourceCodeWidget.klass)})},
  792. messageSends: []}),
  793. smalltalk.HLSourceCodeWidget.klass);
  794. smalltalk.addMethod(
  795. "_on_",
  796. smalltalk.method({
  797. selector: "on:",
  798. fn: function (aBrowserModel){
  799. var self=this;
  800. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  801. $2=_st(self)._new();
  802. _st($2)._browserModel_(aBrowserModel);
  803. $3=_st($2)._yourself();
  804. $1=$3;
  805. return $1;
  806. }, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget.klass)})},
  807. messageSends: ["browserModel:", "new", "yourself"]}),
  808. smalltalk.HLSourceCodeWidget.klass);