Helios-Workspace.js 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196
  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. category: 'accessing',
  8. fn: function (){
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) { var $2,$1;
  11. $2=self["@announcer"];
  12. if(($receiver = $2) == nil || $receiver == undefined){
  13. self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
  14. $1=self["@announcer"];
  15. } else {
  16. $1=$2;
  17. };
  18. return $1;
  19. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLCodeModel)})},
  20. args: [],
  21. source: "announcer\x0a\x09^ announcer ifNil: [ announcer := Announcer new ]",
  22. messageSends: ["ifNil:", "new"],
  23. referencedClasses: ["Announcer"]
  24. }),
  25. smalltalk.HLCodeModel);
  26. smalltalk.addMethod(
  27. "_defaultReceiver",
  28. smalltalk.method({
  29. selector: "defaultReceiver",
  30. category: 'defaults',
  31. fn: function (){
  32. var self=this;
  33. return smalltalk.withContext(function($ctx1) { var $1;
  34. $1=_st((smalltalk.DoIt || DoIt))._new();
  35. return $1;
  36. }, function($ctx1) {$ctx1.fill(self,"defaultReceiver",{}, smalltalk.HLCodeModel)})},
  37. args: [],
  38. source: "defaultReceiver\x0a\x09^ DoIt new",
  39. messageSends: ["new"],
  40. referencedClasses: ["DoIt"]
  41. }),
  42. smalltalk.HLCodeModel);
  43. smalltalk.addMethod(
  44. "_doIt_",
  45. smalltalk.method({
  46. selector: "doIt:",
  47. category: 'actions',
  48. fn: function (someCode){
  49. var self=this;
  50. return smalltalk.withContext(function($ctx1) { var $1;
  51. $1=_st(_st(self)._environment())._eval_on_(someCode,_st(self)._receiver());
  52. return $1;
  53. }, function($ctx1) {$ctx1.fill(self,"doIt:",{someCode:someCode}, smalltalk.HLCodeModel)})},
  54. args: ["someCode"],
  55. source: "doIt: someCode\x0a\x0a\x09^ self environment eval: someCode on: self receiver",
  56. messageSends: ["eval:on:", "receiver", "environment"],
  57. referencedClasses: []
  58. }),
  59. smalltalk.HLCodeModel);
  60. smalltalk.addMethod(
  61. "_environment",
  62. smalltalk.method({
  63. selector: "environment",
  64. category: 'accessing',
  65. fn: function (){
  66. var self=this;
  67. return smalltalk.withContext(function($ctx1) { var $2,$1;
  68. $2=self["@environment"];
  69. if(($receiver = $2) == nil || $receiver == undefined){
  70. $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
  71. } else {
  72. $1=$2;
  73. };
  74. return $1;
  75. }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLCodeModel)})},
  76. args: [],
  77. source: "environment\x0a\x09^ environment ifNil: [ HLManager current environment ]",
  78. messageSends: ["ifNil:", "environment", "current"],
  79. referencedClasses: ["HLManager"]
  80. }),
  81. smalltalk.HLCodeModel);
  82. smalltalk.addMethod(
  83. "_environment_",
  84. smalltalk.method({
  85. selector: "environment:",
  86. category: 'accessing',
  87. fn: function (anEnvironment){
  88. var self=this;
  89. return smalltalk.withContext(function($ctx1) { self["@environment"]=anEnvironment;
  90. return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLCodeModel)})},
  91. args: ["anEnvironment"],
  92. source: "environment: anEnvironment\x0a\x09environment := anEnvironment",
  93. messageSends: [],
  94. referencedClasses: []
  95. }),
  96. smalltalk.HLCodeModel);
  97. smalltalk.addMethod(
  98. "_receiver",
  99. smalltalk.method({
  100. selector: "receiver",
  101. category: 'accessing',
  102. fn: function (){
  103. var self=this;
  104. return smalltalk.withContext(function($ctx1) { var $2,$1;
  105. $2=self["@receiver"];
  106. if(($receiver = $2) == nil || $receiver == undefined){
  107. self["@receiver"]=_st(self)._defaultReceiver();
  108. $1=self["@receiver"];
  109. } else {
  110. $1=$2;
  111. };
  112. return $1;
  113. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeModel)})},
  114. args: [],
  115. source: "receiver\x0a\x09^ receiver ifNil: [ receiver := self defaultReceiver ]",
  116. messageSends: ["ifNil:", "defaultReceiver"],
  117. referencedClasses: []
  118. }),
  119. smalltalk.HLCodeModel);
  120. smalltalk.addMethod(
  121. "_receiver_",
  122. smalltalk.method({
  123. selector: "receiver:",
  124. category: 'accessing',
  125. fn: function (anObject){
  126. var self=this;
  127. return smalltalk.withContext(function($ctx1) { self["@receiver"]=anObject;
  128. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeModel)})},
  129. args: ["anObject"],
  130. source: "receiver: anObject\x0a\x09receiver := anObject",
  131. messageSends: [],
  132. referencedClasses: []
  133. }),
  134. smalltalk.HLCodeModel);
  135. smalltalk.addMethod(
  136. "_subscribe_",
  137. smalltalk.method({
  138. selector: "subscribe:",
  139. category: 'actions',
  140. fn: function (aWidget){
  141. var self=this;
  142. return smalltalk.withContext(function($ctx1) { _st(aWidget)._subscribeTo_(_st(self)._announcer());
  143. return self}, function($ctx1) {$ctx1.fill(self,"subscribe:",{aWidget:aWidget}, smalltalk.HLCodeModel)})},
  144. args: ["aWidget"],
  145. source: "subscribe: aWidget\x0a\x09aWidget subscribeTo: self announcer",
  146. messageSends: ["subscribeTo:", "announcer"],
  147. referencedClasses: []
  148. }),
  149. smalltalk.HLCodeModel);
  150. smalltalk.addMethod(
  151. "_on_",
  152. smalltalk.method({
  153. selector: "on:",
  154. category: 'actions',
  155. fn: function (anEnvironment){
  156. var self=this;
  157. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  158. $2=_st(self)._new();
  159. _st($2)._environment_(anEnvironment);
  160. $3=_st($2)._yourself();
  161. $1=$3;
  162. return $1;
  163. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLCodeModel.klass)})},
  164. args: ["anEnvironment"],
  165. source: "on: anEnvironment\x0a\x0a\x09^ self new\x0a \x09environment: anEnvironment;\x0a yourself",
  166. messageSends: ["environment:", "new", "yourself"],
  167. referencedClasses: []
  168. }),
  169. smalltalk.HLCodeModel.klass);
  170. smalltalk.addClass('HLCodeWidget', smalltalk.HLWidget, ['model', 'wrapper', 'code', 'editor'], 'Helios-Workspace');
  171. smalltalk.addMethod(
  172. "_announcer",
  173. smalltalk.method({
  174. selector: "announcer",
  175. category: 'accessing',
  176. fn: function (){
  177. var self=this;
  178. return smalltalk.withContext(function($ctx1) { var $1;
  179. $1=_st(_st(self)._model())._announcer();
  180. return $1;
  181. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLCodeWidget)})},
  182. args: [],
  183. source: "announcer\x0a\x09^ self model announcer",
  184. messageSends: ["announcer", "model"],
  185. referencedClasses: []
  186. }),
  187. smalltalk.HLCodeWidget);
  188. smalltalk.addMethod(
  189. "_canHaveFocus",
  190. smalltalk.method({
  191. selector: "canHaveFocus",
  192. category: 'testing',
  193. fn: function (){
  194. var self=this;
  195. return smalltalk.withContext(function($ctx1) { return true;
  196. }, function($ctx1) {$ctx1.fill(self,"canHaveFocus",{},smalltalk.HLCodeWidget)})},
  197. args: [],
  198. source: "canHaveFocus\x0a\x09^ true",
  199. messageSends: [],
  200. referencedClasses: []
  201. }),
  202. smalltalk.HLCodeWidget);
  203. smalltalk.addMethod(
  204. "_clear",
  205. smalltalk.method({
  206. selector: "clear",
  207. category: 'actions',
  208. fn: function (){
  209. var self=this;
  210. return smalltalk.withContext(function($ctx1) { _st(self)._contents_("");
  211. return self}, function($ctx1) {$ctx1.fill(self,"clear",{}, smalltalk.HLCodeWidget)})},
  212. args: [],
  213. source: "clear\x0a self contents: ''",
  214. messageSends: ["contents:"],
  215. referencedClasses: []
  216. }),
  217. smalltalk.HLCodeWidget);
  218. smalltalk.addMethod(
  219. "_configureEditor",
  220. smalltalk.method({
  221. selector: "configureEditor",
  222. category: 'actions',
  223. fn: function (){
  224. var self=this;
  225. return smalltalk.withContext(function($ctx1) { _st(_st(self)._editor())._at_put_("amberCodeWidget",self);
  226. return self}, function($ctx1) {$ctx1.fill(self,"configureEditor",{}, smalltalk.HLCodeWidget)})},
  227. args: [],
  228. source: "configureEditor\x0a\x09self editor at: 'amberCodeWidget' put: self",
  229. messageSends: ["at:put:", "editor"],
  230. referencedClasses: []
  231. }),
  232. smalltalk.HLCodeWidget);
  233. smalltalk.addMethod(
  234. "_contents",
  235. smalltalk.method({
  236. selector: "contents",
  237. category: 'accessing',
  238. fn: function (){
  239. var self=this;
  240. return smalltalk.withContext(function($ctx1) { var $1;
  241. $1=_st(self["@editor"])._getValue();
  242. return $1;
  243. }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.HLCodeWidget)})},
  244. args: [],
  245. source: "contents\x0a\x09^ editor getValue",
  246. messageSends: ["getValue"],
  247. referencedClasses: []
  248. }),
  249. smalltalk.HLCodeWidget);
  250. smalltalk.addMethod(
  251. "_contents_",
  252. smalltalk.method({
  253. selector: "contents:",
  254. category: 'accessing',
  255. fn: function (aString){
  256. var self=this;
  257. return smalltalk.withContext(function($ctx1) { _st(self["@editor"])._setValue_(aString);
  258. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString}, smalltalk.HLCodeWidget)})},
  259. args: ["aString"],
  260. source: "contents: aString\x0a\x09editor setValue: aString",
  261. messageSends: ["setValue:"],
  262. referencedClasses: []
  263. }),
  264. smalltalk.HLCodeWidget);
  265. smalltalk.addMethod(
  266. "_currentLine",
  267. smalltalk.method({
  268. selector: "currentLine",
  269. category: 'accessing',
  270. fn: function (){
  271. var self=this;
  272. return smalltalk.withContext(function($ctx1) { var $1;
  273. $1=_st(self["@editor"])._getLine_(_st(_st(self["@editor"])._getCursor())._line());
  274. return $1;
  275. }, function($ctx1) {$ctx1.fill(self,"currentLine",{}, smalltalk.HLCodeWidget)})},
  276. args: [],
  277. source: "currentLine\x0a ^editor getLine: (editor getCursor line)",
  278. messageSends: ["getLine:", "line", "getCursor"],
  279. referencedClasses: []
  280. }),
  281. smalltalk.HLCodeWidget);
  282. smalltalk.addMethod(
  283. "_currentLineOrSelection",
  284. smalltalk.method({
  285. selector: "currentLineOrSelection",
  286. category: 'accessing',
  287. fn: function (){
  288. var self=this;
  289. return smalltalk.withContext(function($ctx1) { var $2,$1;
  290. $2=_st(self["@editor"])._somethingSelected();
  291. if(smalltalk.assert($2)){
  292. $1=_st(self)._selection();
  293. } else {
  294. $1=_st(self)._currentLine();
  295. };
  296. return $1;
  297. }, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{}, smalltalk.HLCodeWidget)})},
  298. args: [],
  299. source: "currentLineOrSelection\x0a ^editor somethingSelected\x0a\x09\x09ifFalse: [ self currentLine ]\x0a\x09\x09ifTrue: [ self selection ]",
  300. messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"],
  301. referencedClasses: []
  302. }),
  303. smalltalk.HLCodeWidget);
  304. smalltalk.addMethod(
  305. "_doIt",
  306. smalltalk.method({
  307. selector: "doIt",
  308. category: 'actions',
  309. fn: function (){
  310. var self=this;
  311. var result;
  312. return smalltalk.withContext(function($ctx1) { var $1;
  313. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItRequested || HLDoItRequested))._on_(self["@model"]));
  314. result=_st(self["@model"])._doIt_(_st(self)._currentLineOrSelection());
  315. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItExecuted || HLDoItExecuted))._on_(self["@model"]));
  316. $1=result;
  317. return $1;
  318. }, function($ctx1) {$ctx1.fill(self,"doIt",{result:result}, smalltalk.HLCodeWidget)})},
  319. args: [],
  320. source: "doIt\x0a\x09| result |\x0a\x0a\x09self announcer announce: (HLDoItRequested on: model).\x0a\x0a\x09result:= model doIt: self currentLineOrSelection.\x0a\x0a\x09self announcer announce: (HLDoItExecuted on: model).\x0a\x0a\x09^ result ",
  321. messageSends: ["announce:", "on:", "announcer", "doIt:", "currentLineOrSelection"],
  322. referencedClasses: ["HLDoItRequested", "HLDoItExecuted"]
  323. }),
  324. smalltalk.HLCodeWidget);
  325. smalltalk.addMethod(
  326. "_editor",
  327. smalltalk.method({
  328. selector: "editor",
  329. category: 'actions',
  330. fn: function (){
  331. var self=this;
  332. return smalltalk.withContext(function($ctx1) { var $1;
  333. $1=self["@editor"];
  334. return $1;
  335. }, function($ctx1) {$ctx1.fill(self,"editor",{}, smalltalk.HLCodeWidget)})},
  336. args: [],
  337. source: "editor\x0a\x09^editor",
  338. messageSends: [],
  339. referencedClasses: []
  340. }),
  341. smalltalk.HLCodeWidget);
  342. smalltalk.addMethod(
  343. "_focus",
  344. smalltalk.method({
  345. selector: "focus",
  346. category: 'actions',
  347. fn: function (){
  348. var self=this;
  349. return smalltalk.withContext(function($ctx1) { _st(self["@editor"])._focus();
  350. return self}, function($ctx1) {$ctx1.fill(self,"focus",{}, smalltalk.HLCodeWidget)})},
  351. args: [],
  352. source: "focus\x0a\x09editor focus",
  353. messageSends: ["focus"],
  354. referencedClasses: []
  355. }),
  356. smalltalk.HLCodeWidget);
  357. smalltalk.addMethod(
  358. "_hasFocus",
  359. smalltalk.method({
  360. selector: "hasFocus",
  361. category: 'testing',
  362. fn: function (){
  363. var self=this;
  364. return smalltalk.withContext(function($ctx1) { var $1;
  365. $1=_st(_st(self["@code"])._asJQuery())._is_(":active");
  366. return $1;
  367. }, function($ctx1) {$ctx1.fill(self,"hasFocus",{}, smalltalk.HLCodeWidget)})},
  368. args: [],
  369. source: "hasFocus\x0a\x09^ code asJQuery is: ':active'",
  370. messageSends: ["is:", "asJQuery"],
  371. referencedClasses: []
  372. }),
  373. smalltalk.HLCodeWidget);
  374. smalltalk.addMethod(
  375. "_inspectIt",
  376. smalltalk.method({
  377. selector: "inspectIt",
  378. category: 'actions',
  379. fn: function (){
  380. var self=this;
  381. var newInspector;
  382. return smalltalk.withContext(function($ctx1) { _st(_st(self)._announcer())._announce_(_st((smalltalk.HLInspectItRequested || HLInspectItRequested))._on_(self["@model"]));
  383. newInspector=_st(self)._makeInspectorOn_(_st(self)._doIt());
  384. _st(newInspector)._open();
  385. return self}, function($ctx1) {$ctx1.fill(self,"inspectIt",{newInspector:newInspector}, smalltalk.HLCodeWidget)})},
  386. args: [],
  387. source: "inspectIt\x0a\x09| newInspector |\x0a \x0a\x09self announcer announce: (HLInspectItRequested on: model).\x0a\x09newInspector := self makeInspectorOn: self doIt.\x0a\x09newInspector open",
  388. messageSends: ["announce:", "on:", "announcer", "makeInspectorOn:", "doIt", "open"],
  389. referencedClasses: ["HLInspectItRequested"]
  390. }),
  391. smalltalk.HLCodeWidget);
  392. smalltalk.addMethod(
  393. "_makeInspectorOn_",
  394. smalltalk.method({
  395. selector: "makeInspectorOn:",
  396. category: 'actions',
  397. fn: function (anObject){
  398. var self=this;
  399. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  400. $2=_st((smalltalk.HLInspector || HLInspector))._new();
  401. _st($2)._inspect_(anObject);
  402. $3=_st($2)._yourself();
  403. $1=$3;
  404. return $1;
  405. }, function($ctx1) {$ctx1.fill(self,"makeInspectorOn:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  406. args: ["anObject"],
  407. source: "makeInspectorOn: anObject\x0a\x0a\x09^ HLInspector new \x0a\x09\x09inspect: anObject;\x0a\x09\x09yourself",
  408. messageSends: ["inspect:", "new", "yourself"],
  409. referencedClasses: ["HLInspector"]
  410. }),
  411. smalltalk.HLCodeWidget);
  412. smalltalk.addMethod(
  413. "_model",
  414. smalltalk.method({
  415. selector: "model",
  416. category: 'accessing',
  417. fn: function (){
  418. var self=this;
  419. return smalltalk.withContext(function($ctx1) { var $2,$1;
  420. $2=self["@model"];
  421. if(($receiver = $2) == nil || $receiver == undefined){
  422. self["@model"]=_st((smalltalk.HLCodeModel || HLCodeModel))._new();
  423. $1=self["@model"];
  424. } else {
  425. $1=$2;
  426. };
  427. return $1;
  428. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLCodeWidget)})},
  429. args: [],
  430. source: "model\x0a\x09^ model ifNil: [ model := HLCodeModel new ]",
  431. messageSends: ["ifNil:", "new"],
  432. referencedClasses: ["HLCodeModel"]
  433. }),
  434. smalltalk.HLCodeWidget);
  435. smalltalk.addMethod(
  436. "_model_",
  437. smalltalk.method({
  438. selector: "model:",
  439. category: 'accessing',
  440. fn: function (aModel){
  441. var self=this;
  442. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  443. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLCodeWidget)})},
  444. args: ["aModel"],
  445. source: "model: aModel\x0a\x09model := aModel",
  446. messageSends: [],
  447. referencedClasses: []
  448. }),
  449. smalltalk.HLCodeWidget);
  450. smalltalk.addMethod(
  451. "_onDoIt",
  452. smalltalk.method({
  453. selector: "onDoIt",
  454. category: 'reactions',
  455. fn: function (){
  456. var self=this;
  457. return smalltalk.withContext(function($ctx1) { _st(self)._doIt();
  458. return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLCodeWidget)})},
  459. args: [],
  460. source: "onDoIt\x0a\x09\x0a self doIt",
  461. messageSends: ["doIt"],
  462. referencedClasses: []
  463. }),
  464. smalltalk.HLCodeWidget);
  465. smalltalk.addMethod(
  466. "_onInspectIt",
  467. smalltalk.method({
  468. selector: "onInspectIt",
  469. category: 'reactions',
  470. fn: function (){
  471. var self=this;
  472. return smalltalk.withContext(function($ctx1) { _st(self)._inspectIt();
  473. return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLCodeWidget)})},
  474. args: [],
  475. source: "onInspectIt\x0a\x0a\x09self inspectIt",
  476. messageSends: ["inspectIt"],
  477. referencedClasses: []
  478. }),
  479. smalltalk.HLCodeWidget);
  480. smalltalk.addMethod(
  481. "_onPrintIt",
  482. smalltalk.method({
  483. selector: "onPrintIt",
  484. category: 'reactions',
  485. fn: function (){
  486. var self=this;
  487. return smalltalk.withContext(function($ctx1) { _st(self)._printIt();
  488. return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLCodeWidget)})},
  489. args: [],
  490. source: "onPrintIt\x0a\x0a\x09self printIt",
  491. messageSends: ["printIt"],
  492. referencedClasses: []
  493. }),
  494. smalltalk.HLCodeWidget);
  495. smalltalk.addMethod(
  496. "_onSaveIt",
  497. smalltalk.method({
  498. selector: "onSaveIt",
  499. category: 'reactions',
  500. fn: function (){
  501. var self=this;
  502. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLCodeWidget)})},
  503. args: [],
  504. source: "onSaveIt\x0a\x09\x22I do not do anything\x22",
  505. messageSends: [],
  506. referencedClasses: []
  507. }),
  508. smalltalk.HLCodeWidget);
  509. smalltalk.addMethod(
  510. "_print_",
  511. smalltalk.method({
  512. selector: "print:",
  513. category: 'actions',
  514. fn: function (aString){
  515. var self=this;
  516. var start,stop,currentLine;
  517. return smalltalk.withContext(function($ctx1) { currentLine=_st(_st(self["@editor"])._getCursor_(false))._line();
  518. start=_st((smalltalk.HashedCollection || HashedCollection))._new();
  519. _st(start)._at_put_("line",currentLine);
  520. _st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
  521. _st(_st(self["@editor"])._getSelection())._ifEmpty_((function(){
  522. return smalltalk.withContext(function($ctx2) { _st(start)._at_put_("ch",_st(_st(self["@editor"])._getLine_(currentLine))._size());
  523. return _st(self["@editor"])._setSelection_end_(smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(currentLine),_st("ch").__minus_gt((0))]),start);
  524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  525. stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
  526. _st(stop)._at_put_("line",currentLine);
  527. _st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
  528. _st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
  529. _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
  530. _st(self["@editor"])._setSelection_end_(stop,start);
  531. return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine}, smalltalk.HLCodeWidget)})},
  532. args: ["aString"],
  533. source: "print: aString\x0a\x09| start stop currentLine |\x0a currentLine := (editor getCursor: false) line.\x0a\x09start := HashedCollection new.\x0a\x09start at: 'line' put: currentLine.\x0a\x09start at: 'ch' put: (editor getCursor: false) ch.\x0a (editor getSelection) ifEmpty: [\x0a \x09\x22select current line if selection is empty\x22\x0a \x09start at: 'ch' put: (editor getLine: currentLine) size.\x0a editor setSelection: #{'line' -> currentLine. 'ch' -> 0} end: start.\x0a ].\x0a\x09stop := HashedCollection new.\x0a\x09stop at: 'line' put: currentLine.\x0a\x09stop at: 'ch' put: ((start at: 'ch') + aString size + 2).\x0a\x0a\x09editor replaceSelection: (editor getSelection, ' ', aString, ' ').\x0a\x09editor setCursor: (editor getCursor: true).\x0a\x09editor setSelection: stop end: start",
  534. messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "size", "getLine:", "setSelection:end:", "->", "getSelection", "+", "at:", "replaceSelection:", ",", "setCursor:"],
  535. referencedClasses: ["HashedCollection"]
  536. }),
  537. smalltalk.HLCodeWidget);
  538. smalltalk.addMethod(
  539. "_printIt",
  540. smalltalk.method({
  541. selector: "printIt",
  542. category: 'actions',
  543. fn: function (){
  544. var self=this;
  545. var result;
  546. return smalltalk.withContext(function($ctx1) { result=_st(self)._doIt();
  547. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLPrintItRequested || HLPrintItRequested))._on_(self["@model"]));
  548. _st(self)._print_(_st(result)._printString());
  549. _st(self)._focus();
  550. return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result}, smalltalk.HLCodeWidget)})},
  551. args: [],
  552. source: "printIt\x0a\x09| result |\x0a\x0a\x09result:= self doIt.\x0a \x0a\x09self announcer announce: (HLPrintItRequested on: model).\x0a\x0a self print: result printString.\x0a\x09self focus.",
  553. messageSends: ["doIt", "announce:", "on:", "announcer", "print:", "printString", "focus"],
  554. referencedClasses: ["HLPrintItRequested"]
  555. }),
  556. smalltalk.HLCodeWidget);
  557. smalltalk.addMethod(
  558. "_receiver",
  559. smalltalk.method({
  560. selector: "receiver",
  561. category: 'accessing',
  562. fn: function (){
  563. var self=this;
  564. return smalltalk.withContext(function($ctx1) { var $1;
  565. $1=_st(_st(self)._model())._receiver();
  566. return $1;
  567. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeWidget)})},
  568. args: [],
  569. source: "receiver\x0a\x09^ self model receiver",
  570. messageSends: ["receiver", "model"],
  571. referencedClasses: []
  572. }),
  573. smalltalk.HLCodeWidget);
  574. smalltalk.addMethod(
  575. "_receiver_",
  576. smalltalk.method({
  577. selector: "receiver:",
  578. category: 'accessing',
  579. fn: function (anObject){
  580. var self=this;
  581. return smalltalk.withContext(function($ctx1) { _st(_st(self)._model())._receiver_(anObject);
  582. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  583. args: ["anObject"],
  584. source: "receiver: anObject\x0a\x09self model receiver: anObject",
  585. messageSends: ["receiver:", "model"],
  586. referencedClasses: []
  587. }),
  588. smalltalk.HLCodeWidget);
  589. smalltalk.addMethod(
  590. "_renderContentOn_",
  591. smalltalk.method({
  592. selector: "renderContentOn:",
  593. category: 'rendering',
  594. fn: function (html){
  595. var self=this;
  596. return smalltalk.withContext(function($ctx1) { self["@code"]=_st(html)._textarea();
  597. _st(self)._setEditorOn_(_st(self["@code"])._element());
  598. _st(self)._configureEditor();
  599. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLCodeWidget)})},
  600. args: ["html"],
  601. source: "renderContentOn: html\x0a code := html textarea.\x0a self setEditorOn: code element.\x0a self configureEditor",
  602. messageSends: ["textarea", "setEditorOn:", "element", "configureEditor"],
  603. referencedClasses: []
  604. }),
  605. smalltalk.HLCodeWidget);
  606. smalltalk.addMethod(
  607. "_saveIt",
  608. smalltalk.method({
  609. selector: "saveIt",
  610. category: 'actions',
  611. fn: function (){
  612. var self=this;
  613. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLCodeWidget)})},
  614. args: [],
  615. source: "saveIt\x0a\x09\x22I do not do anything\x22",
  616. messageSends: [],
  617. referencedClasses: []
  618. }),
  619. smalltalk.HLCodeWidget);
  620. smalltalk.addMethod(
  621. "_selection",
  622. smalltalk.method({
  623. selector: "selection",
  624. category: 'accessing',
  625. fn: function (){
  626. var self=this;
  627. return smalltalk.withContext(function($ctx1) { var $1;
  628. $1=_st(self["@editor"])._getSelection();
  629. return $1;
  630. }, function($ctx1) {$ctx1.fill(self,"selection",{}, smalltalk.HLCodeWidget)})},
  631. args: [],
  632. source: "selection\x0a\x09^editor getSelection",
  633. messageSends: ["getSelection"],
  634. referencedClasses: []
  635. }),
  636. smalltalk.HLCodeWidget);
  637. smalltalk.addMethod(
  638. "_selectionEnd",
  639. smalltalk.method({
  640. selector: "selectionEnd",
  641. category: 'accessing',
  642. fn: function (){
  643. var self=this;
  644. return smalltalk.withContext(function($ctx1) { var $1;
  645. $1=_st(_st(self["@code"])._element())._selectionEnd();
  646. return $1;
  647. }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{}, smalltalk.HLCodeWidget)})},
  648. args: [],
  649. source: "selectionEnd\x0a ^code element selectionEnd",
  650. messageSends: ["selectionEnd", "element"],
  651. referencedClasses: []
  652. }),
  653. smalltalk.HLCodeWidget);
  654. smalltalk.addMethod(
  655. "_selectionEnd_",
  656. smalltalk.method({
  657. selector: "selectionEnd:",
  658. category: 'accessing',
  659. fn: function (anInteger){
  660. var self=this;
  661. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionEnd_(anInteger);
  662. return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  663. args: ["anInteger"],
  664. source: "selectionEnd: anInteger\x0a code element selectionEnd: anInteger",
  665. messageSends: ["selectionEnd:", "element"],
  666. referencedClasses: []
  667. }),
  668. smalltalk.HLCodeWidget);
  669. smalltalk.addMethod(
  670. "_selectionStart",
  671. smalltalk.method({
  672. selector: "selectionStart",
  673. category: 'accessing',
  674. fn: function (){
  675. var self=this;
  676. return smalltalk.withContext(function($ctx1) { var $1;
  677. $1=_st(_st(self["@code"])._element())._selectionStart();
  678. return $1;
  679. }, function($ctx1) {$ctx1.fill(self,"selectionStart",{}, smalltalk.HLCodeWidget)})},
  680. args: [],
  681. source: "selectionStart\x0a ^code element selectionStart",
  682. messageSends: ["selectionStart", "element"],
  683. referencedClasses: []
  684. }),
  685. smalltalk.HLCodeWidget);
  686. smalltalk.addMethod(
  687. "_selectionStart_",
  688. smalltalk.method({
  689. selector: "selectionStart:",
  690. category: 'accessing',
  691. fn: function (anInteger){
  692. var self=this;
  693. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionStart_(anInteger);
  694. return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  695. args: ["anInteger"],
  696. source: "selectionStart: anInteger\x0a code element selectionStart: anInteger",
  697. messageSends: ["selectionStart:", "element"],
  698. referencedClasses: []
  699. }),
  700. smalltalk.HLCodeWidget);
  701. smalltalk.addMethod(
  702. "_setEditorOn_",
  703. smalltalk.method({
  704. selector: "setEditorOn:",
  705. category: 'actions',
  706. fn: function (aTextarea){
  707. var self=this;
  708. return smalltalk.withContext(function($ctx1) { self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  709. theme: 'amber',
  710. lineNumbers: true,
  711. enterMode: 'flat',
  712. indentWithTabs: true,
  713. indentUnit: 4,
  714. matchBrackets: true,
  715. electricChars: false,
  716. keyMap: 'Amber'
  717. });
  718. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea}, smalltalk.HLCodeWidget)})},
  719. args: ["aTextarea"],
  720. source: "setEditorOn: aTextarea\x0a\x09<self['@editor'] = CodeMirror.fromTextArea(aTextarea, {\x0a\x09\x09theme: 'amber',\x0a lineNumbers: true,\x0a enterMode: 'flat',\x0a indentWithTabs: true,\x0a\x09\x09\x09\x09indentUnit: 4,\x0a matchBrackets: true,\x0a electricChars: false,\x0a\x09\x09\x09\x09keyMap: 'Amber'\x0a\x09})>",
  721. messageSends: [],
  722. referencedClasses: []
  723. }),
  724. smalltalk.HLCodeWidget);
  725. smalltalk.addMethod(
  726. "_canBeOpenAsTab",
  727. smalltalk.method({
  728. selector: "canBeOpenAsTab",
  729. category: 'testing',
  730. fn: function (){
  731. var self=this;
  732. return smalltalk.withContext(function($ctx1) { return true;
  733. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLCodeWidget.klass)})},
  734. args: [],
  735. source: "canBeOpenAsTab\x0a\x09^ true",
  736. messageSends: [],
  737. referencedClasses: []
  738. }),
  739. smalltalk.HLCodeWidget.klass);
  740. smalltalk.addMethod(
  741. "_initialize",
  742. smalltalk.method({
  743. selector: "initialize",
  744. category: 'initialization',
  745. fn: function (){
  746. var self=this;
  747. return smalltalk.withContext(function($ctx1) { var $1,$2;
  748. smalltalk.HLWidget.klass.fn.prototype._initialize.apply(_st(self), []);
  749. $1=self;
  750. _st($1)._setupCodeMirror();
  751. _st($1)._setupCommands();
  752. $2=_st($1)._setupKeyMaps();
  753. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLCodeWidget.klass)})},
  754. args: [],
  755. source: "initialize\x0a\x09super initialize.\x0a\x09self \x0a\x09\x09setupCodeMirror;\x0a\x09\x09setupCommands;\x0a\x09\x09setupKeyMaps.",
  756. messageSends: ["initialize", "setupCodeMirror", "setupCommands", "setupKeyMaps"],
  757. referencedClasses: []
  758. }),
  759. smalltalk.HLCodeWidget.klass);
  760. smalltalk.addMethod(
  761. "_keyMap",
  762. smalltalk.method({
  763. selector: "keyMap",
  764. category: 'accessing',
  765. fn: function (){
  766. var self=this;
  767. return smalltalk.withContext(function($ctx1) { var $2,$1;
  768. $2=_st(_st(_st((smalltalk.HLManager || HLManager))._current())._keyBinder())._systemIsMac();
  769. if(smalltalk.assert($2)){
  770. $1=_st(self)._macKeyMap();
  771. } else {
  772. $1=_st(self)._pcKeyMap();
  773. };
  774. return $1;
  775. }, function($ctx1) {$ctx1.fill(self,"keyMap",{}, smalltalk.HLCodeWidget.klass)})},
  776. args: [],
  777. source: "keyMap\x0a\x09^ HLManager current keyBinder systemIsMac\x0a\x09\x09ifTrue: [ self macKeyMap ]\x0a\x09\x09ifFalse: [ self pcKeyMap ]",
  778. messageSends: ["ifTrue:ifFalse:", "macKeyMap", "pcKeyMap", "systemIsMac", "keyBinder", "current"],
  779. referencedClasses: ["HLManager"]
  780. }),
  781. smalltalk.HLCodeWidget.klass);
  782. smalltalk.addMethod(
  783. "_macKeyMap",
  784. smalltalk.method({
  785. selector: "macKeyMap",
  786. category: 'accessing',
  787. fn: function (){
  788. var self=this;
  789. return smalltalk.withContext(function($ctx1) { var $1;
  790. $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"])]);
  791. return $1;
  792. }, function($ctx1) {$ctx1.fill(self,"macKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  793. args: [],
  794. source: "macKeyMap\x0a\x09^ #{\x0a\x09\x09'Alt-Backspace'\x09\x09-> 'delWordBefore'.\x0a\x09\x09'Alt-Delete'\x09\x09-> 'delWordAfter'. \x0a\x09\x09'Alt-Left'\x09\x09-> 'goWordBoundaryLeft'.\x0a\x09\x09'Alt-Right'\x09\x09-> 'goWordBoundaryRight'. \x0a\x09\x09'Cmd-A'\x09\x09\x09-> 'selectAll'. \x0a\x09\x09'Cmd-Alt-F'\x09\x09-> 'replace'. \x0a\x09\x09'Cmd-D'\x09\x09\x09-> 'doIt'. \x0a\x09\x09'Cmd-Down'\x09\x09-> 'goDocEnd'. \x0a\x09\x09'Cmd-End'\x09\x09-> 'goDocEnd'. \x0a\x09\x09'Cmd-F'\x09\x09\x09-> 'find'.\x0a\x09\x09'Cmd-G'\x09\x09\x09-> 'findNext'. \x0a\x09\x09'Cmd-I'\x09\x09\x09-> 'inspectIt'. \x0a\x09\x09'Cmd-Left'\x09\x09-> 'goLineStart'. \x0a\x09\x09'Cmd-P'\x09\x09\x09-> 'printIt'. \x0a\x09\x09'Cmd-Right'\x09\x09-> 'goLineEnd'. \x0a\x09\x09'Cmd-S'\x09\x09\x09-> 'saveIt'. \x0a\x09\x09'Cmd-Up'\x09\x09-> 'goDocStart'. \x0a\x09\x09'Cmd-Y'\x09\x09\x09-> 'redo'.\x0a\x09\x09'Cmd-Z'\x09\x09\x09-> 'undo'. \x0a\x09\x09'Cmd-['\x09\x09\x09-> 'indentLess'. \x0a\x09\x09'Cmd-]'\x09\x09\x09-> 'indentMore'.\x0a\x09\x09'Ctrl-Alt-Backspace'\x09-> 'delWordAfter'. \x0a\x09\x09'Shift-Cmd-Alt-F'\x09-> 'replaceAll'.\x0a\x09\x09'Shift-Cmd-G'\x09\x09-> 'findPrev'. \x0a\x09\x09'Shift-Cmd-Z'\x09\x09-> 'redo'. \x0a \x09'fallthrough' \x09-> { 'basic' }\x0a }",
  795. messageSends: ["->"],
  796. referencedClasses: []
  797. }),
  798. smalltalk.HLCodeWidget.klass);
  799. smalltalk.addMethod(
  800. "_pcKeyMap",
  801. smalltalk.method({
  802. selector: "pcKeyMap",
  803. category: 'accessing',
  804. fn: function (){
  805. var self=this;
  806. return smalltalk.withContext(function($ctx1) { var $1;
  807. $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"])];
  808. return $1;
  809. }, function($ctx1) {$ctx1.fill(self,"pcKeyMap",{}, smalltalk.HLCodeWidget.klass)})},
  810. args: [],
  811. source: "pcKeyMap\x0a\x09^ {\x0a\x09\x09'Alt-Left' -> 'goLineStart'. \x0a\x09\x09'Alt-Right' -> 'goLineEnd'.\x0a\x09\x09'Alt-Up' -> 'goDocStart'. \x0a\x09\x09'Ctrl-A' -> 'selectAll'. \x0a\x09\x09'Ctrl-Backspace' -> 'delWordBefore'. \x0a\x09\x09'Ctrl-D' -> 'doIt'. \x0a\x09\x09'Ctrl-Delete' -> 'delWordAfter'. \x0a\x09\x09'Ctrl-Down' -> 'goDocEnd'.\x0a\x09\x09'Ctrl-End' -> 'goDocEnd'. \x0a\x09\x09'Ctrl-F' -> 'find'.\x0a\x09\x09'Ctrl-G' -> 'findNext'. \x0a\x09\x09'Ctrl-I' -> 'inspectIt'.\x0a\x09\x09'Ctrl-Home' -> 'goDocStart'. \x0a\x09\x09'Ctrl-Left' -> 'goWordBoundaryLeft'. \x0a\x09\x09'Ctrl-P' -> 'printIt'.\x0a\x09\x09'Ctrl-Right' -> 'goWordBoundaryRight'. \x0a\x09\x09'Ctrl-S' -> 'saveIt'. \x0a\x09\x09'Ctrl-Y' -> 'redo'.\x0a\x09\x09'Ctrl-Z' -> 'undo'. \x0a\x09\x09'Ctrl-[' -> 'indentLess'. \x0a\x09\x09'Ctrl-]' -> 'indentMore'.\x0a\x09\x09'Shift-Ctrl-F' -> 'replace'. \x0a\x09\x09'Shift-Ctrl-G' -> 'findPrev'. \x0a\x09\x09'Shift-Ctrl-R' -> 'replaceAll'.\x0a\x09\x09'Shift-Ctrl-Z' -> 'redo'. \x0a\x09\x09'fallthrough' -> #('basic')\x0a}",
  812. messageSends: ["->"],
  813. referencedClasses: []
  814. }),
  815. smalltalk.HLCodeWidget.klass);
  816. smalltalk.addMethod(
  817. "_setupCodeMirror",
  818. smalltalk.method({
  819. selector: "setupCodeMirror",
  820. category: 'initialization',
  821. fn: function (){
  822. var self=this;
  823. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap.default.fallthrough = ["basic"] ;
  824. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{}, smalltalk.HLCodeWidget.klass)})},
  825. args: [],
  826. source: "setupCodeMirror\x0a\x09< CodeMirror.keyMap.default.fallthrough = [\x22basic\x22] >",
  827. messageSends: [],
  828. referencedClasses: []
  829. }),
  830. smalltalk.HLCodeWidget.klass);
  831. smalltalk.addMethod(
  832. "_setupCommands",
  833. smalltalk.method({
  834. selector: "setupCommands",
  835. category: 'initialization',
  836. fn: function (){
  837. var self=this;
  838. return smalltalk.withContext(function($ctx1) { var $1,$2;
  839. $1=_st((smalltalk.CodeMirror || CodeMirror))._basicAt_("commands");
  840. _st($1)._at_put_("doIt",(function(cm){
  841. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._doIt();
  842. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  843. _st($1)._at_put_("inspectIt",(function(cm){
  844. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._inspectIt();
  845. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  846. _st($1)._at_put_("printIt",(function(cm){
  847. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._printIt();
  848. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  849. $2=_st($1)._at_put_("saveIt",(function(cm){
  850. return smalltalk.withContext(function($ctx2) { return _st(_st(cm)._amberCodeWidget())._saveIt();
  851. }, function($ctx2) {$ctx2.fillBlock({cm:cm},$ctx1)})}));
  852. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{}, smalltalk.HLCodeWidget.klass)})},
  853. args: [],
  854. source: "setupCommands\x0a\x09(CodeMirror basicAt: 'commands') \x0a\x09\x09at: 'doIt' put: [ :cm | cm amberCodeWidget doIt ];\x0a\x09\x09at: 'inspectIt' put: [ :cm | cm amberCodeWidget inspectIt ];\x0a\x09\x09at: 'printIt' put: [ :cm | cm amberCodeWidget printIt ];\x0a\x09\x09at: 'saveIt' put: [ :cm | cm amberCodeWidget saveIt ]",
  855. messageSends: ["at:put:", "doIt", "amberCodeWidget", "basicAt:", "inspectIt", "printIt", "saveIt"],
  856. referencedClasses: ["CodeMirror"]
  857. }),
  858. smalltalk.HLCodeWidget.klass);
  859. smalltalk.addMethod(
  860. "_setupKeyMaps",
  861. smalltalk.method({
  862. selector: "setupKeyMaps",
  863. category: 'initialization',
  864. fn: function (){
  865. var self=this;
  866. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap['Amber'] = self._keyMap();
  867. return self}, function($ctx1) {$ctx1.fill(self,"setupKeyMaps",{}, smalltalk.HLCodeWidget.klass)})},
  868. args: [],
  869. source: "setupKeyMaps\x0a\x09<CodeMirror.keyMap['Amber'] = self._keyMap()>",
  870. messageSends: [],
  871. referencedClasses: []
  872. }),
  873. smalltalk.HLCodeWidget.klass);
  874. smalltalk.addMethod(
  875. "_tabLabel",
  876. smalltalk.method({
  877. selector: "tabLabel",
  878. category: 'accessing',
  879. fn: function (){
  880. var self=this;
  881. return smalltalk.withContext(function($ctx1) { return "Workspace";
  882. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLCodeWidget.klass)})},
  883. args: [],
  884. source: "tabLabel\x0a\x09^ 'Workspace'",
  885. messageSends: [],
  886. referencedClasses: []
  887. }),
  888. smalltalk.HLCodeWidget.klass);
  889. smalltalk.addMethod(
  890. "_tabPriority",
  891. smalltalk.method({
  892. selector: "tabPriority",
  893. category: 'accessing',
  894. fn: function (){
  895. var self=this;
  896. return smalltalk.withContext(function($ctx1) { return (10);
  897. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLCodeWidget.klass)})},
  898. args: [],
  899. source: "tabPriority\x0a\x09^ 10",
  900. messageSends: [],
  901. referencedClasses: []
  902. }),
  903. smalltalk.HLCodeWidget.klass);
  904. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, ['browserModel'], 'Helios-Workspace');
  905. smalltalk.addMethod(
  906. "_browserModel",
  907. smalltalk.method({
  908. selector: "browserModel",
  909. category: 'accessing',
  910. fn: function (){
  911. var self=this;
  912. return smalltalk.withContext(function($ctx1) { var $1;
  913. $1=self["@browserModel"];
  914. return $1;
  915. }, function($ctx1) {$ctx1.fill(self,"browserModel",{}, smalltalk.HLSourceCodeWidget)})},
  916. args: [],
  917. source: "browserModel\x0a\x09^ browserModel",
  918. messageSends: [],
  919. referencedClasses: []
  920. }),
  921. smalltalk.HLSourceCodeWidget);
  922. smalltalk.addMethod(
  923. "_browserModel_",
  924. smalltalk.method({
  925. selector: "browserModel:",
  926. category: 'accessing',
  927. fn: function (aBrowserModel){
  928. var self=this;
  929. return smalltalk.withContext(function($ctx1) { self["@browserModel"]=aBrowserModel;
  930. _st(self)._observeBrowserModel();
  931. return self}, function($ctx1) {$ctx1.fill(self,"browserModel:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget)})},
  932. args: ["aBrowserModel"],
  933. source: "browserModel: aBrowserModel\x0a\x09browserModel := aBrowserModel.\x0a\x09self observeBrowserModel",
  934. messageSends: ["observeBrowserModel"],
  935. referencedClasses: []
  936. }),
  937. smalltalk.HLSourceCodeWidget);
  938. smalltalk.addMethod(
  939. "_observeBrowserModel",
  940. smalltalk.method({
  941. selector: "observeBrowserModel",
  942. category: 'actions',
  943. fn: function (){
  944. var self=this;
  945. return smalltalk.withContext(function($ctx1) { var $1,$2;
  946. $1=_st(_st(self)._browserModel())._announcer();
  947. _st($1)._on_do_((smalltalk.HLSaveSourceCode || HLSaveSourceCode),(function(ann){
  948. return smalltalk.withContext(function($ctx2) { return _st(self)._onSaveIt();
  949. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  950. _st($1)._on_do_((smalltalk.HLParseErrorRaised || HLParseErrorRaised),(function(ann){
  951. return smalltalk.withContext(function($ctx2) { return _st(self)._onParseError_(ann);
  952. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  953. _st($1)._on_do_((smalltalk.HLCompileErrorRaised || HLCompileErrorRaised),(function(ann){
  954. return smalltalk.withContext(function($ctx2) { return _st(self)._onCompileError_(_st(ann)._error());
  955. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  956. _st($1)._on_do_((smalltalk.HLUnknownVariableErrorRaised || HLUnknownVariableErrorRaised),(function(ann){
  957. return smalltalk.withContext(function($ctx2) { return _st(self)._onUnknownVariableError_(_st(ann)._error());
  958. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  959. $2=_st($1)._on_do_((smalltalk.HLInstVarAdded || HLInstVarAdded),(function(ann){
  960. return smalltalk.withContext(function($ctx2) { return _st(self)._onInstVarAdded();
  961. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1)})}));
  962. return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{}, smalltalk.HLSourceCodeWidget)})},
  963. args: [],
  964. source: "observeBrowserModel\x0a\x09self browserModel announcer\x0a\x09\x09on: HLSaveSourceCode\x0a\x09\x09do: [ :ann | self onSaveIt ];\x0a\x09\x09on: HLParseErrorRaised\x0a\x09\x09do: [ :ann | self onParseError: ann ];\x0a\x09\x09on: HLCompileErrorRaised\x0a\x09\x09do: [ :ann | self onCompileError: ann error ];\x0a\x09\x09on: HLUnknownVariableErrorRaised\x0a\x09\x09do: [ :ann | self onUnknownVariableError: ann error ];\x0a\x09\x09on: HLInstVarAdded \x0a\x09\x09do: [ :ann | self onInstVarAdded ]",
  965. messageSends: ["on:do:", "onSaveIt", "announcer", "browserModel", "onParseError:", "onCompileError:", "error", "onUnknownVariableError:", "onInstVarAdded"],
  966. referencedClasses: ["HLSaveSourceCode", "HLParseErrorRaised", "HLCompileErrorRaised", "HLUnknownVariableErrorRaised", "HLInstVarAdded"]
  967. }),
  968. smalltalk.HLSourceCodeWidget);
  969. smalltalk.addMethod(
  970. "_onCompileError_",
  971. smalltalk.method({
  972. selector: "onCompileError:",
  973. category: 'reactions',
  974. fn: function (anError){
  975. var self=this;
  976. return smalltalk.withContext(function($ctx1) { _st(self)._alert_(_st(anError)._messageText());
  977. return self}, function($ctx1) {$ctx1.fill(self,"onCompileError:",{anError:anError}, smalltalk.HLSourceCodeWidget)})},
  978. args: ["anError"],
  979. source: "onCompileError: anError\x0a\x09self alert: anError messageText",
  980. messageSends: ["alert:", "messageText"],
  981. referencedClasses: []
  982. }),
  983. smalltalk.HLSourceCodeWidget);
  984. smalltalk.addMethod(
  985. "_onInstVarAdded",
  986. smalltalk.method({
  987. selector: "onInstVarAdded",
  988. category: 'reactions',
  989. fn: function (){
  990. var self=this;
  991. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  992. return self}, function($ctx1) {$ctx1.fill(self,"onInstVarAdded",{}, smalltalk.HLSourceCodeWidget)})},
  993. args: [],
  994. source: "onInstVarAdded\x0a\x09self browserModel save: self contents",
  995. messageSends: ["save:", "contents", "browserModel"],
  996. referencedClasses: []
  997. }),
  998. smalltalk.HLSourceCodeWidget);
  999. smalltalk.addMethod(
  1000. "_onParseError_",
  1001. smalltalk.method({
  1002. selector: "onParseError:",
  1003. category: 'reactions',
  1004. fn: function (anAnnouncement){
  1005. var self=this;
  1006. var lineIndex,newContents;
  1007. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  1008. lineIndex=(1);
  1009. _st(self)._contents_(_st((smalltalk.String || String))._streamContents_((function(stream){
  1010. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._contents())._linesDo_((function(each){
  1011. return smalltalk.withContext(function($ctx3) { $1=_st(lineIndex).__eq(_st(anAnnouncement)._line());
  1012. if(smalltalk.assert($1)){
  1013. $2=stream;
  1014. _st($2)._nextPutAll_(_st(each)._copyFrom_to_((1),_st(anAnnouncement)._column()));
  1015. _st($2)._nextPutAll_("<- ");
  1016. _st($2)._nextPutAll_(_st(anAnnouncement)._message());
  1017. _st($2)._nextPutAll_(" ");
  1018. $3=_st($2)._nextPutAll_(_st(each)._copyFrom_to_(_st(_st(anAnnouncement)._column()).__plus((1)),_st(each)._size()));
  1019. $3;
  1020. } else {
  1021. _st(stream)._nextPutAll_(each);
  1022. };
  1023. _st(stream)._nextPutAll_(_st((smalltalk.String || String))._cr());
  1024. lineIndex=_st(lineIndex).__plus((1));
  1025. return lineIndex;
  1026. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  1027. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  1028. return self}, function($ctx1) {$ctx1.fill(self,"onParseError:",{anAnnouncement:anAnnouncement,lineIndex:lineIndex,newContents:newContents}, smalltalk.HLSourceCodeWidget)})},
  1029. args: ["anAnnouncement"],
  1030. source: "onParseError: anAnnouncement\x0a\x09| lineIndex newContents |\x0a\x09\x0a\x09lineIndex := 1.\x0a\x09\x0a\x09self contents: (String streamContents: [ :stream |\x0a\x09\x09self contents linesDo: [ :each |\x0a\x09\x09\x09lineIndex = anAnnouncement line \x0a\x09\x09\x09\x09ifTrue: [ \x0a\x09\x09\x09\x09\x09stream \x0a\x09\x09\x09\x09\x09\x09nextPutAll: (each copyFrom: 1 to: anAnnouncement column);\x0a\x09\x09\x09\x09\x09\x09nextPutAll: '<- ';\x0a\x09\x09\x09\x09\x09\x09nextPutAll: anAnnouncement message;\x0a\x09\x09\x09\x09\x09\x09nextPutAll: ' ';\x0a\x09\x09\x09\x09\x09\x09nextPutAll: (each copyFrom: anAnnouncement column + 1 to: each size) ]\x0a\x09\x09\x09\x09ifFalse: [ stream nextPutAll: each ].\x0a\x09\x09\x09stream nextPutAll: String cr.\x0a\x09\x09\x09lineIndex := lineIndex + 1 ] ])",
  1031. messageSends: ["contents:", "streamContents:", "linesDo:", "ifTrue:ifFalse:", "nextPutAll:", "copyFrom:to:", "column", "message", "+", "size", "=", "line", "cr", "contents"],
  1032. referencedClasses: ["String"]
  1033. }),
  1034. smalltalk.HLSourceCodeWidget);
  1035. smalltalk.addMethod(
  1036. "_onSaveIt",
  1037. smalltalk.method({
  1038. selector: "onSaveIt",
  1039. category: 'reactions',
  1040. fn: function (){
  1041. var self=this;
  1042. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._save_(_st(self)._contents());
  1043. return self}, function($ctx1) {$ctx1.fill(self,"onSaveIt",{}, smalltalk.HLSourceCodeWidget)})},
  1044. args: [],
  1045. source: "onSaveIt\x0a\x09self browserModel save: self contents",
  1046. messageSends: ["save:", "contents", "browserModel"],
  1047. referencedClasses: []
  1048. }),
  1049. smalltalk.HLSourceCodeWidget);
  1050. smalltalk.addMethod(
  1051. "_onUnknownVariableError_",
  1052. smalltalk.method({
  1053. selector: "onUnknownVariableError:",
  1054. category: 'reactions',
  1055. fn: function (anError){
  1056. var self=this;
  1057. var confirm;
  1058. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4;
  1059. confirm=_st(self)._confirm_(_st((smalltalk.String || String))._streamContents_((function(stream){
  1060. return smalltalk.withContext(function($ctx2) { $1=stream;
  1061. _st($1)._nextPutAll_(_st(anError)._messageText());
  1062. _st($1)._nextPutAll_(_st((smalltalk.String || String))._cr());
  1063. $2=_st($1)._nextPutAll_("Would you like to define an instance variable?");
  1064. return $2;
  1065. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})})));
  1066. $3=confirm;
  1067. if(! smalltalk.assert($3)){
  1068. $4=self;
  1069. return $4;
  1070. };
  1071. _st(_st(self)._browserModel())._addInstVarNamed_(_st(anError)._variableName());
  1072. return self}, function($ctx1) {$ctx1.fill(self,"onUnknownVariableError:",{anError:anError,confirm:confirm}, smalltalk.HLSourceCodeWidget)})},
  1073. args: ["anError"],
  1074. source: "onUnknownVariableError: anError\x0a\x09| confirm |\x0a\x0a\x09confirm := self confirm: (String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: anError messageText;\x0a\x09\x09\x09nextPutAll: String cr;\x0a\x09\x09\x09nextPutAll: 'Would you like to define an instance variable?' ]).\x0a\x09\x09\x09\x0a\x09confirm ifFalse: [ ^ self ].\x0a\x09\x0a\x09self browserModel addInstVarNamed: anError variableName",
  1075. messageSends: ["confirm:", "streamContents:", "nextPutAll:", "messageText", "cr", "ifFalse:", "addInstVarNamed:", "variableName", "browserModel"],
  1076. referencedClasses: ["String"]
  1077. }),
  1078. smalltalk.HLSourceCodeWidget);
  1079. smalltalk.addMethod(
  1080. "_saveIt",
  1081. smalltalk.method({
  1082. selector: "saveIt",
  1083. category: 'actions',
  1084. fn: function (){
  1085. var self=this;
  1086. return smalltalk.withContext(function($ctx1) { _st(_st(self)._browserModel())._saveSourceCode();
  1087. return self}, function($ctx1) {$ctx1.fill(self,"saveIt",{}, smalltalk.HLSourceCodeWidget)})},
  1088. args: [],
  1089. source: "saveIt\x0a\x09self browserModel saveSourceCode",
  1090. messageSends: ["saveSourceCode", "browserModel"],
  1091. referencedClasses: []
  1092. }),
  1093. smalltalk.HLSourceCodeWidget);
  1094. smalltalk.addMethod(
  1095. "_canBeOpenAsTab",
  1096. smalltalk.method({
  1097. selector: "canBeOpenAsTab",
  1098. category: 'testing',
  1099. fn: function (){
  1100. var self=this;
  1101. return smalltalk.withContext(function($ctx1) { return false;
  1102. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLSourceCodeWidget.klass)})},
  1103. args: [],
  1104. source: "canBeOpenAsTab\x0a\x09^ false",
  1105. messageSends: [],
  1106. referencedClasses: []
  1107. }),
  1108. smalltalk.HLSourceCodeWidget.klass);
  1109. smalltalk.addMethod(
  1110. "_on_",
  1111. smalltalk.method({
  1112. selector: "on:",
  1113. category: 'instance creation',
  1114. fn: function (aBrowserModel){
  1115. var self=this;
  1116. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1117. $2=_st(self)._new();
  1118. _st($2)._browserModel_(aBrowserModel);
  1119. $3=_st($2)._yourself();
  1120. $1=$3;
  1121. return $1;
  1122. }, function($ctx1) {$ctx1.fill(self,"on:",{aBrowserModel:aBrowserModel}, smalltalk.HLSourceCodeWidget.klass)})},
  1123. args: ["aBrowserModel"],
  1124. source: "on: aBrowserModel\x0a\x09^ self new\x0a\x09\x09browserModel: aBrowserModel;\x0a\x09\x09yourself",
  1125. messageSends: ["browserModel:", "new", "yourself"],
  1126. referencedClasses: []
  1127. }),
  1128. smalltalk.HLSourceCodeWidget.klass);