Helios-Workspace.js 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116
  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;
  504. return smalltalk.withContext(function($ctx1) { start=_st((smalltalk.HashedCollection || HashedCollection))._new();
  505. stop=_st((smalltalk.HashedCollection || HashedCollection))._new();
  506. _st(start)._at_put_("line",_st(_st(self["@editor"])._getCursor_(false))._line());
  507. _st(start)._at_put_("ch",_st(_st(self["@editor"])._getCursor_(false))._ch());
  508. _st(stop)._at_put_("line",_st(start)._at_("line"));
  509. _st(stop)._at_put_("ch",_st(_st(_st(start)._at_("ch")).__plus(_st(aString)._size())).__plus((2)));
  510. _st(self["@editor"])._replaceSelection_(_st(_st(_st(_st(self["@editor"])._getSelection()).__comma(" ")).__comma(aString)).__comma(" "));
  511. _st(self["@editor"])._setCursor_(_st(self["@editor"])._getCursor_(true));
  512. _st(self["@editor"])._setSelection_end_(stop,start);
  513. return self}, function($ctx1) {$ctx1.fill(self,"print:",{aString:aString,start:start,stop:stop}, smalltalk.HLCodeWidget)})},
  514. args: ["aString"],
  515. source: "print: aString\x0a\x09| start stop |\x0a\x09start := HashedCollection new.\x0a\x09stop := HashedCollection new.\x0a\x09start at: 'line' put: (editor getCursor: false) line.\x0a\x09start at: 'ch' put: (editor getCursor: false) ch.\x0a\x09stop at: 'line' put: (start at: 'line').\x0a\x09stop at: 'ch' put: ((start at: 'ch') + aString size + 2).\x0a\x09editor replaceSelection: (editor getSelection, ' ', aString, ' ').\x0a\x09editor setCursor: (editor getCursor: true).\x0a\x09editor setSelection: stop end: start",
  516. messageSends: ["new", "at:put:", "line", "getCursor:", "ch", "at:", "+", "size", "replaceSelection:", ",", "getSelection", "setCursor:", "setSelection:end:"],
  517. referencedClasses: ["HashedCollection"]
  518. }),
  519. smalltalk.HLCodeWidget);
  520. smalltalk.addMethod(
  521. "_printIt",
  522. smalltalk.method({
  523. selector: "printIt",
  524. category: 'actions',
  525. fn: function (){
  526. var self=this;
  527. var result;
  528. return smalltalk.withContext(function($ctx1) { result=_st(self)._doIt();
  529. _st(_st(self)._announcer())._announce_(_st((smalltalk.HLPrintItRequested || HLPrintItRequested))._on_(self["@model"]));
  530. _st(self)._print_(_st(result)._printString());
  531. _st(self)._focus();
  532. return self}, function($ctx1) {$ctx1.fill(self,"printIt",{result:result}, smalltalk.HLCodeWidget)})},
  533. args: [],
  534. 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.",
  535. messageSends: ["doIt", "announce:", "on:", "announcer", "print:", "printString", "focus"],
  536. referencedClasses: ["HLPrintItRequested"]
  537. }),
  538. smalltalk.HLCodeWidget);
  539. smalltalk.addMethod(
  540. "_receiver",
  541. smalltalk.method({
  542. selector: "receiver",
  543. category: 'accessing',
  544. fn: function (){
  545. var self=this;
  546. return smalltalk.withContext(function($ctx1) { var $1;
  547. $1=_st(_st(self)._model())._receiver();
  548. return $1;
  549. }, function($ctx1) {$ctx1.fill(self,"receiver",{}, smalltalk.HLCodeWidget)})},
  550. args: [],
  551. source: "receiver\x0a\x09^ self model receiver",
  552. messageSends: ["receiver", "model"],
  553. referencedClasses: []
  554. }),
  555. smalltalk.HLCodeWidget);
  556. smalltalk.addMethod(
  557. "_receiver_",
  558. smalltalk.method({
  559. selector: "receiver:",
  560. category: 'accessing',
  561. fn: function (anObject){
  562. var self=this;
  563. return smalltalk.withContext(function($ctx1) { _st(_st(self)._model())._receiver_(anObject);
  564. return self}, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject}, smalltalk.HLCodeWidget)})},
  565. args: ["anObject"],
  566. source: "receiver: anObject\x0a\x09self model receiver: anObject",
  567. messageSends: ["receiver:", "model"],
  568. referencedClasses: []
  569. }),
  570. smalltalk.HLCodeWidget);
  571. smalltalk.addMethod(
  572. "_renderContentOn_",
  573. smalltalk.method({
  574. selector: "renderContentOn:",
  575. category: 'rendering',
  576. fn: function (html){
  577. var self=this;
  578. return smalltalk.withContext(function($ctx1) { self["@code"]=_st(html)._textarea();
  579. _st(self)._setEditorOn_(_st(self["@code"])._element());
  580. _st(self)._observeWrapper();
  581. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLCodeWidget)})},
  582. args: ["html"],
  583. source: "renderContentOn: html\x0a code := html textarea.\x0a self setEditorOn: code element.\x0a \x0a self observeWrapper",
  584. messageSends: ["textarea", "setEditorOn:", "element", "observeWrapper"],
  585. referencedClasses: []
  586. }),
  587. smalltalk.HLCodeWidget);
  588. smalltalk.addMethod(
  589. "_selection",
  590. smalltalk.method({
  591. selector: "selection",
  592. category: 'accessing',
  593. fn: function (){
  594. var self=this;
  595. return smalltalk.withContext(function($ctx1) { var $1;
  596. $1=_st(self["@editor"])._getSelection();
  597. return $1;
  598. }, function($ctx1) {$ctx1.fill(self,"selection",{}, smalltalk.HLCodeWidget)})},
  599. args: [],
  600. source: "selection\x0a\x09^editor getSelection",
  601. messageSends: ["getSelection"],
  602. referencedClasses: []
  603. }),
  604. smalltalk.HLCodeWidget);
  605. smalltalk.addMethod(
  606. "_selectionEnd",
  607. smalltalk.method({
  608. selector: "selectionEnd",
  609. category: 'accessing',
  610. fn: function (){
  611. var self=this;
  612. return smalltalk.withContext(function($ctx1) { var $1;
  613. $1=_st(_st(self["@code"])._element())._selectionEnd();
  614. return $1;
  615. }, function($ctx1) {$ctx1.fill(self,"selectionEnd",{}, smalltalk.HLCodeWidget)})},
  616. args: [],
  617. source: "selectionEnd\x0a ^code element selectionEnd",
  618. messageSends: ["selectionEnd", "element"],
  619. referencedClasses: []
  620. }),
  621. smalltalk.HLCodeWidget);
  622. smalltalk.addMethod(
  623. "_selectionEnd_",
  624. smalltalk.method({
  625. selector: "selectionEnd:",
  626. category: 'accessing',
  627. fn: function (anInteger){
  628. var self=this;
  629. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionEnd_(anInteger);
  630. return self}, function($ctx1) {$ctx1.fill(self,"selectionEnd:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  631. args: ["anInteger"],
  632. source: "selectionEnd: anInteger\x0a code element selectionEnd: anInteger",
  633. messageSends: ["selectionEnd:", "element"],
  634. referencedClasses: []
  635. }),
  636. smalltalk.HLCodeWidget);
  637. smalltalk.addMethod(
  638. "_selectionStart",
  639. smalltalk.method({
  640. selector: "selectionStart",
  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())._selectionStart();
  646. return $1;
  647. }, function($ctx1) {$ctx1.fill(self,"selectionStart",{}, smalltalk.HLCodeWidget)})},
  648. args: [],
  649. source: "selectionStart\x0a ^code element selectionStart",
  650. messageSends: ["selectionStart", "element"],
  651. referencedClasses: []
  652. }),
  653. smalltalk.HLCodeWidget);
  654. smalltalk.addMethod(
  655. "_selectionStart_",
  656. smalltalk.method({
  657. selector: "selectionStart:",
  658. category: 'accessing',
  659. fn: function (anInteger){
  660. var self=this;
  661. return smalltalk.withContext(function($ctx1) { _st(_st(self["@code"])._element())._selectionStart_(anInteger);
  662. return self}, function($ctx1) {$ctx1.fill(self,"selectionStart:",{anInteger:anInteger}, smalltalk.HLCodeWidget)})},
  663. args: ["anInteger"],
  664. source: "selectionStart: anInteger\x0a code element selectionStart: anInteger",
  665. messageSends: ["selectionStart:", "element"],
  666. referencedClasses: []
  667. }),
  668. smalltalk.HLCodeWidget);
  669. smalltalk.addMethod(
  670. "_setEditorOn_",
  671. smalltalk.method({
  672. selector: "setEditorOn:",
  673. category: 'actions',
  674. fn: function (aTextarea){
  675. var self=this;
  676. return smalltalk.withContext(function($ctx1) { self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  677. theme: 'amber',
  678. lineNumbers: true,
  679. enterMode: 'flat',
  680. matchBrackets: true,
  681. electricChars: false
  682. });
  683. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea}, smalltalk.HLCodeWidget)})},
  684. args: ["aTextarea"],
  685. 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})>",
  686. messageSends: [],
  687. referencedClasses: []
  688. }),
  689. smalltalk.HLCodeWidget);
  690. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, [], 'Helios-Workspace');
  691. smalltalk.addMethod(
  692. "_onKeyDown_",
  693. smalltalk.method({
  694. selector: "onKeyDown:",
  695. category: 'reactions',
  696. fn: function (anEvent){
  697. var self=this;
  698. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  699. $1=smalltalk.HLCodeWidget.fn.prototype._onKeyDown_.apply(_st(self), [anEvent]);
  700. if(! smalltalk.assert($1)){
  701. return false;
  702. };
  703. $2=_st(anEvent)._ctrlKey();
  704. if(smalltalk.assert($2)){
  705. $3=_st(_st(anEvent)._keyCode()).__eq((83));
  706. if(smalltalk.assert($3)){
  707. _st(self)._onSave();
  708. _st(anEvent)._preventDefault();
  709. return false;
  710. };
  711. };
  712. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLSourceCodeWidget)})},
  713. args: ["anEvent"],
  714. 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 ] ]",
  715. messageSends: ["ifFalse:", "onKeyDown:", "ifTrue:", "onSave", "preventDefault", "=", "keyCode", "ctrlKey"],
  716. referencedClasses: []
  717. }),
  718. smalltalk.HLSourceCodeWidget);
  719. smalltalk.addMethod(
  720. "_onSave",
  721. smalltalk.method({
  722. selector: "onSave",
  723. category: 'reactions',
  724. fn: function (){
  725. var self=this;
  726. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSave",{}, smalltalk.HLSourceCodeWidget)})},
  727. args: [],
  728. source: "onSave",
  729. messageSends: [],
  730. referencedClasses: []
  731. }),
  732. smalltalk.HLSourceCodeWidget);
  733. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['model', 'codeWidget'], 'Helios-Workspace');
  734. smalltalk.addMethod(
  735. "_codeWidget",
  736. smalltalk.method({
  737. selector: "codeWidget",
  738. category: 'accessing',
  739. fn: function (){
  740. var self=this;
  741. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$1;
  742. $2=self["@codeWidget"];
  743. if(($receiver = $2) == nil || $receiver == undefined){
  744. $3=_st((smalltalk.HLCodeWidget || HLCodeWidget))._new();
  745. _st($3)._model_(_st(_st(self)._model())._code());
  746. $4=_st($3)._yourself();
  747. self["@codeWidget"]=$4;
  748. $1=self["@codeWidget"];
  749. } else {
  750. $1=$2;
  751. };
  752. return $1;
  753. }, function($ctx1) {$ctx1.fill(self,"codeWidget",{}, smalltalk.HLWorkspace)})},
  754. args: [],
  755. source: "codeWidget\x0a\x09^ codeWidget ifNil: [\x0a\x09\x09codeWidget := HLCodeWidget new\x0a \x09\x09model: self model code;\x0a \x09yourself ]",
  756. messageSends: ["ifNil:", "model:", "code", "model", "new", "yourself"],
  757. referencedClasses: ["HLCodeWidget"]
  758. }),
  759. smalltalk.HLWorkspace);
  760. smalltalk.addMethod(
  761. "_model",
  762. smalltalk.method({
  763. selector: "model",
  764. category: 'accessing',
  765. fn: function (){
  766. var self=this;
  767. return smalltalk.withContext(function($ctx1) { var $2,$1;
  768. $2=self["@model"];
  769. if(($receiver = $2) == nil || $receiver == undefined){
  770. _st(self)._model_(_st((smalltalk.HLWorkspaceModel || HLWorkspaceModel))._new());
  771. $1=self["@model"];
  772. } else {
  773. $1=$2;
  774. };
  775. return $1;
  776. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLWorkspace)})},
  777. args: [],
  778. source: "model\x0a\x09^ model ifNil: [ \x0a \x09self model: HLWorkspaceModel new.\x0a\x09\x09model ]",
  779. messageSends: ["ifNil:", "model:", "new"],
  780. referencedClasses: ["HLWorkspaceModel"]
  781. }),
  782. smalltalk.HLWorkspace);
  783. smalltalk.addMethod(
  784. "_model_",
  785. smalltalk.method({
  786. selector: "model:",
  787. category: 'accessing',
  788. fn: function (aModel){
  789. var self=this;
  790. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  791. _st(_st(self)._codeWidget())._model_(_st(aModel)._code());
  792. _st(self)._observeCodeWidget();
  793. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLWorkspace)})},
  794. args: ["aModel"],
  795. source: "model: aModel\x0a\x09model := aModel.\x0a \x0a self codeWidget model: aModel code.\x0a self observeCodeWidget.\x0a ",
  796. messageSends: ["model:", "code", "codeWidget", "observeCodeWidget"],
  797. referencedClasses: []
  798. }),
  799. smalltalk.HLWorkspace);
  800. smalltalk.addMethod(
  801. "_observeCodeWidget",
  802. smalltalk.method({
  803. selector: "observeCodeWidget",
  804. category: 'actions',
  805. fn: function (){
  806. var self=this;
  807. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"observeCodeWidget",{}, smalltalk.HLWorkspace)})},
  808. args: [],
  809. source: "observeCodeWidget\x0a\x0a",
  810. messageSends: [],
  811. referencedClasses: []
  812. }),
  813. smalltalk.HLWorkspace);
  814. smalltalk.addMethod(
  815. "_onDoIt",
  816. smalltalk.method({
  817. selector: "onDoIt",
  818. category: 'reactions',
  819. fn: function (){
  820. var self=this;
  821. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLWorkspace)})},
  822. args: [],
  823. source: "onDoIt",
  824. messageSends: [],
  825. referencedClasses: []
  826. }),
  827. smalltalk.HLWorkspace);
  828. smalltalk.addMethod(
  829. "_onInspectIt",
  830. smalltalk.method({
  831. selector: "onInspectIt",
  832. category: 'reactions',
  833. fn: function (){
  834. var self=this;
  835. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLWorkspace)})},
  836. args: [],
  837. source: "onInspectIt",
  838. messageSends: [],
  839. referencedClasses: []
  840. }),
  841. smalltalk.HLWorkspace);
  842. smalltalk.addMethod(
  843. "_onPrintIt",
  844. smalltalk.method({
  845. selector: "onPrintIt",
  846. category: 'reactions',
  847. fn: function (){
  848. var self=this;
  849. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLWorkspace)})},
  850. args: [],
  851. source: "onPrintIt",
  852. messageSends: [],
  853. referencedClasses: []
  854. }),
  855. smalltalk.HLWorkspace);
  856. smalltalk.addMethod(
  857. "_renderContentOn_",
  858. smalltalk.method({
  859. selector: "renderContentOn:",
  860. category: 'rendering',
  861. fn: function (html){
  862. var self=this;
  863. return smalltalk.withContext(function($ctx1) { _st(html)._with_(_st(self)._codeWidget());
  864. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLWorkspace)})},
  865. args: ["html"],
  866. source: "renderContentOn: html\x0a\x09html with: self codeWidget\x0a ",
  867. messageSends: ["with:", "codeWidget"],
  868. referencedClasses: []
  869. }),
  870. smalltalk.HLWorkspace);
  871. smalltalk.addMethod(
  872. "_canBeOpenAsTab",
  873. smalltalk.method({
  874. selector: "canBeOpenAsTab",
  875. category: 'testing',
  876. fn: function (){
  877. var self=this;
  878. return smalltalk.withContext(function($ctx1) { return true;
  879. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLWorkspace.klass)})},
  880. args: [],
  881. source: "canBeOpenAsTab\x0a\x09^ true",
  882. messageSends: [],
  883. referencedClasses: []
  884. }),
  885. smalltalk.HLWorkspace.klass);
  886. smalltalk.addMethod(
  887. "_tabLabel",
  888. smalltalk.method({
  889. selector: "tabLabel",
  890. category: 'accessing',
  891. fn: function (){
  892. var self=this;
  893. return smalltalk.withContext(function($ctx1) { return "Workspace";
  894. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLWorkspace.klass)})},
  895. args: [],
  896. source: "tabLabel\x0a\x09^ 'Workspace'",
  897. messageSends: [],
  898. referencedClasses: []
  899. }),
  900. smalltalk.HLWorkspace.klass);
  901. smalltalk.addMethod(
  902. "_tabPriority",
  903. smalltalk.method({
  904. selector: "tabPriority",
  905. category: 'accessing',
  906. fn: function (){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) { return (10);
  909. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLWorkspace.klass)})},
  910. args: [],
  911. source: "tabPriority\x0a\x09^ 10",
  912. messageSends: [],
  913. referencedClasses: []
  914. }),
  915. smalltalk.HLWorkspace.klass);
  916. smalltalk.addClass('HLWorkspaceModel', smalltalk.Object, ['announcer', 'environment', 'code'], 'Helios-Workspace');
  917. smalltalk.addMethod(
  918. "_announcer",
  919. smalltalk.method({
  920. selector: "announcer",
  921. category: 'accessing',
  922. fn: function (){
  923. var self=this;
  924. return smalltalk.withContext(function($ctx1) { var $2,$1;
  925. $2=self["@announcer"];
  926. if(($receiver = $2) == nil || $receiver == undefined){
  927. self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
  928. $1=self["@announcer"];
  929. } else {
  930. $1=$2;
  931. };
  932. return $1;
  933. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLWorkspaceModel)})},
  934. args: [],
  935. source: "announcer\x0a\x09^ announcer ifNil: [ announcer := Announcer new ]",
  936. messageSends: ["ifNil:", "new"],
  937. referencedClasses: ["Announcer"]
  938. }),
  939. smalltalk.HLWorkspaceModel);
  940. smalltalk.addMethod(
  941. "_code",
  942. smalltalk.method({
  943. selector: "code",
  944. category: 'accessing',
  945. fn: function (){
  946. var self=this;
  947. return smalltalk.withContext(function($ctx1) { var $2,$1;
  948. $2=self["@code"];
  949. if(($receiver = $2) == nil || $receiver == undefined){
  950. $1=_st((smalltalk.HLCodeModel || HLCodeModel))._on_(_st(self)._environment());
  951. } else {
  952. $1=$2;
  953. };
  954. return $1;
  955. }, function($ctx1) {$ctx1.fill(self,"code",{}, smalltalk.HLWorkspaceModel)})},
  956. args: [],
  957. source: "code\x0a\x09\x22Answers the code model working for this workspace model\x22\x0a\x09^ code ifNil:[ HLCodeModel on: self environment ]",
  958. messageSends: ["ifNil:", "on:", "environment"],
  959. referencedClasses: ["HLCodeModel"]
  960. }),
  961. smalltalk.HLWorkspaceModel);
  962. smalltalk.addMethod(
  963. "_environment",
  964. smalltalk.method({
  965. selector: "environment",
  966. category: 'accessing',
  967. fn: function (){
  968. var self=this;
  969. return smalltalk.withContext(function($ctx1) { var $2,$1;
  970. $2=self["@environment"];
  971. if(($receiver = $2) == nil || $receiver == undefined){
  972. $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
  973. } else {
  974. $1=$2;
  975. };
  976. return $1;
  977. }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLWorkspaceModel)})},
  978. args: [],
  979. source: "environment\x0a\x09^ environment ifNil: [ HLManager current environment ]",
  980. messageSends: ["ifNil:", "environment", "current"],
  981. referencedClasses: ["HLManager"]
  982. }),
  983. smalltalk.HLWorkspaceModel);
  984. smalltalk.addMethod(
  985. "_environment_",
  986. smalltalk.method({
  987. selector: "environment:",
  988. category: 'accessing',
  989. fn: function (anEnvironment){
  990. var self=this;
  991. return smalltalk.withContext(function($ctx1) { self["@environment"]=anEnvironment;
  992. return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel)})},
  993. args: ["anEnvironment"],
  994. source: "environment: anEnvironment\x0a\x09environment := anEnvironment",
  995. messageSends: [],
  996. referencedClasses: []
  997. }),
  998. smalltalk.HLWorkspaceModel);
  999. smalltalk.addMethod(
  1000. "_onKeyDown_",
  1001. smalltalk.method({
  1002. selector: "onKeyDown:",
  1003. category: 'reactions',
  1004. fn: function (anEvent){
  1005. var self=this;
  1006. return smalltalk.withContext(function($ctx1) { if(anEvent.ctrlKey) {
  1007. if(anEvent.keyCode === 80) { //ctrl+p
  1008. self._printIt();
  1009. anEvent.preventDefault();
  1010. return false;
  1011. }
  1012. if(anEvent.keyCode === 68) { //ctrl+d
  1013. self._doIt();
  1014. anEvent.preventDefault();
  1015. return false;
  1016. }
  1017. if(anEvent.keyCode === 73) { //ctrl+i
  1018. self._inspectIt();
  1019. anEvent.preventDefault();
  1020. return false;
  1021. }
  1022. };
  1023. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLWorkspaceModel)})},
  1024. args: ["anEvent"],
  1025. 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}>",
  1026. messageSends: [],
  1027. referencedClasses: []
  1028. }),
  1029. smalltalk.HLWorkspaceModel);
  1030. smalltalk.addMethod(
  1031. "_on_",
  1032. smalltalk.method({
  1033. selector: "on:",
  1034. category: 'actions',
  1035. fn: function (anEnvironment){
  1036. var self=this;
  1037. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1038. $2=_st(self)._new();
  1039. _st($2)._environment_(anEnvironment);
  1040. $3=_st($2)._yourself();
  1041. $1=$3;
  1042. return $1;
  1043. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel.klass)})},
  1044. args: ["anEnvironment"],
  1045. source: "on: anEnvironment\x0a\x0a\x09^ self new\x0a \x09environment: anEnvironment;\x0a yourself",
  1046. messageSends: ["environment:", "new", "yourself"],
  1047. referencedClasses: []
  1048. }),
  1049. smalltalk.HLWorkspaceModel.klass);