Helios-Workspace.deploy.js 32 KB

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