Helios-Workspace.js 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155
  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. indentWithTabs: true,
  687. electricChars: false
  688. });
  689. return self}, function($ctx1) {$ctx1.fill(self,"setEditorOn:",{aTextarea:aTextarea}, smalltalk.HLCodeWidget)})},
  690. args: ["aTextarea"],
  691. source: "setEditorOn: aTextarea\x0a\x09<self['@editor'] = CodeMirror.fromTextArea(aTextarea, {\x0a\x09\x09theme: 'amber',\x0a lineNumbers: true,\x0a enterMode: 'flat',\x0a matchBrackets: true,\x0a indentWithTabs: true,\x0a electricChars: false\x0a\x09})>",
  692. messageSends: [],
  693. referencedClasses: []
  694. }),
  695. smalltalk.HLCodeWidget);
  696. smalltalk.addMethod(
  697. "_initialize",
  698. smalltalk.method({
  699. selector: "initialize",
  700. category: 'initialization',
  701. fn: function (){
  702. var self=this;
  703. return smalltalk.withContext(function($ctx1) { smalltalk.HLWidget.klass.fn.prototype._initialize.apply(_st(self), []);
  704. _st(self)._setupCodeMirror();
  705. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.HLCodeWidget.klass)})},
  706. args: [],
  707. source: "initialize\x0a\x09super initialize.\x0a\x09self setupCodeMirror",
  708. messageSends: ["initialize", "setupCodeMirror"],
  709. referencedClasses: []
  710. }),
  711. smalltalk.HLCodeWidget.klass);
  712. smalltalk.addMethod(
  713. "_setupCodeMirror",
  714. smalltalk.method({
  715. selector: "setupCodeMirror",
  716. category: 'initialization',
  717. fn: function (){
  718. var self=this;
  719. return smalltalk.withContext(function($ctx1) { CodeMirror.keyMap.default.fallthrough = ["basic"] ;
  720. return self}, function($ctx1) {$ctx1.fill(self,"setupCodeMirror",{}, smalltalk.HLCodeWidget.klass)})},
  721. args: [],
  722. source: "setupCodeMirror\x0a\x09< CodeMirror.keyMap.default.fallthrough = [\x22basic\x22] >",
  723. messageSends: [],
  724. referencedClasses: []
  725. }),
  726. smalltalk.HLCodeWidget.klass);
  727. smalltalk.addClass('HLSourceCodeWidget', smalltalk.HLCodeWidget, [], 'Helios-Workspace');
  728. smalltalk.addMethod(
  729. "_onKeyDown_",
  730. smalltalk.method({
  731. selector: "onKeyDown:",
  732. category: 'reactions',
  733. fn: function (anEvent){
  734. var self=this;
  735. return smalltalk.withContext(function($ctx1) { var $1,$2,$3;
  736. $1=smalltalk.HLCodeWidget.fn.prototype._onKeyDown_.apply(_st(self), [anEvent]);
  737. if(! smalltalk.assert($1)){
  738. return false;
  739. };
  740. $2=_st(anEvent)._ctrlKey();
  741. if(smalltalk.assert($2)){
  742. $3=_st(_st(anEvent)._keyCode()).__eq((83));
  743. if(smalltalk.assert($3)){
  744. _st(self)._onSave();
  745. _st(anEvent)._preventDefault();
  746. return false;
  747. };
  748. };
  749. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLSourceCodeWidget)})},
  750. args: ["anEvent"],
  751. 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 ] ]",
  752. messageSends: ["ifFalse:", "onKeyDown:", "ifTrue:", "onSave", "preventDefault", "=", "keyCode", "ctrlKey"],
  753. referencedClasses: []
  754. }),
  755. smalltalk.HLSourceCodeWidget);
  756. smalltalk.addMethod(
  757. "_onSave",
  758. smalltalk.method({
  759. selector: "onSave",
  760. category: 'reactions',
  761. fn: function (){
  762. var self=this;
  763. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onSave",{}, smalltalk.HLSourceCodeWidget)})},
  764. args: [],
  765. source: "onSave",
  766. messageSends: [],
  767. referencedClasses: []
  768. }),
  769. smalltalk.HLSourceCodeWidget);
  770. smalltalk.addClass('HLWorkspace', smalltalk.HLWidget, ['model', 'codeWidget'], 'Helios-Workspace');
  771. smalltalk.addMethod(
  772. "_codeWidget",
  773. smalltalk.method({
  774. selector: "codeWidget",
  775. category: 'accessing',
  776. fn: function (){
  777. var self=this;
  778. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$1;
  779. $2=self["@codeWidget"];
  780. if(($receiver = $2) == nil || $receiver == undefined){
  781. $3=_st((smalltalk.HLCodeWidget || HLCodeWidget))._new();
  782. _st($3)._model_(_st(_st(self)._model())._code());
  783. $4=_st($3)._yourself();
  784. self["@codeWidget"]=$4;
  785. $1=self["@codeWidget"];
  786. } else {
  787. $1=$2;
  788. };
  789. return $1;
  790. }, function($ctx1) {$ctx1.fill(self,"codeWidget",{}, smalltalk.HLWorkspace)})},
  791. args: [],
  792. source: "codeWidget\x0a\x09^ codeWidget ifNil: [\x0a\x09\x09codeWidget := HLCodeWidget new\x0a \x09\x09model: self model code;\x0a \x09yourself ]",
  793. messageSends: ["ifNil:", "model:", "code", "model", "new", "yourself"],
  794. referencedClasses: ["HLCodeWidget"]
  795. }),
  796. smalltalk.HLWorkspace);
  797. smalltalk.addMethod(
  798. "_model",
  799. smalltalk.method({
  800. selector: "model",
  801. category: 'accessing',
  802. fn: function (){
  803. var self=this;
  804. return smalltalk.withContext(function($ctx1) { var $2,$1;
  805. $2=self["@model"];
  806. if(($receiver = $2) == nil || $receiver == undefined){
  807. _st(self)._model_(_st((smalltalk.HLWorkspaceModel || HLWorkspaceModel))._new());
  808. $1=self["@model"];
  809. } else {
  810. $1=$2;
  811. };
  812. return $1;
  813. }, function($ctx1) {$ctx1.fill(self,"model",{}, smalltalk.HLWorkspace)})},
  814. args: [],
  815. source: "model\x0a\x09^ model ifNil: [ \x0a \x09self model: HLWorkspaceModel new.\x0a\x09\x09model ]",
  816. messageSends: ["ifNil:", "model:", "new"],
  817. referencedClasses: ["HLWorkspaceModel"]
  818. }),
  819. smalltalk.HLWorkspace);
  820. smalltalk.addMethod(
  821. "_model_",
  822. smalltalk.method({
  823. selector: "model:",
  824. category: 'accessing',
  825. fn: function (aModel){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) { self["@model"]=aModel;
  828. _st(_st(self)._codeWidget())._model_(_st(aModel)._code());
  829. _st(self)._observeCodeWidget();
  830. return self}, function($ctx1) {$ctx1.fill(self,"model:",{aModel:aModel}, smalltalk.HLWorkspace)})},
  831. args: ["aModel"],
  832. source: "model: aModel\x0a\x09model := aModel.\x0a \x0a self codeWidget model: aModel code.\x0a self observeCodeWidget.\x0a ",
  833. messageSends: ["model:", "code", "codeWidget", "observeCodeWidget"],
  834. referencedClasses: []
  835. }),
  836. smalltalk.HLWorkspace);
  837. smalltalk.addMethod(
  838. "_observeCodeWidget",
  839. smalltalk.method({
  840. selector: "observeCodeWidget",
  841. category: 'actions',
  842. fn: function (){
  843. var self=this;
  844. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"observeCodeWidget",{}, smalltalk.HLWorkspace)})},
  845. args: [],
  846. source: "observeCodeWidget\x0a\x0a",
  847. messageSends: [],
  848. referencedClasses: []
  849. }),
  850. smalltalk.HLWorkspace);
  851. smalltalk.addMethod(
  852. "_onDoIt",
  853. smalltalk.method({
  854. selector: "onDoIt",
  855. category: 'reactions',
  856. fn: function (){
  857. var self=this;
  858. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onDoIt",{}, smalltalk.HLWorkspace)})},
  859. args: [],
  860. source: "onDoIt",
  861. messageSends: [],
  862. referencedClasses: []
  863. }),
  864. smalltalk.HLWorkspace);
  865. smalltalk.addMethod(
  866. "_onInspectIt",
  867. smalltalk.method({
  868. selector: "onInspectIt",
  869. category: 'reactions',
  870. fn: function (){
  871. var self=this;
  872. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onInspectIt",{}, smalltalk.HLWorkspace)})},
  873. args: [],
  874. source: "onInspectIt",
  875. messageSends: [],
  876. referencedClasses: []
  877. }),
  878. smalltalk.HLWorkspace);
  879. smalltalk.addMethod(
  880. "_onPrintIt",
  881. smalltalk.method({
  882. selector: "onPrintIt",
  883. category: 'reactions',
  884. fn: function (){
  885. var self=this;
  886. return smalltalk.withContext(function($ctx1) { return self}, function($ctx1) {$ctx1.fill(self,"onPrintIt",{}, smalltalk.HLWorkspace)})},
  887. args: [],
  888. source: "onPrintIt",
  889. messageSends: [],
  890. referencedClasses: []
  891. }),
  892. smalltalk.HLWorkspace);
  893. smalltalk.addMethod(
  894. "_renderContentOn_",
  895. smalltalk.method({
  896. selector: "renderContentOn:",
  897. category: 'rendering',
  898. fn: function (html){
  899. var self=this;
  900. return smalltalk.withContext(function($ctx1) { _st(html)._with_(_st(self)._codeWidget());
  901. return self}, function($ctx1) {$ctx1.fill(self,"renderContentOn:",{html:html}, smalltalk.HLWorkspace)})},
  902. args: ["html"],
  903. source: "renderContentOn: html\x0a\x09html with: self codeWidget\x0a ",
  904. messageSends: ["with:", "codeWidget"],
  905. referencedClasses: []
  906. }),
  907. smalltalk.HLWorkspace);
  908. smalltalk.addMethod(
  909. "_canBeOpenAsTab",
  910. smalltalk.method({
  911. selector: "canBeOpenAsTab",
  912. category: 'testing',
  913. fn: function (){
  914. var self=this;
  915. return smalltalk.withContext(function($ctx1) { return true;
  916. }, function($ctx1) {$ctx1.fill(self,"canBeOpenAsTab",{}, smalltalk.HLWorkspace.klass)})},
  917. args: [],
  918. source: "canBeOpenAsTab\x0a\x09^ true",
  919. messageSends: [],
  920. referencedClasses: []
  921. }),
  922. smalltalk.HLWorkspace.klass);
  923. smalltalk.addMethod(
  924. "_tabLabel",
  925. smalltalk.method({
  926. selector: "tabLabel",
  927. category: 'accessing',
  928. fn: function (){
  929. var self=this;
  930. return smalltalk.withContext(function($ctx1) { return "Workspace";
  931. }, function($ctx1) {$ctx1.fill(self,"tabLabel",{}, smalltalk.HLWorkspace.klass)})},
  932. args: [],
  933. source: "tabLabel\x0a\x09^ 'Workspace'",
  934. messageSends: [],
  935. referencedClasses: []
  936. }),
  937. smalltalk.HLWorkspace.klass);
  938. smalltalk.addMethod(
  939. "_tabPriority",
  940. smalltalk.method({
  941. selector: "tabPriority",
  942. category: 'accessing',
  943. fn: function (){
  944. var self=this;
  945. return smalltalk.withContext(function($ctx1) { return (10);
  946. }, function($ctx1) {$ctx1.fill(self,"tabPriority",{}, smalltalk.HLWorkspace.klass)})},
  947. args: [],
  948. source: "tabPriority\x0a\x09^ 10",
  949. messageSends: [],
  950. referencedClasses: []
  951. }),
  952. smalltalk.HLWorkspace.klass);
  953. smalltalk.addClass('HLWorkspaceModel', smalltalk.Object, ['announcer', 'environment', 'code'], 'Helios-Workspace');
  954. smalltalk.addMethod(
  955. "_announcer",
  956. smalltalk.method({
  957. selector: "announcer",
  958. category: 'accessing',
  959. fn: function (){
  960. var self=this;
  961. return smalltalk.withContext(function($ctx1) { var $2,$1;
  962. $2=self["@announcer"];
  963. if(($receiver = $2) == nil || $receiver == undefined){
  964. self["@announcer"]=_st((smalltalk.Announcer || Announcer))._new();
  965. $1=self["@announcer"];
  966. } else {
  967. $1=$2;
  968. };
  969. return $1;
  970. }, function($ctx1) {$ctx1.fill(self,"announcer",{}, smalltalk.HLWorkspaceModel)})},
  971. args: [],
  972. source: "announcer\x0a\x09^ announcer ifNil: [ announcer := Announcer new ]",
  973. messageSends: ["ifNil:", "new"],
  974. referencedClasses: ["Announcer"]
  975. }),
  976. smalltalk.HLWorkspaceModel);
  977. smalltalk.addMethod(
  978. "_code",
  979. smalltalk.method({
  980. selector: "code",
  981. category: 'accessing',
  982. fn: function (){
  983. var self=this;
  984. return smalltalk.withContext(function($ctx1) { var $2,$1;
  985. $2=self["@code"];
  986. if(($receiver = $2) == nil || $receiver == undefined){
  987. $1=_st((smalltalk.HLCodeModel || HLCodeModel))._on_(_st(self)._environment());
  988. } else {
  989. $1=$2;
  990. };
  991. return $1;
  992. }, function($ctx1) {$ctx1.fill(self,"code",{}, smalltalk.HLWorkspaceModel)})},
  993. args: [],
  994. source: "code\x0a\x09\x22Answers the code model working for this workspace model\x22\x0a\x09^ code ifNil:[ HLCodeModel on: self environment ]",
  995. messageSends: ["ifNil:", "on:", "environment"],
  996. referencedClasses: ["HLCodeModel"]
  997. }),
  998. smalltalk.HLWorkspaceModel);
  999. smalltalk.addMethod(
  1000. "_environment",
  1001. smalltalk.method({
  1002. selector: "environment",
  1003. category: 'accessing',
  1004. fn: function (){
  1005. var self=this;
  1006. return smalltalk.withContext(function($ctx1) { var $2,$1;
  1007. $2=self["@environment"];
  1008. if(($receiver = $2) == nil || $receiver == undefined){
  1009. $1=_st(_st((smalltalk.HLManager || HLManager))._current())._environment();
  1010. } else {
  1011. $1=$2;
  1012. };
  1013. return $1;
  1014. }, function($ctx1) {$ctx1.fill(self,"environment",{}, smalltalk.HLWorkspaceModel)})},
  1015. args: [],
  1016. source: "environment\x0a\x09^ environment ifNil: [ HLManager current environment ]",
  1017. messageSends: ["ifNil:", "environment", "current"],
  1018. referencedClasses: ["HLManager"]
  1019. }),
  1020. smalltalk.HLWorkspaceModel);
  1021. smalltalk.addMethod(
  1022. "_environment_",
  1023. smalltalk.method({
  1024. selector: "environment:",
  1025. category: 'accessing',
  1026. fn: function (anEnvironment){
  1027. var self=this;
  1028. return smalltalk.withContext(function($ctx1) { self["@environment"]=anEnvironment;
  1029. return self}, function($ctx1) {$ctx1.fill(self,"environment:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel)})},
  1030. args: ["anEnvironment"],
  1031. source: "environment: anEnvironment\x0a\x09environment := anEnvironment",
  1032. messageSends: [],
  1033. referencedClasses: []
  1034. }),
  1035. smalltalk.HLWorkspaceModel);
  1036. smalltalk.addMethod(
  1037. "_onKeyDown_",
  1038. smalltalk.method({
  1039. selector: "onKeyDown:",
  1040. category: 'reactions',
  1041. fn: function (anEvent){
  1042. var self=this;
  1043. return smalltalk.withContext(function($ctx1) { if(anEvent.ctrlKey) {
  1044. if(anEvent.keyCode === 80) { //ctrl+p
  1045. self._printIt();
  1046. anEvent.preventDefault();
  1047. return false;
  1048. }
  1049. if(anEvent.keyCode === 68) { //ctrl+d
  1050. self._doIt();
  1051. anEvent.preventDefault();
  1052. return false;
  1053. }
  1054. if(anEvent.keyCode === 73) { //ctrl+i
  1055. self._inspectIt();
  1056. anEvent.preventDefault();
  1057. return false;
  1058. }
  1059. };
  1060. return self}, function($ctx1) {$ctx1.fill(self,"onKeyDown:",{anEvent:anEvent}, smalltalk.HLWorkspaceModel)})},
  1061. args: ["anEvent"],
  1062. 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}>",
  1063. messageSends: [],
  1064. referencedClasses: []
  1065. }),
  1066. smalltalk.HLWorkspaceModel);
  1067. smalltalk.addMethod(
  1068. "_on_",
  1069. smalltalk.method({
  1070. selector: "on:",
  1071. category: 'actions',
  1072. fn: function (anEnvironment){
  1073. var self=this;
  1074. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1075. $2=_st(self)._new();
  1076. _st($2)._environment_(anEnvironment);
  1077. $3=_st($2)._yourself();
  1078. $1=$3;
  1079. return $1;
  1080. }, function($ctx1) {$ctx1.fill(self,"on:",{anEnvironment:anEnvironment}, smalltalk.HLWorkspaceModel.klass)})},
  1081. args: ["anEnvironment"],
  1082. source: "on: anEnvironment\x0a\x0a\x09^ self new\x0a \x09environment: anEnvironment;\x0a yourself",
  1083. messageSends: ["environment:", "new", "yourself"],
  1084. referencedClasses: []
  1085. }),
  1086. smalltalk.HLWorkspaceModel.klass);