Helios-Workspace.js 37 KB

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