Helios-Workspace.js 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121
  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. "_clear",
  190. smalltalk.method({
  191. selector: "clear",
  192. category: 'actions',
  193. fn: function (){
  194. var self=this;
  195. return smalltalk.withContext(function($ctx1) { _st(self)._contents_("");
  196. return self}, function($ctx1) {$ctx1.fill(self,"clear",{}, smalltalk.HLCodeWidget)})},
  197. args: [],
  198. source: "clear\x0a self contents: ''",
  199. messageSends: ["contents:"],
  200. referencedClasses: []
  201. }),
  202. smalltalk.HLCodeWidget);
  203. smalltalk.addMethod(
  204. "_contents",
  205. smalltalk.method({
  206. selector: "contents",
  207. category: 'accessing',
  208. fn: function (){
  209. var self=this;
  210. return smalltalk.withContext(function($ctx1) { var $1;
  211. $1=_st(self["@editor"])._getValue();
  212. return $1;
  213. }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.HLCodeWidget)})},
  214. args: [],
  215. source: "contents\x0a\x09^ editor getValue",
  216. messageSends: ["getValue"],
  217. referencedClasses: []
  218. }),
  219. smalltalk.HLCodeWidget);
  220. smalltalk.addMethod(
  221. "_contents_",
  222. smalltalk.method({
  223. selector: "contents:",
  224. category: 'accessing',
  225. fn: function (aString){
  226. var self=this;
  227. return smalltalk.withContext(function($ctx1) { _st(self["@editor"])._setValue_(aString);
  228. return self}, function($ctx1) {$ctx1.fill(self,"contents:",{aString:aString}, smalltalk.HLCodeWidget)})},
  229. args: ["aString"],
  230. source: "contents: aString\x0a\x09editor setValue: aString",
  231. messageSends: ["setValue:"],
  232. referencedClasses: []
  233. }),
  234. smalltalk.HLCodeWidget);
  235. smalltalk.addMethod(
  236. "_currentLine",
  237. smalltalk.method({
  238. selector: "currentLine",
  239. category: 'accessing',
  240. fn: function (){
  241. var self=this;
  242. return smalltalk.withContext(function($ctx1) { var $1;
  243. $1=_st(self["@editor"])._getLine_(_st(_st(self["@editor"])._getCursor())._line());
  244. return $1;
  245. }, function($ctx1) {$ctx1.fill(self,"currentLine",{}, smalltalk.HLCodeWidget)})},
  246. args: [],
  247. source: "currentLine\x0a ^editor getLine: (editor getCursor line)",
  248. messageSends: ["getLine:", "line", "getCursor"],
  249. referencedClasses: []
  250. }),
  251. smalltalk.HLCodeWidget);
  252. smalltalk.addMethod(
  253. "_currentLineOrSelection",
  254. smalltalk.method({
  255. selector: "currentLineOrSelection",
  256. category: 'accessing',
  257. fn: function (){
  258. var self=this;
  259. return smalltalk.withContext(function($ctx1) { var $2,$1;
  260. $2=_st(self["@editor"])._somethingSelected();
  261. if(smalltalk.assert($2)){
  262. $1=_st(self)._selection();
  263. } else {
  264. $1=_st(self)._currentLine();
  265. };
  266. return $1;
  267. }, function($ctx1) {$ctx1.fill(self,"currentLineOrSelection",{}, smalltalk.HLCodeWidget)})},
  268. args: [],
  269. source: "currentLineOrSelection\x0a ^editor somethingSelected\x0a\x09\x09ifFalse: [ self currentLine ]\x0a\x09\x09ifTrue: [ self selection ]",
  270. messageSends: ["ifFalse:ifTrue:", "currentLine", "selection", "somethingSelected"],
  271. referencedClasses: []
  272. }),
  273. smalltalk.HLCodeWidget);
  274. smalltalk.addMethod(
  275. "_doIt",
  276. smalltalk.method({
  277. selector: "doIt",
  278. category: 'actions',
  279. fn: function (){
  280. var self=this;
  281. var result;
  282. return smalltalk.withContext(function($ctx1) { var $1;
  283. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItRequested || HLDoItRequested))._on_(self["@model"]));
  284. result=_st(self["@model"])._doIt_(_st(self)._currentLineOrSelection());
  285. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLDoItExecuted || HLDoItExecuted))._on_(self["@model"]));
  286. $1=result;
  287. return $1;
  288. }, function($ctx1) {$ctx1.fill(self,"doIt",{result:result}, smalltalk.HLCodeWidget)})},
  289. args: [],
  290. 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 ",
  291. messageSends: ["announce:", "on:", "announcer", "doIt:", "currentLineOrSelection"],
  292. referencedClasses: ["HLDoItRequested", "HLDoItExecuted"]
  293. }),
  294. smalltalk.HLCodeWidget);
  295. smalltalk.addMethod(
  296. "_editor",
  297. smalltalk.method({
  298. selector: "editor",
  299. category: 'actions',
  300. fn: function (){
  301. var self=this;
  302. return smalltalk.withContext(function($ctx1) { var $1;
  303. $1=self["@editor"];
  304. return $1;
  305. }, function($ctx1) {$ctx1.fill(self,"editor",{}, smalltalk.HLCodeWidget)})},
  306. args: [],
  307. source: "editor\x0a\x09^editor",
  308. messageSends: [],
  309. referencedClasses: []
  310. }),
  311. smalltalk.HLCodeWidget);
  312. smalltalk.addMethod(
  313. "_focus",
  314. smalltalk.method({
  315. selector: "focus",
  316. category: 'actions',
  317. fn: function (){
  318. var self=this;
  319. return smalltalk.withContext(function($ctx1) { _st(_st(self)._editor())._focus();
  320. return self}, function($ctx1) {$ctx1.fill(self,"focus",{}, smalltalk.HLCodeWidget)})},
  321. args: [],
  322. source: "focus\x0a self editor focus",
  323. messageSends: ["focus", "editor"],
  324. referencedClasses: []
  325. }),
  326. smalltalk.HLCodeWidget);
  327. smalltalk.addMethod(
  328. "_inspectIt",
  329. smalltalk.method({
  330. selector: "inspectIt",
  331. category: 'actions',
  332. fn: function (){
  333. var self=this;
  334. var newInspector;
  335. return smalltalk.withContext(function($ctx1) { _st(_st(self)._announcer())._announce_(_st((smalltalk.HLInspectItRequested || HLInspectItRequested))._on_(self["@model"]));
  336. newInspector=_st(self)._makeInspectorOn_(_st(self)._doIt());
  337. _st(newInspector)._open();
  338. return self}, function($ctx1) {$ctx1.fill(self,"inspectIt",{newInspector:newInspector}, smalltalk.HLCodeWidget)})},
  339. args: [],
  340. source: "inspectIt\x0a\x09| newInspector |\x0a \x0a\x09self announcer announce: (HLInspectItRequested on: model).\x0a\x09newInspector := self makeInspectorOn: self doIt.\x0a\x09newInspector open",
  341. messageSends: ["announce:", "on:", "announcer", "makeInspectorOn:", "doIt", "open"],
  342. referencedClasses: ["HLInspectItRequested"]
  343. }),
  344. smalltalk.HLCodeWidget);
  345. smalltalk.addMethod(
  346. "_makeInspectorOn_",
  347. smalltalk.method({
  348. selector: "makeInspectorOn:",
  349. category: 'actions',
  350. fn: function (anObject){
  351. var self=this;
  352. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  353. $2=_st((smalltalk.HLInspector || HLInspector))._new();
  354. _st($2)._inspect_(anObject);
  355. $3=_st($2)._yourself();
  356. $1=$3;
  357. return $1;
  358. }, function($ctx1) {$ctx1.fill(self,"makeInspectorOn:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  359. args: ["anObject"],
  360. source: "makeInspectorOn: anObject\x0a\x0a\x09^ HLInspector new \x0a\x09\x09inspect: anObject;\x0a\x09\x09yourself",
  361. messageSends: ["inspect:", "new", "yourself"],
  362. referencedClasses: ["HLInspector"]
  363. }),
  364. smalltalk.HLCodeWidget);
  365. smalltalk.addMethod(
  366. "_model",
  367. smalltalk.method({
  368. selector: "model",
  369. category: 'accessing',
  370. fn: function (){
  371. var self=this;
  372. return smalltalk.withContext(function($ctx1) { var $2,$1;
  373. $2=self["@model"];
  374. if(($receiver = $2) == nil || $receiver == undefined){
  375. _st(self)._model_(_st((smalltalk.HLCodeModel || HLCodeModel))._new());
  376. $1=self["@model"];
  377. } else {
  378. $1=$2;
  379. };
  380. return $1;
  381. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLCodeWidget)})},
  382. args: [],
  383. source: "model\x0a\x09^ model ifNil: [ \x0a \x09self model: HLCodeModel new.\x0a\x09\x09model ]",
  384. messageSends: ["ifNil:", "model:", "new"],
  385. referencedClasses: ["HLCodeModel"]
  386. }),
  387. smalltalk.HLCodeWidget);
  388. smalltalk.addMethod(
  389. "_model_",
  390. smalltalk.method({
  391. selector: "model:",
  392. category: 'accessing',
  393. fn: function (aModel){
  394. var self=this;
  395. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  396. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLCodeWidget)})},
  397. args: ["aModel"],
  398. source: "model: aModel\x0a\x09model := aModel",
  399. messageSends: [],
  400. referencedClasses: []
  401. }),
  402. smalltalk.HLCodeWidget);
  403. smalltalk.addMethod(
  404. "_observeWrapper",
  405. smalltalk.method({
  406. selector: "observeWrapper",
  407. category: 'actions',
  408. fn: function (){
  409. var self=this;
  410. return smalltalk.withContext(function($ctx1) { _st(self["@wrapper"])._onKeyDown_((function(e){
  411. return smalltalk.withContext(function($ctx2) { return _st(self)._onKeyDown_(e);
  412. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1)})}));
  413. return self}, function($ctx1) {$ctx1.fill(self,"observeWrapper",{}, smalltalk.HLCodeWidget)})},
  414. args: [],
  415. source: "observeWrapper\x0a\x0a wrapper onKeyDown: [ :e | self onKeyDown: e ]\x0a",
  416. messageSends: ["onKeyDown:"],
  417. referencedClasses: []
  418. }),
  419. smalltalk.HLCodeWidget);
  420. smalltalk.addMethod(
  421. "_onDoIt",
  422. smalltalk.method({
  423. selector: "onDoIt",
  424. category: 'reactions',
  425. fn: function (){
  426. var self=this;
  427. return smalltalk.withContext(function($ctx1) { _st(self)._doIt();
  428. return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLCodeWidget)})},
  429. args: [],
  430. source: "onDoIt\x0a\x09\x0a self doIt",
  431. messageSends: ["doIt"],
  432. referencedClasses: []
  433. }),
  434. smalltalk.HLCodeWidget);
  435. smalltalk.addMethod(
  436. "_onInspectIt",
  437. smalltalk.method({
  438. selector: "onInspectIt",
  439. category: 'reactions',
  440. fn: function (){
  441. var self=this;
  442. return smalltalk.withContext(function($ctx1) { _st(self)._inspectIt();
  443. return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLCodeWidget)})},
  444. args: [],
  445. source: "onInspectIt\x0a\x0a\x09self inspectIt",
  446. messageSends: ["inspectIt"],
  447. referencedClasses: []
  448. }),
  449. smalltalk.HLCodeWidget);
  450. smalltalk.addMethod(
  451. "_onKeyDown_",
  452. smalltalk.method({
  453. selector: "onKeyDown:",
  454. category: 'reactions',
  455. fn: function (anEvent){
  456. var self=this;
  457. return smalltalk.withContext(function($ctx1) { if(anEvent.ctrlKey) {
  458. if(anEvent.keyCode === 80) { //ctrl+p
  459. self._onPrintIt();
  460. anEvent.preventDefault();
  461. return false;
  462. }
  463. if(anEvent.keyCode === 68) { //ctrl+d
  464. self._onDoIt();
  465. anEvent.preventDefault();
  466. return false;
  467. }
  468. if(anEvent.keyCode === 73) { //ctrl+i
  469. self._onInspectIt();
  470. anEvent.preventDefault();
  471. return false;
  472. }
  473. };
  474. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLCodeWidget)})},
  475. args: ["anEvent"],
  476. source: "onKeyDown: anEvent\x0a\x0a <if(anEvent.ctrlKey) {\x0a\x09\x09if(anEvent.keyCode === 80) { //ctrl+p\x0a\x09\x09\x09self._onPrintIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09if(anEvent.keyCode === 68) { //ctrl+d\x0a\x09\x09\x09self._onDoIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09if(anEvent.keyCode === 73) { //ctrl+i\x0a\x09\x09\x09self._onInspectIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09}>\x09",
  477. messageSends: [],
  478. referencedClasses: []
  479. }),
  480. smalltalk.HLCodeWidget);
  481. smalltalk.addMethod(
  482. "_onPrintIt",
  483. smalltalk.method({
  484. selector: "onPrintIt",
  485. category: 'reactions',
  486. fn: function (){
  487. var self=this;
  488. return smalltalk.withContext(function($ctx1) { _st(self)._printIt();
  489. return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLCodeWidget)})},
  490. args: [],
  491. source: "onPrintIt\x0a\x0a\x09self printIt",
  492. messageSends: ["printIt"],
  493. referencedClasses: []
  494. }),
  495. smalltalk.HLCodeWidget);
  496. smalltalk.addMethod(
  497. "_print_",
  498. smalltalk.method({
  499. selector: "print:",
  500. category: 'actions',
  501. fn: function (aString){
  502. var self=this;
  503. var start,stop,currentLine;
  504. return smalltalk.withContext(function($ctx1) { currentLine=_st(_st(self["@editor"])._getCursor_(false))._line();
  505. start=_st((smalltalk.HashedCollection || HashedCollection))._new();
  506. _st(start)._at_put_("line",currentLine);
  507. _st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
  508. _st(_st(self["@editor"])._getSelection())._ifEmpty_((function(){
  509. return smalltalk.withContext(function($ctx2) { _st(start)._at_put_("ch",_st(_st(self["@editor"])._getLine_(currentLine))._size());
  510. return _st(self["@editor"])._setSelection_end_(smalltalk.HashedCollection._fromPairs_([_st("line").__minus_gt(currentLine),_st("ch").__minus_gt((0))]),start);
  511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  512. stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
  513. _st(stop)._at_put_("line",currentLine);
  514. _st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
  515. _st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
  516. _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
  517. _st(self["@editor"])._setSelection_end_(stop,start);
  518. return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop,currentLine:currentLine}, smalltalk.HLCodeWidget)})},
  519. args: ["aString"],
  520. 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",
  521. messageSends: ["line", "getCursor:", "new", "at:put:", "ch", "ifEmpty:", "size", "getLine:", "setSelection:end:", "->", "getSelection", "+", "at:", "replaceSelection:", ",", "setCursor:"],
  522. referencedClasses: ["HashedCollection"]
  523. }),
  524. smalltalk.HLCodeWidget);
  525. smalltalk.addMethod(
  526. "_printIt",
  527. smalltalk.method({
  528. selector: "printIt",
  529. category: 'actions',
  530. fn: function (){
  531. var self=this;
  532. var result;
  533. return smalltalk.withContext(function($ctx1) { result=_st(self)._doIt();
  534. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLPrintItRequested || HLPrintItRequested))._on_(self["@model"]));
  535. _st(self)._print_(_st(result)._printString());
  536. _st(self)._focus();
  537. return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result}, smalltalk.HLCodeWidget)})},
  538. args: [],
  539. 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.",
  540. messageSends: ["doIt", "announce:", "on:", "announcer", "print:", "printString", "focus"],
  541. referencedClasses: ["HLPrintItRequested"]
  542. }),
  543. smalltalk.HLCodeWidget);
  544. smalltalk.addMethod(
  545. "_receiver",
  546. smalltalk.method({
  547. selector: "receiver",
  548. category: 'accessing',
  549. fn: function (){
  550. var self=this;
  551. return smalltalk.withContext(function($ctx1) { var $1;
  552. $1=_st(_st(self)._model())._receiver();
  553. return $1;
  554. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeWidget)})},
  555. args: [],
  556. source: "receiver\x0a\x09^ self model receiver",
  557. messageSends: ["receiver", "model"],
  558. referencedClasses: []
  559. }),
  560. smalltalk.HLCodeWidget);
  561. smalltalk.addMethod(
  562. "_receiver_",
  563. smalltalk.method({
  564. selector: "receiver:",
  565. category: 'accessing',
  566. fn: function (anObject){
  567. var self=this;
  568. return smalltalk.withContext(function($ctx1) { _st(_st(self)._model())._receiver_(anObject);
  569. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  570. args: ["anObject"],
  571. source: "receiver: anObject\x0a\x09self model receiver: anObject",
  572. messageSends: ["receiver:", "model"],
  573. referencedClasses: []
  574. }),
  575. smalltalk.HLCodeWidget);
  576. smalltalk.addMethod(
  577. "_renderContentOn_",
  578. smalltalk.method({
  579. selector: "renderContentOn:",
  580. category: 'rendering',
  581. fn: function (html){
  582. var self=this;
  583. return smalltalk.withContext(function($ctx1) { self["@code"]=_st(html)._textarea();
  584. _st(self)._setEditorOn_(_st(self["@code"])._element());
  585. _st(self)._observeWrapper();
  586. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLCodeWidget)})},
  587. args: ["html"],
  588. source: "renderContentOn: html\x0a code := html textarea.\x0a self setEditorOn: code element.\x0a \x0a self observeWrapper",
  589. messageSends: ["textarea", "setEditorOn:", "element", "observeWrapper"],
  590. referencedClasses: []
  591. }),
  592. smalltalk.HLCodeWidget);
  593. smalltalk.addMethod(
  594. "_selection",
  595. smalltalk.method({
  596. selector: "selection",
  597. category: 'accessing',
  598. fn: function (){
  599. var self=this;
  600. return smalltalk.withContext(function($ctx1) { var $1;
  601. $1=_st(self["@editor"])._getSelection();
  602. return $1;
  603. }, function($ctx1) {$ctx1.fill(self,"selection",{}, smalltalk.HLCodeWidget)})},
  604. args: [],
  605. source: "selection\x0a\x09^editor getSelection",
  606. messageSends: ["getSelection"],
  607. referencedClasses: []
  608. }),
  609. smalltalk.HLCodeWidget);
  610. smalltalk.addMethod(
  611. "_selectionEnd",
  612. smalltalk.method({
  613. selector: "selectionEnd",
  614. category: 'accessing',
  615. fn: function (){
  616. var self=this;
  617. return smalltalk.withContext(function($ctx1) { var $1;
  618. $1=_st(_st(self["@code"])._element())._selectionEnd();
  619. return $1;
  620. }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{}, smalltalk.HLCodeWidget)})},
  621. args: [],
  622. source: "selectionEnd\x0a ^code element selectionEnd",
  623. messageSends: ["selectionEnd", "element"],
  624. referencedClasses: []
  625. }),
  626. smalltalk.HLCodeWidget);
  627. smalltalk.addMethod(
  628. "_selectionEnd_",
  629. smalltalk.method({
  630. selector: "selectionEnd:",
  631. category: 'accessing',
  632. fn: function (anInteger){
  633. var self=this;
  634. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionEnd_(anInteger);
  635. return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  636. args: ["anInteger"],
  637. source: "selectionEnd: anInteger\x0a code element selectionEnd: anInteger",
  638. messageSends: ["selectionEnd:", "element"],
  639. referencedClasses: []
  640. }),
  641. smalltalk.HLCodeWidget);
  642. smalltalk.addMethod(
  643. "_selectionStart",
  644. smalltalk.method({
  645. selector: "selectionStart",
  646. category: 'accessing',
  647. fn: function (){
  648. var self=this;
  649. return smalltalk.withContext(function($ctx1) { var $1;
  650. $1=_st(_st(self["@code"])._element())._selectionStart();
  651. return $1;
  652. }, function($ctx1) {$ctx1.fill(self,"selectionStart",{}, smalltalk.HLCodeWidget)})},
  653. args: [],
  654. source: "selectionStart\x0a ^code element selectionStart",
  655. messageSends: ["selectionStart", "element"],
  656. referencedClasses: []
  657. }),
  658. smalltalk.HLCodeWidget);
  659. smalltalk.addMethod(
  660. "_selectionStart_",
  661. smalltalk.method({
  662. selector: "selectionStart:",
  663. category: 'accessing',
  664. fn: function (anInteger){
  665. var self=this;
  666. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionStart_(anInteger);
  667. return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  668. args: ["anInteger"],
  669. source: "selectionStart: anInteger\x0a code element selectionStart: anInteger",
  670. messageSends: ["selectionStart:", "element"],
  671. referencedClasses: []
  672. }),
  673. smalltalk.HLCodeWidget);
  674. smalltalk.addMethod(
  675. "_setEditorOn_",
  676. smalltalk.method({
  677. selector: "setEditorOn:",
  678. category: 'actions',
  679. fn: function (aTextarea){
  680. var self=this;
  681. return smalltalk.withContext(function($ctx1) { self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  682. theme: 'amber',
  683. lineNumbers: true,
  684. enterMode: 'flat',
  685. matchBrackets: true,
  686. electricChars: false
  687. });
  688. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea}, smalltalk.HLCodeWidget)})},
  689. args: ["aTextarea"],
  690. source: "setEditorOn: aTextarea\x0a\x09<self['@editor'] = CodeMirror.fromTextArea(aTextarea, {\x0a\x09\x09theme: 'amber',\x0a lineNumbers: true,\x0a enterMode: 'flat',\x0a matchBrackets: true,\x0a electricChars: false\x0a\x09})>",
  691. messageSends: [],
  692. referencedClasses: []
  693. }),
  694. smalltalk.HLCodeWidget);
  695. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, [], 'Helios-Workspace');
  696. smalltalk.addMethod(
  697. "_onKeyDown_",
  698. smalltalk.method({
  699. selector: "onKeyDown:",
  700. category: 'reactions',
  701. fn: function (anEvent){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  704. $1=smalltalk.HLCodeWidget.fn.prototype._onKeyDown_.apply(_st(self), [anEvent]);
  705. if(! smalltalk.assert($1)){
  706. return false;
  707. };
  708. $2=_st(anEvent)._ctrlKey();
  709. if(smalltalk.assert($2)){
  710. $3=_st(_st(anEvent)._keyCode()).__eq((83));
  711. if(smalltalk.assert($3)){
  712. _st(self)._onSave();
  713. _st(anEvent)._preventDefault();
  714. return false;
  715. };
  716. };
  717. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLSourceCodeWidget)})},
  718. args: ["anEvent"],
  719. source: "onKeyDown: anEvent\x0a\x09(super onKeyDown: anEvent) ifFalse: [ ^ false ].\x0a \x0a\x09anEvent ctrlKey ifTrue: [\x0a\x09\x09anEvent keyCode = 83 ifTrue: [\x0a\x09\x09\x09self onSave.\x0a\x09\x09\x09anEvent preventDefault.\x0a\x09\x09\x09^ false ] ]",
  720. messageSends: ["ifFalse:", "onKeyDown:", "ifTrue:", "onSave", "preventDefault", "=", "keyCode", "ctrlKey"],
  721. referencedClasses: []
  722. }),
  723. smalltalk.HLSourceCodeWidget);
  724. smalltalk.addMethod(
  725. "_onSave",
  726. smalltalk.method({
  727. selector: "onSave",
  728. category: 'reactions',
  729. fn: function (){
  730. var self=this;
  731. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSave",{}, smalltalk.HLSourceCodeWidget)})},
  732. args: [],
  733. source: "onSave",
  734. messageSends: [],
  735. referencedClasses: []
  736. }),
  737. smalltalk.HLSourceCodeWidget);
  738. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['model', 'codeWidget'], 'Helios-Workspace');
  739. smalltalk.addMethod(
  740. "_codeWidget",
  741. smalltalk.method({
  742. selector: "codeWidget",
  743. category: 'accessing',
  744. fn: function (){
  745. var self=this;
  746. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$1;
  747. $2=self["@codeWidget"];
  748. if(($receiver = $2) == nil || $receiver == undefined){
  749. $3=_st((smalltalk.HLCodeWidget || HLCodeWidget))._new();
  750. _st($3)._model_(_st(_st(self)._model())._code());
  751. $4=_st($3)._yourself();
  752. self["@codeWidget"]=$4;
  753. $1=self["@codeWidget"];
  754. } else {
  755. $1=$2;
  756. };
  757. return $1;
  758. }, function($ctx1) {$ctx1.fill(self,"codeWidget",{}, smalltalk.HLWorkspace)})},
  759. args: [],
  760. source: "codeWidget\x0a\x09^ codeWidget ifNil: [\x0a\x09\x09codeWidget := HLCodeWidget new\x0a \x09\x09model: self model code;\x0a \x09yourself ]",
  761. messageSends: ["ifNil:", "model:", "code", "model", "new", "yourself"],
  762. referencedClasses: ["HLCodeWidget"]
  763. }),
  764. smalltalk.HLWorkspace);
  765. smalltalk.addMethod(
  766. "_model",
  767. smalltalk.method({
  768. selector: "model",
  769. category: 'accessing',
  770. fn: function (){
  771. var self=this;
  772. return smalltalk.withContext(function($ctx1) { var $2,$1;
  773. $2=self["@model"];
  774. if(($receiver = $2) == nil || $receiver == undefined){
  775. _st(self)._model_(_st((smalltalk.HLWorkspaceModel || HLWorkspaceModel))._new());
  776. $1=self["@model"];
  777. } else {
  778. $1=$2;
  779. };
  780. return $1;
  781. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLWorkspace)})},
  782. args: [],
  783. source: "model\x0a\x09^ model ifNil: [ \x0a \x09self model: HLWorkspaceModel new.\x0a\x09\x09model ]",
  784. messageSends: ["ifNil:", "model:", "new"],
  785. referencedClasses: ["HLWorkspaceModel"]
  786. }),
  787. smalltalk.HLWorkspace);
  788. smalltalk.addMethod(
  789. "_model_",
  790. smalltalk.method({
  791. selector: "model:",
  792. category: 'accessing',
  793. fn: function (aModel){
  794. var self=this;
  795. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  796. _st(_st(self)._codeWidget())._model_(_st(aModel)._code());
  797. _st(self)._observeCodeWidget();
  798. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLWorkspace)})},
  799. args: ["aModel"],
  800. source: "model: aModel\x0a\x09model := aModel.\x0a \x0a self codeWidget model: aModel code.\x0a self observeCodeWidget.\x0a ",
  801. messageSends: ["model:", "code", "codeWidget", "observeCodeWidget"],
  802. referencedClasses: []
  803. }),
  804. smalltalk.HLWorkspace);
  805. smalltalk.addMethod(
  806. "_observeCodeWidget",
  807. smalltalk.method({
  808. selector: "observeCodeWidget",
  809. category: 'actions',
  810. fn: function (){
  811. var self=this;
  812. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"observeCodeWidget",{}, smalltalk.HLWorkspace)})},
  813. args: [],
  814. source: "observeCodeWidget\x0a\x0a",
  815. messageSends: [],
  816. referencedClasses: []
  817. }),
  818. smalltalk.HLWorkspace);
  819. smalltalk.addMethod(
  820. "_onDoIt",
  821. smalltalk.method({
  822. selector: "onDoIt",
  823. category: 'reactions',
  824. fn: function (){
  825. var self=this;
  826. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLWorkspace)})},
  827. args: [],
  828. source: "onDoIt",
  829. messageSends: [],
  830. referencedClasses: []
  831. }),
  832. smalltalk.HLWorkspace);
  833. smalltalk.addMethod(
  834. "_onInspectIt",
  835. smalltalk.method({
  836. selector: "onInspectIt",
  837. category: 'reactions',
  838. fn: function (){
  839. var self=this;
  840. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLWorkspace)})},
  841. args: [],
  842. source: "onInspectIt",
  843. messageSends: [],
  844. referencedClasses: []
  845. }),
  846. smalltalk.HLWorkspace);
  847. smalltalk.addMethod(
  848. "_onPrintIt",
  849. smalltalk.method({
  850. selector: "onPrintIt",
  851. category: 'reactions',
  852. fn: function (){
  853. var self=this;
  854. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLWorkspace)})},
  855. args: [],
  856. source: "onPrintIt",
  857. messageSends: [],
  858. referencedClasses: []
  859. }),
  860. smalltalk.HLWorkspace);
  861. smalltalk.addMethod(
  862. "_renderContentOn_",
  863. smalltalk.method({
  864. selector: "renderContentOn:",
  865. category: 'rendering',
  866. fn: function (html){
  867. var self=this;
  868. return smalltalk.withContext(function($ctx1) { _st(html)._with_(_st(self)._codeWidget());
  869. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLWorkspace)})},
  870. args: ["html"],
  871. source: "renderContentOn: html\x0a\x09html with: self codeWidget\x0a ",
  872. messageSends: ["with:", "codeWidget"],
  873. referencedClasses: []
  874. }),
  875. smalltalk.HLWorkspace);
  876. smalltalk.addMethod(
  877. "_canBeOpenAsTab",
  878. smalltalk.method({
  879. selector: "canBeOpenAsTab",
  880. category: 'testing',
  881. fn: function (){
  882. var self=this;
  883. return smalltalk.withContext(function($ctx1) { return true;
  884. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLWorkspace.klass)})},
  885. args: [],
  886. source: "canBeOpenAsTab\x0a\x09^ true",
  887. messageSends: [],
  888. referencedClasses: []
  889. }),
  890. smalltalk.HLWorkspace.klass);
  891. smalltalk.addMethod(
  892. "_tabLabel",
  893. smalltalk.method({
  894. selector: "tabLabel",
  895. category: 'accessing',
  896. fn: function (){
  897. var self=this;
  898. return smalltalk.withContext(function($ctx1) { return "Workspace";
  899. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLWorkspace.klass)})},
  900. args: [],
  901. source: "tabLabel\x0a\x09^ 'Workspace'",
  902. messageSends: [],
  903. referencedClasses: []
  904. }),
  905. smalltalk.HLWorkspace.klass);
  906. smalltalk.addMethod(
  907. "_tabPriority",
  908. smalltalk.method({
  909. selector: "tabPriority",
  910. category: 'accessing',
  911. fn: function (){
  912. var self=this;
  913. return smalltalk.withContext(function($ctx1) { return (10);
  914. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLWorkspace.klass)})},
  915. args: [],
  916. source: "tabPriority\x0a\x09^ 10",
  917. messageSends: [],
  918. referencedClasses: []
  919. }),
  920. smalltalk.HLWorkspace.klass);
  921. smalltalk.addClass('HLWorkspaceModel', smalltalk.Object, ['announcer', 'environment', 'code'], 'Helios-Workspace');
  922. smalltalk.addMethod(
  923. "_announcer",
  924. smalltalk.method({
  925. selector: "announcer",
  926. category: 'accessing',
  927. fn: function (){
  928. var self=this;
  929. return smalltalk.withContext(function($ctx1) { var $2,$1;
  930. $2=self["@announcer"];
  931. if(($receiver = $2) == nil || $receiver == undefined){
  932. self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
  933. $1=self["@announcer"];
  934. } else {
  935. $1=$2;
  936. };
  937. return $1;
  938. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLWorkspaceModel)})},
  939. args: [],
  940. source: "announcer\x0a\x09^ announcer ifNil: [ announcer := Announcer new ]",
  941. messageSends: ["ifNil:", "new"],
  942. referencedClasses: ["Announcer"]
  943. }),
  944. smalltalk.HLWorkspaceModel);
  945. smalltalk.addMethod(
  946. "_code",
  947. smalltalk.method({
  948. selector: "code",
  949. category: 'accessing',
  950. fn: function (){
  951. var self=this;
  952. return smalltalk.withContext(function($ctx1) { var $2,$1;
  953. $2=self["@code"];
  954. if(($receiver = $2) == nil || $receiver == undefined){
  955. $1=_st((smalltalk.HLCodeModel || HLCodeModel))._on_(_st(self)._environment());
  956. } else {
  957. $1=$2;
  958. };
  959. return $1;
  960. }, function($ctx1) {$ctx1.fill(self,"code",{}, smalltalk.HLWorkspaceModel)})},
  961. args: [],
  962. source: "code\x0a\x09\x22Answers the code model working for this workspace model\x22\x0a\x09^ code ifNil:[ HLCodeModel on: self environment ]",
  963. messageSends: ["ifNil:", "on:", "environment"],
  964. referencedClasses: ["HLCodeModel"]
  965. }),
  966. smalltalk.HLWorkspaceModel);
  967. smalltalk.addMethod(
  968. "_environment",
  969. smalltalk.method({
  970. selector: "environment",
  971. category: 'accessing',
  972. fn: function (){
  973. var self=this;
  974. return smalltalk.withContext(function($ctx1) { var $2,$1;
  975. $2=self["@environment"];
  976. if(($receiver = $2) == nil || $receiver == undefined){
  977. $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
  978. } else {
  979. $1=$2;
  980. };
  981. return $1;
  982. }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLWorkspaceModel)})},
  983. args: [],
  984. source: "environment\x0a\x09^ environment ifNil: [ HLManager current environment ]",
  985. messageSends: ["ifNil:", "environment", "current"],
  986. referencedClasses: ["HLManager"]
  987. }),
  988. smalltalk.HLWorkspaceModel);
  989. smalltalk.addMethod(
  990. "_environment_",
  991. smalltalk.method({
  992. selector: "environment:",
  993. category: 'accessing',
  994. fn: function (anEnvironment){
  995. var self=this;
  996. return smalltalk.withContext(function($ctx1) { self["@environment"]=anEnvironment;
  997. return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel)})},
  998. args: ["anEnvironment"],
  999. source: "environment: anEnvironment\x0a\x09environment := anEnvironment",
  1000. messageSends: [],
  1001. referencedClasses: []
  1002. }),
  1003. smalltalk.HLWorkspaceModel);
  1004. smalltalk.addMethod(
  1005. "_onKeyDown_",
  1006. smalltalk.method({
  1007. selector: "onKeyDown:",
  1008. category: 'reactions',
  1009. fn: function (anEvent){
  1010. var self=this;
  1011. return smalltalk.withContext(function($ctx1) { if(anEvent.ctrlKey) {
  1012. if(anEvent.keyCode === 80) { //ctrl+p
  1013. self._printIt();
  1014. anEvent.preventDefault();
  1015. return false;
  1016. }
  1017. if(anEvent.keyCode === 68) { //ctrl+d
  1018. self._doIt();
  1019. anEvent.preventDefault();
  1020. return false;
  1021. }
  1022. if(anEvent.keyCode === 73) { //ctrl+i
  1023. self._inspectIt();
  1024. anEvent.preventDefault();
  1025. return false;
  1026. }
  1027. };
  1028. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLWorkspaceModel)})},
  1029. args: ["anEvent"],
  1030. source: "onKeyDown: anEvent\x0a\x0a\x09<if(anEvent.ctrlKey) {\x0a\x09\x09if(anEvent.keyCode === 80) { //ctrl+p\x0a\x09\x09\x09self._printIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09if(anEvent.keyCode === 68) { //ctrl+d\x0a\x09\x09\x09self._doIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09\x09if(anEvent.keyCode === 73) { //ctrl+i\x0a\x09\x09\x09self._inspectIt();\x0a\x09\x09\x09anEvent.preventDefault();\x0a\x09\x09\x09return false;\x0a\x09\x09}\x0a\x09}>",
  1031. messageSends: [],
  1032. referencedClasses: []
  1033. }),
  1034. smalltalk.HLWorkspaceModel);
  1035. smalltalk.addMethod(
  1036. "_on_",
  1037. smalltalk.method({
  1038. selector: "on:",
  1039. category: 'actions',
  1040. fn: function (anEnvironment){
  1041. var self=this;
  1042. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1043. $2=_st(self)._new();
  1044. _st($2)._environment_(anEnvironment);
  1045. $3=_st($2)._yourself();
  1046. $1=$3;
  1047. return $1;
  1048. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel.klass)})},
  1049. args: ["anEnvironment"],
  1050. source: "on: anEnvironment\x0a\x0a\x09^ self new\x0a \x09environment: anEnvironment;\x0a yourself",
  1051. messageSends: ["environment:", "new", "yourself"],
  1052. referencedClasses: []
  1053. }),
  1054. smalltalk.HLWorkspaceModel.klass);