1
0

IDE.st 50 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404
  1. Smalltalk current createPackage: 'IDE' properties: #{}!
  2. Widget subclass: #ClassesList
  3. instanceVariableNames: 'browser ul nodes'
  4. package: 'IDE'!
  5. !ClassesList methodsFor: 'accessing'!
  6. browser
  7. ^browser
  8. !
  9. browser: aBrowser
  10. browser := aBrowser
  11. !
  12. category
  13. ^self browser selectedPackage
  14. !
  15. getNodes
  16. | classes children others |
  17. classes := self browser classes.
  18. children := #().
  19. others := #().
  20. classes do: [:each |
  21. (classes includes: each superclass)
  22. ifFalse: [children add: each]
  23. ifTrue: [others add: each]].
  24. ^children collect: [:each |
  25. ClassesListNode on: each browser: self browser classes: others level: 0]
  26. !
  27. nodes
  28. nodes ifNil: [nodes := self getNodes].
  29. ^nodes
  30. !
  31. resetNodes
  32. nodes := nil
  33. ! !
  34. !ClassesList methodsFor: 'rendering'!
  35. renderOn: html
  36. ul := html ul
  37. class: 'jt_column browser classes';
  38. yourself.
  39. self updateNodes
  40. !
  41. updateNodes
  42. ul contents: [:html |
  43. self nodes do: [:each |
  44. each renderOn: html]]
  45. ! !
  46. !ClassesList class methodsFor: 'instance creation'!
  47. on: aBrowser
  48. ^self new
  49. browser: aBrowser;
  50. yourself
  51. ! !
  52. Widget subclass: #ClassesListNode
  53. instanceVariableNames: 'browser theClass level nodes'
  54. package: 'IDE'!
  55. !ClassesListNode methodsFor: ''!
  56. renderOn: html
  57. | li cssClass |
  58. cssClass := ''.
  59. li := html li
  60. onClick: [self browser selectClass: self theClass].
  61. li asJQuery html: self label.
  62. self browser selectedClass = self theClass ifTrue: [
  63. cssClass := cssClass, ' selected'].
  64. self theClass comment isEmpty ifFalse: [
  65. cssClass := cssClass, ' commented'].
  66. li class: cssClass.
  67. self nodes do: [:each |
  68. each renderOn: html]
  69. ! !
  70. !ClassesListNode methodsFor: 'accessing'!
  71. browser
  72. ^browser
  73. !
  74. browser: aBrowser
  75. browser := aBrowser
  76. !
  77. getNodesFrom: aCollection
  78. | children others |
  79. children := #().
  80. others := #().
  81. aCollection do: [:each |
  82. (each superclass = self theClass)
  83. ifTrue: [children add: each]
  84. ifFalse: [others add: each]].
  85. nodes:= children collect: [:each |
  86. ClassesListNode on: each browser: self browser classes: others level: self level + 1]
  87. !
  88. label
  89. | str |
  90. str := String new writeStream.
  91. self level timesRepeat: [
  92. str nextPutAll: '    '].
  93. str nextPutAll: self theClass name.
  94. ^str contents
  95. !
  96. level
  97. ^level
  98. !
  99. level: anInteger
  100. level := anInteger
  101. !
  102. nodes
  103. ^nodes
  104. !
  105. theClass
  106. ^theClass
  107. !
  108. theClass: aClass
  109. theClass := aClass
  110. ! !
  111. !ClassesListNode class methodsFor: 'instance creation'!
  112. on: aClass browser: aBrowser classes: aCollection level: anInteger
  113. ^self new
  114. theClass: aClass;
  115. browser: aBrowser;
  116. level: anInteger;
  117. getNodesFrom: aCollection;
  118. yourself
  119. ! !
  120. ErrorHandler subclass: #DebugErrorHandler
  121. instanceVariableNames: ''
  122. package: 'IDE'!
  123. !DebugErrorHandler methodsFor: 'error handling'!
  124. handleError: anError
  125. [Debugger new
  126. error: anError;
  127. open] on: Error do: [:error |
  128. ErrorHandler new handleError: error]
  129. ! !
  130. !DebugErrorHandler class methodsFor: 'initialization'!
  131. initialize
  132. self register
  133. ! !
  134. Widget subclass: #SourceArea
  135. instanceVariableNames: 'editor div receiver onDoIt'
  136. package: 'IDE'!
  137. !SourceArea methodsFor: 'accessing'!
  138. currentLine
  139. ^editor getLine: (editor getCursor line)
  140. !
  141. currentLineOrSelection
  142. ^editor somethingSelected
  143. ifFalse: [self currentLine]
  144. ifTrue: [self selection]
  145. !
  146. editor
  147. ^editor
  148. !
  149. onDoIt
  150. ^onDoIt
  151. !
  152. onDoIt: aBlock
  153. onDoIt := aBlock
  154. !
  155. receiver
  156. ^receiver ifNil: [DoIt new]
  157. !
  158. receiver: anObject
  159. receiver := anObject
  160. !
  161. selection
  162. ^editor getSelection
  163. !
  164. selectionEnd
  165. ^textarea element selectionEnd
  166. !
  167. selectionEnd: anInteger
  168. textarea element selectionEnd: anInteger
  169. !
  170. selectionStart
  171. ^textarea element selectionStart
  172. !
  173. selectionStart: anInteger
  174. textarea element selectionStart: anInteger
  175. !
  176. setEditorOn: aTextarea
  177. <self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  178. theme: 'jtalk',
  179. lineNumbers: true,
  180. enterMode: 'flat',
  181. matchBrackets: true,
  182. electricChars: false
  183. })>
  184. !
  185. val
  186. ^editor getValue
  187. !
  188. val: aString
  189. editor setValue: aString
  190. ! !
  191. !SourceArea methodsFor: 'actions'!
  192. clear
  193. self val: ''
  194. !
  195. doIt
  196. | result |
  197. result := self eval: self currentLineOrSelection.
  198. self onDoIt ifNotNil: [self onDoIt value].
  199. ^result
  200. !
  201. eval: aString
  202. | compiler |
  203. compiler := Compiler new.
  204. [compiler parseExpression: aString] on: Error do: [:ex |
  205. ^window alert: ex messageText].
  206. ^(compiler load: 'doIt ^[', aString, '] value' forClass: DoIt) fn applyTo: self receiver arguments: #()
  207. !
  208. fileIn
  209. Importer new import: self currentLineOrSelection readStream
  210. !
  211. handleKeyDown: anEvent
  212. <if(anEvent.ctrlKey) {
  213. if(anEvent.keyCode === 80) { //ctrl+p
  214. self._printIt();
  215. anEvent.preventDefault();
  216. return false;
  217. }
  218. if(anEvent.keyCode === 68) { //ctrl+d
  219. self._doIt();
  220. anEvent.preventDefault();
  221. return false;
  222. }
  223. if(anEvent.keyCode === 73) { //ctrl+i
  224. self._inspectIt();
  225. anEvent.preventDefault();
  226. return false;
  227. }
  228. }>
  229. !
  230. inspectIt
  231. self doIt inspect
  232. !
  233. print: aString
  234. | start stop |
  235. start := HashedCollection new.
  236. stop := HashedCollection new.
  237. start at: 'line' put: (editor getCursor: false) line.
  238. start at: 'ch' put: (editor getCursor: false) ch.
  239. stop at: 'line' put: (start at: 'line').
  240. stop at: 'ch' put: ((start at: 'ch') + aString size + 2).
  241. editor replaceSelection: (editor getSelection, ' ', aString, ' ').
  242. editor setCursor: (editor getCursor: true).
  243. editor setSelection: stop end: start
  244. !
  245. printIt
  246. self print: self doIt printString
  247. ! !
  248. !SourceArea methodsFor: 'events'!
  249. onKeyDown: aBlock
  250. div onKeyDown: aBlock
  251. !
  252. onKeyUp: aBlock
  253. div onKeyUp: aBlock
  254. ! !
  255. !SourceArea methodsFor: 'rendering'!
  256. renderOn: html
  257. | textarea |
  258. div := html div class: 'source'.
  259. div with: [textarea := html textarea].
  260. self setEditorOn: textarea element.
  261. div onKeyDown: [:e | self handleKeyDown: e]
  262. ! !
  263. Widget subclass: #TabManager
  264. instanceVariableNames: 'selectedTab tabs opened ul input'
  265. package: 'IDE'!
  266. !TabManager methodsFor: 'accessing'!
  267. labelFor: aWidget
  268. | label maxSize |
  269. maxSize := 15.
  270. label := aWidget label copyFrom: 0 to: (aWidget label size min: maxSize).
  271. aWidget label size > maxSize ifTrue: [
  272. label := label, '...'].
  273. ^label
  274. !
  275. tabs
  276. ^tabs ifNil: [tabs := Array new]
  277. ! !
  278. !TabManager methodsFor: 'actions'!
  279. close
  280. opened ifTrue: [
  281. '#jtalk' asJQuery hide.
  282. ul asJQuery hide.
  283. selectedTab hide.
  284. self removeBodyMargin.
  285. 'body' asJQuery removeClass: 'jtalkBody'.
  286. opened := false]
  287. !
  288. closeTab: aWidget
  289. self removeTab: aWidget.
  290. self selectTab: self tabs last.
  291. aWidget remove.
  292. self update
  293. !
  294. newBrowserTab
  295. Browser open
  296. !
  297. onResize: aBlock
  298. <jQuery('#jtalk').resizable({
  299. handles: 'n',
  300. resize: aBlock,
  301. minHeight: 230
  302. })>
  303. !
  304. onWindowResize: aBlock
  305. <jQuery(window).resize(aBlock)>
  306. !
  307. open
  308. opened ifFalse: [
  309. 'body' asJQuery addClass: 'jtalkBody'.
  310. '#jtalk' asJQuery show.
  311. ul asJQuery show.
  312. self updateBodyMargin.
  313. selectedTab show.
  314. opened := true]
  315. !
  316. removeBodyMargin
  317. self setBodyMargin: 0
  318. !
  319. search: aString
  320. | searchedClass |
  321. searchedClass := Smalltalk current at: aString.
  322. searchedClass isClass
  323. ifTrue: [Browser openOn: searchedClass]
  324. ifFalse: [ReferencesBrowser search: aString]
  325. !
  326. selectTab: aWidget
  327. self open.
  328. selectedTab := aWidget.
  329. self tabs do: [:each |
  330. each hide].
  331. aWidget show.
  332. self update
  333. !
  334. setBodyMargin: anInteger
  335. '.jtalkBody' asJQuery css: 'margin-bottom' put: anInteger asString, 'px'
  336. !
  337. updateBodyMargin
  338. self setBodyMargin: '#jtalk' asJQuery height
  339. !
  340. updatePosition
  341. <jQuery('#jtalk').css('top', '').css('bottom', '0px')>
  342. ! !
  343. !TabManager methodsFor: 'adding/Removing'!
  344. addTab: aWidget
  345. self tabs add: aWidget.
  346. aWidget appendToJQuery: '#jtalk' asJQuery.
  347. aWidget hide
  348. !
  349. removeTab: aWidget
  350. self tabs remove: aWidget.
  351. self update
  352. ! !
  353. !TabManager methodsFor: 'initialization'!
  354. initialize
  355. super initialize.
  356. opened := true.
  357. [:html | html div id: 'jtalk'] appendToJQuery: 'body' asJQuery.
  358. 'body' asJQuery
  359. addClass: 'jtalkBody'.
  360. self appendToJQuery: '#jtalk' asJQuery.
  361. self
  362. addTab: IDETranscript current;
  363. addTab: Workspace new;
  364. addTab: TestRunner new.
  365. self selectTab: self tabs last.
  366. self
  367. onResize: [self updateBodyMargin; updatePosition];
  368. onWindowResize: [self updatePosition]
  369. ! !
  370. !TabManager methodsFor: 'rendering'!
  371. renderOn: html
  372. html div id: 'logo'.
  373. self renderToolbarOn: html.
  374. ul := html ul
  375. id: 'jtalkTabs';
  376. yourself.
  377. self renderTabs
  378. !
  379. renderTabFor: aWidget on: html
  380. | li |
  381. li := html li.
  382. selectedTab = aWidget ifTrue: [
  383. li class: 'selected'].
  384. li with: [
  385. html span class: 'ltab'.
  386. html span
  387. class: 'mtab';
  388. with: [
  389. aWidget canBeClosed ifTrue: [
  390. html span
  391. class: 'close';
  392. with: 'x';
  393. onClick: [self closeTab: aWidget]].
  394. html span with: (self labelFor: aWidget)].
  395. html span class: 'rtab'];
  396. onClick: [self selectTab: aWidget]
  397. !
  398. renderTabs
  399. ul contents: [:html |
  400. self tabs do: [:each |
  401. self renderTabFor: each on: html].
  402. html li
  403. class: 'newtab';
  404. with: [
  405. html span class: 'ltab'.
  406. html span class: 'mtab'; with: ' + '.
  407. html span class: 'rtab'];
  408. onClick: [self newBrowserTab]]
  409. !
  410. renderToolbarOn: html
  411. html div
  412. id: 'jt_toolbar';
  413. with: [
  414. input := html input
  415. class: 'implementors';
  416. yourself.
  417. input onKeyPress: [:event |
  418. event keyCode = 13 ifTrue: [
  419. self search: input asJQuery val]].
  420. html div id: 'jt_close'; onClick: [self close]]
  421. ! !
  422. !TabManager methodsFor: 'updating'!
  423. update
  424. self renderTabs
  425. ! !
  426. TabManager class instanceVariableNames: 'current'!
  427. !TabManager class methodsFor: 'instance creation'!
  428. current
  429. ^current ifNil: [current := super new]
  430. !
  431. new
  432. self shouldNotImplement
  433. ! !
  434. Widget subclass: #TabWidget
  435. instanceVariableNames: 'div'
  436. package: 'IDE'!
  437. !TabWidget methodsFor: 'accessing'!
  438. label
  439. self subclassResponsibility
  440. ! !
  441. !TabWidget methodsFor: 'actions'!
  442. close
  443. TabManager current closeTab: self
  444. !
  445. hide
  446. div asJQuery hide
  447. !
  448. open
  449. TabManager current addTab: self.
  450. TabManager current selectTab: self
  451. !
  452. remove
  453. div asJQuery remove
  454. !
  455. show
  456. div asJQuery show
  457. ! !
  458. !TabWidget methodsFor: 'rendering'!
  459. renderBoxOn: html
  460. !
  461. renderButtonsOn: html
  462. !
  463. renderOn: html
  464. div := html div
  465. class: 'jtalkTool';
  466. yourself.
  467. self renderTab
  468. !
  469. renderTab
  470. div contents: [:html |
  471. html div
  472. class: 'jt_box';
  473. with: [self renderBoxOn: html].
  474. html div
  475. class: 'jt_buttons';
  476. with: [self renderButtonsOn: html]]
  477. !
  478. update
  479. self renderTab
  480. ! !
  481. !TabWidget methodsFor: 'testing'!
  482. canBeClosed
  483. ^false
  484. ! !
  485. !TabWidget class methodsFor: 'instance creation'!
  486. open
  487. ^self new open
  488. ! !
  489. TabWidget subclass: #Browser
  490. instanceVariableNames: 'selectedPackage selectedClass selectedProtocol selectedMethod packagesList classesList protocolsList methodsList sourceArea tabsList selectedTab saveButton classButtons methodButtons unsavedChanges'
  491. package: 'IDE'!
  492. !Browser methodsFor: 'accessing'!
  493. classCommentSource
  494. ^selectedClass comment
  495. !
  496. classDeclarationSource
  497. | stream |
  498. stream := '' writeStream.
  499. selectedClass ifNil: [^self classDeclarationTemplate].
  500. stream
  501. nextPutAll: selectedClass superclass asString;
  502. nextPutAll: ' subclass: #';
  503. nextPutAll: selectedClass name;
  504. nextPutAll: String lf, String tab;
  505. nextPutAll: 'instanceVariableNames: '''.
  506. selectedClass instanceVariableNames
  507. do: [:each | stream nextPutAll: each]
  508. separatedBy: [stream nextPutAll: ' '].
  509. stream
  510. nextPutAll: '''', String lf, String tab;
  511. nextPutAll: 'package: ''';
  512. nextPutAll: selectedClass category;
  513. nextPutAll: ''''.
  514. ^stream contents
  515. !
  516. classDeclarationTemplate
  517. ^'Object subclass: #NameOfSubclass
  518. instanceVariableNames: ''''
  519. package: ''', self selectedPackage, ''''
  520. !
  521. classes
  522. ^((Smalltalk current classes
  523. select: [:each | each category = selectedPackage])
  524. sort: [:a :b | a name < b name]) asSet
  525. !
  526. declarationSource
  527. ^selectedTab = #instance
  528. ifTrue: [self classDeclarationSource]
  529. ifFalse: [self metaclassDeclarationSource]
  530. !
  531. dummyMethodSource
  532. ^'messageSelectorAndArgumentNames
  533. "comment stating purpose of message"
  534. | temporary variable names |
  535. statements'
  536. !
  537. label
  538. ^selectedClass
  539. ifNil: ['Browser (nil)']
  540. ifNotNil: ['Browser: ', selectedClass name]
  541. !
  542. metaclassDeclarationSource
  543. | stream |
  544. stream := '' writeStream.
  545. selectedClass ifNotNil: [
  546. stream
  547. nextPutAll: selectedClass asString;
  548. nextPutAll: ' class ';
  549. nextPutAll: 'instanceVariableNames: '''.
  550. selectedClass class instanceVariableNames
  551. do: [:each | stream nextPutAll: each]
  552. separatedBy: [stream nextPutAll: ' '].
  553. stream nextPutAll: ''''].
  554. ^stream contents
  555. !
  556. methodSource
  557. ^selectedMethod
  558. ifNil: [self dummyMethodSource]
  559. ifNotNil: [selectedMethod source]
  560. !
  561. methods
  562. | klass |
  563. selectedTab = #comment ifTrue: [^#()].
  564. selectedClass ifNotNil: [
  565. klass := selectedTab = #instance
  566. ifTrue: [selectedClass]
  567. ifFalse: [selectedClass class]].
  568. ^(selectedProtocol
  569. ifNil: [
  570. klass
  571. ifNil: [#()]
  572. ifNotNil: [klass methodDictionary values]]
  573. ifNotNil: [
  574. klass methodDictionary values select: [:each |
  575. each category = selectedProtocol]]) sort: [:a :b | a selector < b selector]
  576. !
  577. packages
  578. | packages |
  579. packages := Array new.
  580. Smalltalk current classes do: [:each |
  581. (packages includes: each category) ifFalse: [
  582. packages add: each category]].
  583. ^packages sort
  584. !
  585. protocols
  586. | klass |
  587. selectedClass ifNotNil: [
  588. selectedTab = #comment ifTrue: [^#()].
  589. klass := selectedTab = #instance
  590. ifTrue: [selectedClass]
  591. ifFalse: [selectedClass class].
  592. klass methodDictionary isEmpty ifTrue: [
  593. ^Array with: 'not yet classified'].
  594. ^klass protocols].
  595. ^Array new
  596. !
  597. selectedClass
  598. ^selectedClass
  599. !
  600. selectedPackage
  601. ^selectedPackage
  602. !
  603. source
  604. selectedTab = #comment ifFalse: [
  605. ^(selectedProtocol notNil or: [selectedMethod notNil])
  606. ifFalse: [self declarationSource]
  607. ifTrue: [self methodSource]].
  608. ^selectedClass
  609. ifNil: ['']
  610. ifNotNil: [self classCommentSource]
  611. ! !
  612. !Browser methodsFor: 'actions'!
  613. addInstanceVariableNamed: aString toClass: aClass
  614. ClassBuilder new
  615. addSubclassOf: aClass superclass
  616. named: aClass name
  617. instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)
  618. package: aClass package name
  619. !
  620. addNewClass
  621. | className |
  622. className := window prompt: 'New class'.
  623. (className notNil and: [className notEmpty]) ifTrue: [
  624. Object subclass: className instanceVariableNames: '' package: self selectedPackage.
  625. self
  626. resetClassesList;
  627. updateClassesList.
  628. self selectClass: (Smalltalk current at: className)]
  629. !
  630. addNewProtocol
  631. | newProtocol |
  632. newProtocol := window prompt: 'New method protocol'.
  633. (newProtocol notNil and: [newProtocol notEmpty]) ifTrue: [
  634. selectedMethod category: newProtocol.
  635. self setMethodProtocol: newProtocol]
  636. !
  637. cancelChanges
  638. ^unsavedChanges
  639. ifTrue: [window confirm: 'Cancel changes?']
  640. ifFalse: [true]
  641. !
  642. commitPackage
  643. selectedPackage ifNotNil: [ |package|
  644. package := Package named: selectedPackage.
  645. { Exporter -> (package commitPathJs, '/', selectedPackage, '.js').
  646. StrippedExporter -> (package commitPathJs, '/', selectedPackage, '.deploy.js').
  647. ChunkExporter -> (package commitPathSt, '/', selectedPackage, '.st') }
  648. do: [:commitStrategy| |fileContents|
  649. fileContents := (commitStrategy key new exportPackage: selectedPackage).
  650. self ajaxPutAt: commitStrategy value data: fileContents]
  651. ]
  652. !
  653. compile
  654. self disableSaveButton.
  655. selectedTab = #comment
  656. ifTrue: [
  657. selectedClass ifNotNil: [
  658. self compileClassComment]]
  659. ifFalse: [
  660. (selectedProtocol notNil or: [selectedMethod notNil])
  661. ifFalse: [self compileDefinition]
  662. ifTrue: [self compileMethodDefinition]]
  663. !
  664. compileClassComment
  665. selectedClass comment: sourceArea val
  666. !
  667. compileDefinition
  668. | newClass |
  669. newClass := Compiler new loadExpression: sourceArea val.
  670. self
  671. resetClassesList;
  672. updateCategoriesList;
  673. updateClassesList.
  674. self selectClass: newClass
  675. !
  676. compileMethodDefinition
  677. selectedTab = #instance
  678. ifTrue: [self compileMethodDefinitionFor: selectedClass]
  679. ifFalse: [self compileMethodDefinitionFor: selectedClass class]
  680. !
  681. compileMethodDefinitionFor: aClass
  682. | compiler method source node |
  683. source := sourceArea val.
  684. selectedProtocol ifNil: [selectedProtocol := selectedMethod category].
  685. compiler := Compiler new.
  686. compiler source: source.
  687. node := compiler parse: source.
  688. node isParseFailure ifTrue: [
  689. ^window alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString].
  690. compiler currentClass: aClass.
  691. method := compiler eval: (compiler compileNode: node).
  692. method category: selectedProtocol.
  693. compiler unknownVariables do: [:each |
  694. "Do not try to redeclare javascript's objects"
  695. (window at: each) ifNil: [
  696. (window confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
  697. self addInstanceVariableNamed: each toClass: aClass.
  698. ^self compileMethodDefinitionFor: aClass]]].
  699. aClass addCompiledMethod: method.
  700. compiler setupClass: aClass.
  701. self updateMethodsList.
  702. self selectMethod: method
  703. !
  704. copyClass
  705. | className |
  706. className := window prompt: 'Copy class'.
  707. (className notNil and: [className notEmpty]) ifTrue: [
  708. ClassBuilder new copyClass: self selectedClass named: className.
  709. self
  710. resetClassesList;
  711. updateClassesList.
  712. self selectClass: (Smalltalk current at: className)]
  713. !
  714. disableSaveButton
  715. saveButton ifNotNil: [
  716. saveButton at: 'disabled' put: true].
  717. unsavedChanges := false
  718. !
  719. handleSourceAreaKeyDown: anEvent
  720. <if(anEvent.ctrlKey) {
  721. if(anEvent.keyCode === 83) { //ctrl+s
  722. self._compile();
  723. anEvent.preventDefault();
  724. return false;
  725. }
  726. }
  727. >
  728. !
  729. hideClassButtons
  730. classButtons asJQuery hide
  731. !
  732. hideMethodButtons
  733. methodButtons asJQuery hide
  734. !
  735. removeClass
  736. (window confirm: 'Do you really want to remove ', selectedClass name, '?')
  737. ifTrue: [
  738. Smalltalk current removeClass: selectedClass.
  739. self resetClassesList.
  740. self selectClass: nil]
  741. !
  742. removeMethod
  743. self cancelChanges ifTrue: [
  744. (window confirm: 'Do you really want to remove #', selectedMethod selector, '?')
  745. ifTrue: [
  746. selectedTab = #instance
  747. ifTrue: [selectedClass removeCompiledMethod: selectedMethod]
  748. ifFalse: [selectedClass class removeCompiledMethod: selectedMethod].
  749. self selectMethod: nil]]
  750. !
  751. removePackage
  752. (window confirm: 'Do you really want to remove the whole package ', selectedPackage, ' with all its classes?')
  753. ifTrue: [
  754. Smalltalk current removePackage: selectedPackage.
  755. self updateCategoriesList]
  756. !
  757. renameClass
  758. | newName |
  759. newName := window prompt: 'Rename class ', selectedClass name.
  760. (newName notNil and: [newName notEmpty]) ifTrue: [
  761. selectedClass rename: newName.
  762. self
  763. updateClassesList;
  764. updateSourceAndButtons]
  765. !
  766. renamePackage
  767. | newName |
  768. newName := window prompt: 'Rename package ', selectedPackage.
  769. newName ifNotNil: [
  770. newName notEmpty ifTrue: [
  771. Smalltalk current renamePackage: selectedPackage to: newName.
  772. self updateCategoriesList]]
  773. !
  774. search: aString
  775. self cancelChanges ifTrue: [| searchedClass |
  776. searchedClass := Smalltalk current at: aString.
  777. searchedClass isClass
  778. ifTrue: [self class openOn: searchedClass]
  779. ifFalse: [self searchReferencesOf: aString]]
  780. !
  781. searchClassReferences
  782. ReferencesBrowser search: selectedClass name
  783. !
  784. searchReferencesOf: aString
  785. ReferencesBrowser search: aString
  786. !
  787. selectCategory: aCategory
  788. self cancelChanges ifTrue: [
  789. selectedPackage := aCategory.
  790. selectedClass := selectedProtocol := selectedMethod := nil.
  791. self resetClassesList.
  792. self
  793. updateCategoriesList;
  794. updateClassesList;
  795. updateProtocolsList;
  796. updateMethodsList;
  797. updateSourceAndButtons]
  798. !
  799. selectClass: aClass
  800. self cancelChanges ifTrue: [
  801. selectedClass := aClass.
  802. selectedProtocol := selectedMethod := nil.
  803. self
  804. updateClassesList;
  805. updateProtocolsList;
  806. updateMethodsList;
  807. updateSourceAndButtons]
  808. !
  809. selectMethod: aMethod
  810. self cancelChanges ifTrue: [
  811. selectedMethod := aMethod.
  812. self
  813. updateProtocolsList;
  814. updateMethodsList;
  815. updateSourceAndButtons]
  816. !
  817. selectProtocol: aString
  818. self cancelChanges ifTrue: [
  819. selectedProtocol := aString.
  820. selectedMethod := nil.
  821. self
  822. updateProtocolsList;
  823. updateMethodsList;
  824. updateSourceAndButtons]
  825. !
  826. selectTab: aString
  827. self cancelChanges ifTrue: [
  828. selectedTab := aString.
  829. self selectProtocol: nil.
  830. self updateTabsList]
  831. !
  832. setMethodProtocol: aString
  833. self cancelChanges ifTrue: [
  834. (self protocols includes: aString)
  835. ifFalse: [self addNewProtocol]
  836. ifTrue: [
  837. selectedMethod category: aString.
  838. selectedProtocol := aString.
  839. selectedMethod := selectedMethod.
  840. self
  841. updateProtocolsList;
  842. updateMethodsList;
  843. updateSourceAndButtons]]
  844. !
  845. showClassButtons
  846. classButtons asJQuery show
  847. !
  848. showMethodButtons
  849. methodButtons asJQuery show
  850. ! !
  851. !Browser methodsFor: 'initialization'!
  852. initialize
  853. super initialize.
  854. selectedTab := #instance.
  855. selectedPackage := self packages first.
  856. unsavedChanges := false
  857. ! !
  858. !Browser methodsFor: 'network'!
  859. ajaxPutAt: anURL data: aString
  860. jQuery
  861. ajax: anURL options: #{ 'type' -> 'PUT'.
  862. 'data' -> aString.
  863. 'contentType' -> 'text/plain;charset=UTF-8'.
  864. 'error' -> [window alert: 'PUT request failed at: ', anURL] }
  865. ! !
  866. !Browser methodsFor: 'rendering'!
  867. renderBottomPanelOn: html
  868. html div
  869. class: 'jt_sourceCode';
  870. with: [
  871. sourceArea := SourceArea new.
  872. sourceArea renderOn: html.
  873. sourceArea onKeyDown: [:e |
  874. self handleSourceAreaKeyDown: e].
  875. sourceArea onKeyUp: [self updateStatus]]
  876. !
  877. renderBoxOn: html
  878. self
  879. renderTopPanelOn: html;
  880. renderTabsOn: html;
  881. renderBottomPanelOn: html
  882. !
  883. renderButtonsOn: html
  884. saveButton := html button.
  885. saveButton
  886. with: 'Save';
  887. onClick: [self compile].
  888. methodButtons := html span.
  889. classButtons := html span.
  890. html div
  891. class: 'right';
  892. with: [
  893. html button
  894. with: 'DoIt';
  895. onClick: [sourceArea doIt].
  896. html button
  897. with: 'PrintIt';
  898. onClick: [sourceArea printIt].
  899. html button with: 'InspectIt';
  900. onClick: [sourceArea inspectIt]].
  901. self updateSourceAndButtons
  902. !
  903. renderTabsOn: html
  904. tabsList := html ul class: 'jt_tabs jt_browser'.
  905. self updateTabsList.
  906. !
  907. renderTopPanelOn: html
  908. html div
  909. class: 'top';
  910. with: [
  911. packagesList := html ul class: 'jt_column browser packages'.
  912. html div class: 'jt_packagesButtons'; with: [
  913. html button
  914. title: 'Commit classes in this package to disk';
  915. onClick: [self commitPackage];
  916. with: 'Commit'.
  917. html button
  918. title: 'Rename package';
  919. onClick: [self renamePackage];
  920. with: 'Rename'.
  921. html button
  922. title: 'Remove this package from the system';
  923. onClick: [self removePackage];
  924. with: 'Remove'].
  925. classesList := ClassesList on: self.
  926. classesList renderOn: html.
  927. protocolsList := html ul class: 'jt_column browser protocols'.
  928. methodsList := html ul class: 'jt_column browser methods'.
  929. self
  930. updateCategoriesList;
  931. updateClassesList;
  932. updateProtocolsList;
  933. updateMethodsList.
  934. html div class: 'jt_clear']
  935. ! !
  936. !Browser methodsFor: 'testing'!
  937. canBeClosed
  938. ^true
  939. ! !
  940. !Browser methodsFor: 'updating'!
  941. resetClassesList
  942. classesList resetNodes
  943. !
  944. updateCategoriesList
  945. packagesList contents: [:html |
  946. self packages do: [:each || li label |
  947. each isEmpty
  948. ifTrue: [label := 'Unclassified']
  949. ifFalse: [label := each].
  950. li := html li.
  951. selectedPackage = each ifTrue: [
  952. li class: 'selected'].
  953. li
  954. with: label;
  955. onClick: [self selectCategory: each]]]
  956. !
  957. updateClassesList
  958. TabManager current update.
  959. classesList updateNodes
  960. !
  961. updateMethodsList
  962. methodsList contents: [:html |
  963. self methods do: [:each || li |
  964. li := html li.
  965. selectedMethod = each ifTrue: [
  966. li class: 'selected'].
  967. li
  968. with: each selector;
  969. onClick: [self selectMethod: each]]]
  970. !
  971. updateProtocolsList
  972. protocolsList contents: [:html |
  973. self protocols do: [:each || li |
  974. li := html li.
  975. selectedProtocol = each ifTrue: [
  976. li class: 'selected'].
  977. li
  978. with: each;
  979. onClick: [self selectProtocol: each]]]
  980. !
  981. updateSourceAndButtons
  982. self disableSaveButton.
  983. classButtons contents: [:html |
  984. html button
  985. title: 'Create a new class';
  986. onClick: [self addNewClass];
  987. with: 'New class'.
  988. html button
  989. with: 'Rename class';
  990. onClick: [self renameClass].
  991. html button
  992. with: 'Copy class';
  993. onClick: [self copyClass].
  994. html button
  995. with: 'Remove class';
  996. onClick: [self removeClass].
  997. html button
  998. with: 'References';
  999. onClick: [self searchClassReferences]].
  1000. methodButtons contents: [:html | | protocolSelect referencesSelect |
  1001. html button
  1002. with: 'Remove method';
  1003. onClick: [self removeMethod].
  1004. protocolSelect := html select.
  1005. protocolSelect
  1006. onChange: [ self setMethodProtocol: protocolSelect asJQuery val];
  1007. with: [
  1008. html option
  1009. with: 'Method protocol';
  1010. at: 'disabled' put: 'disabled'.
  1011. html option
  1012. class: 'important';
  1013. with: 'New...'.
  1014. self protocols do: [:each |
  1015. option := html option with: each.
  1016. selectedProtocol = each ifTrue: [ option at: 'selected' put: 'selected' ] ]].
  1017. selectedMethod isNil ifFalse: [
  1018. referencesSelect := html select.
  1019. referencesSelect
  1020. onChange: [self searchReferencesOf: referencesSelect asJQuery val];
  1021. with: [ |option|
  1022. html option
  1023. with: 'References';
  1024. at: 'disabled' put: 'disabled'.
  1025. html option
  1026. class: 'important';
  1027. with: selectedMethod selector.
  1028. selectedMethod messageSends sorted do: [:each |
  1029. html option with: each]]]].
  1030. selectedMethod isNil
  1031. ifTrue: [
  1032. self hideMethodButtons.
  1033. (selectedClass isNil or: [selectedProtocol notNil])
  1034. ifTrue: [self hideClassButtons]
  1035. ifFalse: [self showClassButtons]]
  1036. ifFalse: [
  1037. self hideClassButtons.
  1038. self showMethodButtons].
  1039. sourceArea val: self source
  1040. !
  1041. updateStatus
  1042. sourceArea val = self source
  1043. ifTrue: [
  1044. saveButton ifNotNil: [
  1045. saveButton at: 'disabled' put: true].
  1046. unsavedChanges := false]
  1047. ifFalse: [
  1048. saveButton ifNotNil: [
  1049. saveButton removeAt: 'disabled'].
  1050. unsavedChanges := true]
  1051. !
  1052. updateTabsList
  1053. tabsList contents: [:html || li |
  1054. li := html li.
  1055. selectedTab = #instance ifTrue: [li class: 'selected'].
  1056. li
  1057. with: [
  1058. html span class: 'ltab'.
  1059. html span class: 'mtab'; with: 'Instance'.
  1060. html span class: 'rtab'];
  1061. onClick: [self selectTab: #instance].
  1062. li := html li.
  1063. selectedTab = #class ifTrue: [li class: 'selected'].
  1064. li
  1065. with: [
  1066. html span class: 'ltab'.
  1067. html span class: 'mtab'; with: 'Class'.
  1068. html span class: 'rtab'];
  1069. onClick: [self selectTab: #class].
  1070. li := html li.
  1071. selectedTab = #comment ifTrue: [li class: 'selected'].
  1072. li
  1073. with: [
  1074. html span class: 'ltab'.
  1075. html span class: 'mtab'; with: 'Comment'.
  1076. html span class: 'rtab'];
  1077. onClick: [self selectTab: #comment]]
  1078. ! !
  1079. !Browser class methodsFor: 'accessing'!
  1080. commitPathJs
  1081. ^'js'
  1082. !
  1083. commitPathSt
  1084. ^'st'
  1085. ! !
  1086. !Browser class methodsFor: 'convenience'!
  1087. open
  1088. self new open
  1089. !
  1090. openOn: aClass
  1091. ^self new
  1092. open;
  1093. selectCategory: aClass category;
  1094. selectClass: aClass
  1095. ! !
  1096. TabWidget subclass: #Debugger
  1097. instanceVariableNames: 'error selectedContext sourceArea ul ul2 inspector saveButton unsavedChanges selectedVariable selectedVariableName inspectButton'
  1098. package: 'IDE'!
  1099. !Debugger methodsFor: 'accessing'!
  1100. arguments
  1101. ^self method
  1102. ifNil: [selectedContext temps collect: [:each | nil]]
  1103. ifNotNil: [self method arguments]
  1104. !
  1105. error
  1106. ^error
  1107. !
  1108. error: anError
  1109. error := anError
  1110. !
  1111. label
  1112. ^'[Debugger]'
  1113. !
  1114. method
  1115. ^selectedContext receiver class methodAt: selectedContext selector
  1116. !
  1117. receiver
  1118. ^selectedContext receiver
  1119. !
  1120. source
  1121. ^self method
  1122. ifNil: ['Method doesn''t exist!!']
  1123. ifNotNil: [self method source]
  1124. ! !
  1125. !Debugger methodsFor: 'actions'!
  1126. inspectSelectedVariable
  1127. selectedVariable inspect
  1128. !
  1129. proceed
  1130. self close.
  1131. selectedContext receiver perform: selectedContext selector withArguments: selectedContext temps
  1132. !
  1133. save
  1134. | protocol |
  1135. protocol := (selectedContext receiver class methodDictionary at: selectedContext selector) category.
  1136. selectedContext receiver class compile: sourceArea val category: protocol.
  1137. self updateStatus
  1138. !
  1139. selectContext: aContext
  1140. selectedContext := aContext.
  1141. selectedVariable := nil.
  1142. selectedVariableName := nil.
  1143. self
  1144. updateContextsList;
  1145. updateSourceArea;
  1146. updateInspector;
  1147. updateVariablesList;
  1148. updateStatus
  1149. !
  1150. selectVariable: anObject named: aString
  1151. selectedVariable := anObject.
  1152. selectedVariableName := aString.
  1153. inspector contents: [:html | html with: anObject printString].
  1154. self updateVariablesList
  1155. ! !
  1156. !Debugger methodsFor: 'initialization'!
  1157. initialize
  1158. super initialize.
  1159. unsavedChanges = false
  1160. ! !
  1161. !Debugger methodsFor: 'rendering'!
  1162. renderBottomPanelOn: html
  1163. html div
  1164. class: 'jt_sourceCode debugger';
  1165. with: [
  1166. sourceArea := SourceArea new.
  1167. sourceArea renderOn: html].
  1168. ul2 := html ul class: 'jt_column debugger variables'.
  1169. inspector := html div class: 'jt_column debugger inspector'.
  1170. sourceArea
  1171. onKeyUp: [self updateStatus]
  1172. !
  1173. renderBoxOn: html
  1174. self
  1175. renderTopPanelOn: html;
  1176. renderBottomPanelOn: html
  1177. !
  1178. renderButtonsOn: html
  1179. saveButton := html button
  1180. with: 'Save';
  1181. onClick: [self save].
  1182. html button
  1183. with: 'DoIt';
  1184. onClick: [sourceArea doIt].
  1185. html button
  1186. with: 'PrintIt';
  1187. onClick: [sourceArea printIt].
  1188. html button
  1189. with: 'InspectIt';
  1190. onClick: [sourceArea inspectIt].
  1191. html button
  1192. with: 'Proceed';
  1193. onClick: [self proceed].
  1194. html button
  1195. with: 'Abandon';
  1196. onClick: [self close].
  1197. inspectButton := html button
  1198. class: 'jt_button debugger inspect';
  1199. with: 'Inspect';
  1200. onClick: [self inspectSelectedVariable].
  1201. self
  1202. updateSourceArea;
  1203. updateStatus;
  1204. updateVariablesList;
  1205. updateInspector
  1206. !
  1207. renderContext: aContext on: html
  1208. | li |
  1209. li := html li.
  1210. selectedContext = aContext ifTrue: [
  1211. li class: 'selected'].
  1212. li
  1213. with: aContext asString;
  1214. onClick: [self selectContext: aContext].
  1215. aContext home ifNotNil: [self renderContext: aContext home on: html]
  1216. !
  1217. renderTopPanelOn: html
  1218. selectedContext := self error context.
  1219. html div
  1220. class: 'top';
  1221. with: [
  1222. html div
  1223. class: 'label';
  1224. with: self error messageText.
  1225. ul := html ul
  1226. class: 'jt_column debugger contexts';
  1227. with: [self renderContext: self error context on: html]]
  1228. ! !
  1229. !Debugger methodsFor: 'testing'!
  1230. canBeClosed
  1231. ^true
  1232. ! !
  1233. !Debugger methodsFor: 'updating'!
  1234. updateContextsList
  1235. ul contents: [:html |
  1236. self renderContext: self error context on: html]
  1237. !
  1238. updateInspector
  1239. inspector contents: [:html |]
  1240. !
  1241. updateSourceArea
  1242. sourceArea val: self source
  1243. !
  1244. updateStatus
  1245. sourceArea val = self source
  1246. ifTrue: [
  1247. saveButton ifNotNil: [
  1248. saveButton at: 'disabled' put: true].
  1249. unsavedChanges := false]
  1250. ifFalse: [
  1251. saveButton ifNotNil: [
  1252. saveButton removeAt: 'disabled'].
  1253. unsavedChanges := true]
  1254. !
  1255. updateVariablesList
  1256. ul2 contents: [:html | | li |
  1257. li := html li
  1258. with: 'self';
  1259. onClick: [self selectVariable: self receiver named: 'self'].
  1260. selectedVariableName = 'self' ifTrue: [
  1261. li class: 'selected'].
  1262. self arguments withIndexDo: [:each :index | | param |
  1263. param := selectedContext temps at: index.
  1264. li := html li
  1265. with: each;
  1266. onClick: [self selectVariable: param named: each].
  1267. selectedVariableName = each ifTrue: [
  1268. li class: 'selected']].
  1269. self receiver class allInstanceVariableNames do: [:each | | ivar |
  1270. ivar := self receiver instVarAt: each.
  1271. li := html li
  1272. with: each;
  1273. onClick: [self selectVariable: ivar named: each].
  1274. selectedVariableName = each ifTrue: [
  1275. li class: 'selected']]].
  1276. selectedVariable ifNil: [inspectButton at: 'disabled' put: true] ifNotNil: [inspectButton removeAt: 'disabled']
  1277. ! !
  1278. TabWidget subclass: #IDETranscript
  1279. instanceVariableNames: 'textarea'
  1280. package: 'IDE'!
  1281. !IDETranscript methodsFor: 'accessing'!
  1282. label
  1283. ^'Transcript'
  1284. ! !
  1285. !IDETranscript methodsFor: 'actions'!
  1286. clear
  1287. textarea asJQuery val: ''
  1288. !
  1289. cr
  1290. textarea asJQuery val: textarea asJQuery val, String cr.
  1291. !
  1292. open
  1293. TabManager current
  1294. open;
  1295. selectTab: self
  1296. !
  1297. show: anObject
  1298. textarea ifNil: [self open].
  1299. textarea asJQuery val: textarea asJQuery val, anObject asString.
  1300. ! !
  1301. !IDETranscript methodsFor: 'rendering'!
  1302. renderBoxOn: html
  1303. textarea := html textarea.
  1304. textarea
  1305. class: 'jt_transcript';
  1306. at: 'spellcheck' put: 'false'
  1307. !
  1308. renderButtonsOn: html
  1309. html button
  1310. with: 'Clear transcript';
  1311. onClick: [self clear]
  1312. ! !
  1313. IDETranscript class instanceVariableNames: 'current'!
  1314. !IDETranscript class methodsFor: 'initialization'!
  1315. initialize
  1316. Transcript register: self current
  1317. ! !
  1318. !IDETranscript class methodsFor: 'instance creation'!
  1319. current
  1320. ^current ifNil: [current := super new]
  1321. !
  1322. new
  1323. self shouldNotImplement
  1324. !
  1325. open
  1326. TabManager current
  1327. open;
  1328. selectTab: self current
  1329. ! !
  1330. TabWidget subclass: #Inspector
  1331. instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea diveButton sourceArea'
  1332. package: 'IDE'!
  1333. !Inspector methodsFor: 'accessing'!
  1334. label
  1335. ^label ifNil: ['Inspector (nil)']
  1336. !
  1337. selectedVariable
  1338. ^selectedVariable
  1339. !
  1340. selectedVariable: aString
  1341. selectedVariable := aString
  1342. !
  1343. setLabel: aString
  1344. label := aString
  1345. !
  1346. setVariables: aCollection
  1347. variables := aCollection
  1348. !
  1349. sourceArea
  1350. ^sourceArea
  1351. !
  1352. variables
  1353. ^variables
  1354. ! !
  1355. !Inspector methodsFor: 'actions'!
  1356. dive
  1357. (self variables at: self selectedVariable) inspect
  1358. !
  1359. inspect: anObject
  1360. object := anObject.
  1361. variables := #().
  1362. object inspectOn: self
  1363. !
  1364. refresh
  1365. self
  1366. inspect: object;
  1367. updateVariablesList;
  1368. updateValueTextarea
  1369. ! !
  1370. !Inspector methodsFor: 'rendering'!
  1371. renderBottomPanelOn: html
  1372. html div
  1373. class: 'jt_sourceCode';
  1374. with: [
  1375. sourceArea := SourceArea new
  1376. receiver: object;
  1377. onDoIt: [self refresh];
  1378. yourself.
  1379. sourceArea renderOn: html]
  1380. !
  1381. renderBoxOn: html
  1382. self
  1383. renderTopPanelOn: html;
  1384. renderBottomPanelOn: html
  1385. !
  1386. renderButtonsOn: html
  1387. html button
  1388. with: 'DoIt';
  1389. onClick: [self sourceArea doIt].
  1390. html button
  1391. with: 'PrintIt';
  1392. onClick: [self sourceArea printIt].
  1393. html button
  1394. with: 'InspectIt';
  1395. onClick: [self sourceArea inspectIt].
  1396. self updateButtons
  1397. !
  1398. renderTopPanelOn: html
  1399. html div
  1400. class: 'top';
  1401. with: [
  1402. variablesList := html ul class: 'jt_column variables'.
  1403. valueTextarea := html textarea class: 'jt_column value'; at: 'readonly' put: 'readonly'.
  1404. html div class: 'jt_tabs inspector'; with: [
  1405. html button
  1406. class: 'jt_button inspector refresh';
  1407. with: 'Refresh';
  1408. onClick: [self refresh].
  1409. diveButton := html button
  1410. class: 'jt_button inspector dive';
  1411. with: 'Dive';
  1412. onClick: [self dive]].
  1413. html div class: 'jt_clear'].
  1414. self
  1415. updateVariablesList;
  1416. updateValueTextarea.
  1417. ! !
  1418. !Inspector methodsFor: 'testing'!
  1419. canBeClosed
  1420. ^true
  1421. ! !
  1422. !Inspector methodsFor: 'updating'!
  1423. selectVariable: aString
  1424. self selectedVariable: aString.
  1425. self
  1426. updateVariablesList;
  1427. updateValueTextarea;
  1428. updateButtons
  1429. !
  1430. updateButtons
  1431. (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
  1432. ifFalse: [diveButton at: 'disabled' put: true]
  1433. ifTrue: [diveButton removeAt: 'disabled']
  1434. !
  1435. updateValueTextarea
  1436. valueTextarea asJQuery val: (self selectedVariable isNil
  1437. ifTrue: ['']
  1438. ifFalse: [(self variables at: self selectedVariable) printString])
  1439. !
  1440. updateVariablesList
  1441. variablesList contents: [:html |
  1442. self variables keys do: [:each || li |
  1443. li := html li.
  1444. li
  1445. with: each;
  1446. onClick: [self selectVariable: each].
  1447. self selectedVariable = each ifTrue: [
  1448. li class: 'selected']]]
  1449. ! !
  1450. !Inspector class methodsFor: 'instance creation'!
  1451. on: anObject
  1452. ^self new
  1453. inspect: anObject;
  1454. yourself
  1455. ! !
  1456. TabWidget subclass: #ProgressBar
  1457. instanceVariableNames: 'percent progressDiv div'
  1458. package: 'IDE'!
  1459. !ProgressBar methodsFor: 'accessing'!
  1460. percent
  1461. ^percent ifNil: [0]
  1462. !
  1463. percent: aNumber
  1464. percent := aNumber
  1465. ! !
  1466. !ProgressBar methodsFor: 'rendering'!
  1467. renderOn: html
  1468. div := html div
  1469. class: 'progress_bar';
  1470. yourself.
  1471. self renderProgressBar
  1472. !
  1473. renderProgressBar
  1474. div contents: [:html |
  1475. html div
  1476. class: 'progress';
  1477. style: 'width:', self percent asString, '%']
  1478. ! !
  1479. !ProgressBar methodsFor: 'updating'!
  1480. updatePercent: aNumber
  1481. self percent: aNumber.
  1482. self renderProgressBar
  1483. ! !
  1484. TabWidget subclass: #ReferencesBrowser
  1485. instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList matches matchesList'
  1486. package: 'IDE'!
  1487. !ReferencesBrowser methodsFor: 'accessing'!
  1488. classesAndMetaclasses
  1489. ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
  1490. !
  1491. implementors
  1492. ^implementors ifNil: [implementors := Array new]
  1493. !
  1494. label
  1495. ^'[References]'
  1496. !
  1497. matches
  1498. ^matches ifNil: [matches := Array new]
  1499. !
  1500. referencedClasses
  1501. ^referencedClasses ifNil: [referencedClasses := Array new]
  1502. !
  1503. selector
  1504. ^selector
  1505. !
  1506. senders
  1507. ^senders ifNil: [senders := Array new]
  1508. ! !
  1509. !ReferencesBrowser methodsFor: 'actions'!
  1510. openBrowserOn: aMethod
  1511. | browser |
  1512. browser := Browser openOn: (aMethod methodClass isMetaclass
  1513. ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
  1514. aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
  1515. browser
  1516. selectProtocol: aMethod category;
  1517. selectMethod: aMethod
  1518. !
  1519. search: aString
  1520. self
  1521. searchReferencesFor: aString;
  1522. updateImplementorsList;
  1523. updateSendersList;
  1524. updateReferencedClassesList;
  1525. updateMatchesList
  1526. !
  1527. searchMethodSource
  1528. | regex |
  1529. regex := selector allButFirst.
  1530. self classesAndMetaclasses do: [:each |
  1531. each methodDictionary values do: [:value |
  1532. (value source match: regex) ifTrue: [
  1533. self matches add: value]]]
  1534. !
  1535. searchReferencedClasses
  1536. self classesAndMetaclasses do: [:each |
  1537. each methodDictionary values do: [:value |
  1538. (value referencedClasses includes: selector) ifTrue: [
  1539. self referencedClasses add: value]]]
  1540. !
  1541. searchReferencesFor: aString
  1542. selector := aString.
  1543. implementors := Array new.
  1544. senders := Array new.
  1545. referencedClasses := Array new.
  1546. matches := Array new.
  1547. self searchMethodSource.
  1548. (selector match: '^[A-Z]')
  1549. ifFalse: [self searchSelectorReferences]
  1550. ifTrue: [self searchReferencedClasses]
  1551. !
  1552. searchSelectorReferences
  1553. self classesAndMetaclasses do: [:each |
  1554. each methodDictionary keysAndValuesDo: [:key :value |
  1555. key = selector ifTrue: [self implementors add: value].
  1556. (value messageSends includes: selector) ifTrue: [
  1557. self senders add: value]]]
  1558. ! !
  1559. !ReferencesBrowser methodsFor: 'initialization'!
  1560. initialize
  1561. super initialize.
  1562. selector := ''
  1563. ! !
  1564. !ReferencesBrowser methodsFor: 'private'!
  1565. setInputEvents
  1566. input
  1567. onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
  1568. onKeyDown: [timer ifNotNil: [timer clearTimeout]]
  1569. ! !
  1570. !ReferencesBrowser methodsFor: 'rendering'!
  1571. renderBoxOn: html
  1572. self
  1573. renderInputOn: html;
  1574. renderImplementorsOn: html;
  1575. renderSendersOn: html;
  1576. renderReferencedClassesOn: html;
  1577. renderMatchesOn: html
  1578. !
  1579. renderImplementorsOn: html
  1580. implementorsList := html ul class: 'jt_column implementors'.
  1581. self updateImplementorsList
  1582. !
  1583. renderInputOn: html
  1584. input := html input
  1585. class: 'implementors';
  1586. yourself.
  1587. input asJQuery val: selector.
  1588. self setInputEvents
  1589. !
  1590. renderMatchesOn: html
  1591. matchesList := html ul class: 'jt_column matches'.
  1592. self updateMatchesList
  1593. !
  1594. renderReferencedClassesOn: html
  1595. referencedClassesList := html ul class: 'jt_column referenced_classes'.
  1596. self updateReferencedClassesList
  1597. !
  1598. renderSendersOn: html
  1599. sendersList := html ul class: 'jt_column senders'.
  1600. self updateSendersList
  1601. ! !
  1602. !ReferencesBrowser methodsFor: 'testing'!
  1603. canBeClosed
  1604. ^true
  1605. ! !
  1606. !ReferencesBrowser methodsFor: 'updating'!
  1607. updateImplementorsList
  1608. implementorsList contents: [:html |
  1609. html li
  1610. class: 'column_label';
  1611. with: 'Implementors (', self implementors size asString, ')';
  1612. style: 'font-weight: bold'.
  1613. self implementors do: [:each || li |
  1614. li := html li.
  1615. li
  1616. with: (each methodClass asString, ' >> ', self selector);
  1617. onClick: [self openBrowserOn: each]]]
  1618. !
  1619. updateMatchesList
  1620. matchesList contents: [:html |
  1621. html li
  1622. class: 'column_label';
  1623. with: 'Regex matches (', self matches size asString, ')';
  1624. style: 'font-weight: bold'.
  1625. self matches do: [:each || li |
  1626. li := html li.
  1627. li
  1628. with: (each methodClass asString, ' >> ', each selector);
  1629. onClick: [self openBrowserOn: each]]]
  1630. !
  1631. updateReferencedClassesList
  1632. referencedClassesList contents: [:html |
  1633. html li
  1634. class: 'column_label';
  1635. with: 'Class references (', self referencedClasses size asString, ')';
  1636. style: 'font-weight: bold'.
  1637. self referencedClasses do: [:each |
  1638. html li
  1639. with: (each methodClass asString, ' >> ', each selector);
  1640. onClick: [self openBrowserOn: each]]]
  1641. !
  1642. updateSendersList
  1643. sendersList contents: [:html |
  1644. html li
  1645. class: 'column_label';
  1646. with: 'Senders (', self senders size asString, ')';
  1647. style: 'font-weight: bold'.
  1648. self senders do: [:each |
  1649. html li
  1650. with: (each methodClass asString, ' >> ', each selector);
  1651. onClick: [self openBrowserOn: each]]]
  1652. ! !
  1653. !ReferencesBrowser class methodsFor: 'instance creation'!
  1654. search: aString
  1655. ^self new
  1656. searchReferencesFor: aString;
  1657. open
  1658. ! !
  1659. TabWidget subclass: #TestRunner
  1660. instanceVariableNames: 'selectedCategories packagesList selectedClasses classesList selectedMethods progressBar methodsList result statusDiv'
  1661. package: 'IDE'!
  1662. !TestRunner methodsFor: 'accessing'!
  1663. allClasses
  1664. ^TestCase allSubclasses
  1665. !
  1666. classes
  1667. ^(self allClasses
  1668. select: [:each | self selectedCategories includes: each category])
  1669. sort: [:a :b | a name > b name]
  1670. !
  1671. label
  1672. ^'SUnit'
  1673. !
  1674. packages
  1675. | packages |
  1676. packages := Array new.
  1677. self allClasses do: [:each |
  1678. (packages includes: each category) ifFalse: [
  1679. packages add: each category]].
  1680. ^packages sort
  1681. !
  1682. progressBar
  1683. ^progressBar ifNil: [progressBar := ProgressBar new]
  1684. !
  1685. result
  1686. ^result
  1687. !
  1688. selectedCategories
  1689. ^selectedCategories ifNil: [selectedCategories := Array new]
  1690. !
  1691. selectedClasses
  1692. ^selectedClasses ifNil: [selectedClasses := Array new]
  1693. !
  1694. statusInfo
  1695. ^self printTotal, self printPasses, self printErrors, self printFailures
  1696. !
  1697. testCases
  1698. | testCases |
  1699. testCases := #().
  1700. self selectedClasses do: [:each | testCases addAll: each buildSuite].
  1701. ^testCases
  1702. ! !
  1703. !TestRunner methodsFor: 'actions'!
  1704. performFailure: aTestCase
  1705. aTestCase perform: aTestCase selector
  1706. !
  1707. run: aCollection
  1708. result := TestResult new.
  1709. self
  1710. updateStatusDiv;
  1711. updateMethodsList.
  1712. self progressBar updatePercent: 0.
  1713. result total: aCollection size.
  1714. aCollection do: [:each |
  1715. [each runCaseFor: result.
  1716. self progressBar updatePercent: result runs / result total * 100.
  1717. self updateStatusDiv.
  1718. self updateMethodsList] valueWithTimeout: 100].
  1719. !
  1720. selectAllCategories
  1721. self packages do: [:each |
  1722. (selectedCategories includes: each) ifFalse: [
  1723. self selectedCategories add: each]].
  1724. self
  1725. updateCategoriesList;
  1726. updateClassesList
  1727. !
  1728. selectAllClasses
  1729. self classes do: [:each |
  1730. (selectedClasses includes: each) ifFalse: [
  1731. self selectedClasses add: each]].
  1732. self
  1733. updateCategoriesList;
  1734. updateClassesList
  1735. !
  1736. toggleCategory: aCategory
  1737. (self isSelectedCategory: aCategory)
  1738. ifFalse: [selectedCategories add: aCategory]
  1739. ifTrue: [selectedCategories remove: aCategory].
  1740. self
  1741. updateCategoriesList;
  1742. updateClassesList
  1743. !
  1744. toggleClass: aClass
  1745. (self isSelectedClass: aClass)
  1746. ifFalse: [selectedClasses add: aClass]
  1747. ifTrue: [selectedClasses remove: aClass].
  1748. self
  1749. updateClassesList
  1750. ! !
  1751. !TestRunner methodsFor: 'initialization'!
  1752. initialize
  1753. super initialize.
  1754. result := TestResult new
  1755. ! !
  1756. !TestRunner methodsFor: 'printing'!
  1757. printErrors
  1758. ^self result errors size asString , ' errors, '
  1759. !
  1760. printFailures
  1761. ^self result failures size asString, ' failures'
  1762. !
  1763. printPasses
  1764. ^(self result total - self result errors size - self result failures size) asString , ' passes, '
  1765. !
  1766. printTotal
  1767. ^self result total asString, ' runs, '
  1768. ! !
  1769. !TestRunner methodsFor: 'rendering'!
  1770. renderBoxOn: html
  1771. self
  1772. renderCategoriesOn: html;
  1773. renderClassesOn: html;
  1774. renderResultsOn: html
  1775. !
  1776. renderButtonsOn: html
  1777. html button
  1778. with: 'Run selected';
  1779. onClick: [self run: self testCases]
  1780. !
  1781. renderCategoriesOn: html
  1782. packagesList := html ul class: 'jt_column sunit packages'.
  1783. self updateCategoriesList
  1784. !
  1785. renderClassesOn: html
  1786. classesList := html ul class: 'jt_column sunit classes'.
  1787. self updateClassesList
  1788. !
  1789. renderErrorsOn: html
  1790. self result errors do: [:each |
  1791. html li
  1792. class: 'errors';
  1793. with: each class name, ' >> ', each selector;
  1794. onClick: [self performFailure: each]]
  1795. !
  1796. renderFailuresOn: html
  1797. self result failures do: [:each |
  1798. html li
  1799. class: 'failures';
  1800. with: each class name, ' >> ', each selector;
  1801. onClick: [self performFailure: each]]
  1802. !
  1803. renderResultsOn: html
  1804. statusDiv := html div.
  1805. html with: self progressBar.
  1806. methodsList := html ul class: 'jt_column sunit results'.
  1807. self updateMethodsList.
  1808. self updateStatusDiv
  1809. ! !
  1810. !TestRunner methodsFor: 'testing'!
  1811. isSelectedCategory: aCategory
  1812. ^(self selectedCategories includes: aCategory)
  1813. !
  1814. isSelectedClass: aClass
  1815. ^(self selectedClasses includes: aClass)
  1816. ! !
  1817. !TestRunner methodsFor: 'updating'!
  1818. updateCategoriesList
  1819. packagesList contents: [:html |
  1820. html li
  1821. class: 'all';
  1822. with: 'All';
  1823. onClick: [self selectAllCategories].
  1824. self packages do: [:each || li |
  1825. li := html li.
  1826. (self selectedCategories includes: each) ifTrue: [
  1827. li class: 'selected'].
  1828. li
  1829. with: each;
  1830. onClick: [self toggleCategory: each]]]
  1831. !
  1832. updateClassesList
  1833. classesList contents: [:html |
  1834. (self selectedCategories isEmpty) ifFalse: [
  1835. html li
  1836. class: 'all';
  1837. with: 'All';
  1838. onClick: [self selectAllClasses]].
  1839. self classes do: [:each || li |
  1840. li := html li.
  1841. (self selectedClasses includes: each) ifTrue: [
  1842. li class: 'selected'].
  1843. li
  1844. with: each name;
  1845. onClick: [self toggleClass: each]]]
  1846. !
  1847. updateMethodsList
  1848. methodsList contents: [:html |
  1849. self renderErrorsOn: html.
  1850. self renderFailuresOn: html]
  1851. !
  1852. updateStatusDiv
  1853. statusDiv class: 'sunit status ', result status.
  1854. statusDiv contents: [:html |
  1855. html span with: self statusInfo]
  1856. ! !
  1857. TabWidget subclass: #Workspace
  1858. instanceVariableNames: 'sourceArea'
  1859. package: 'IDE'!
  1860. !Workspace methodsFor: 'accessing'!
  1861. label
  1862. ^'Workspace'
  1863. ! !
  1864. !Workspace methodsFor: 'actions'!
  1865. clearWorkspace
  1866. sourceArea clear
  1867. !
  1868. doIt
  1869. sourceArea doIt
  1870. !
  1871. fileIn
  1872. sourceArea fileIn
  1873. !
  1874. inspectIt
  1875. sourceArea inspectIt
  1876. !
  1877. printIt
  1878. sourceArea printIt
  1879. ! !
  1880. !Workspace methodsFor: 'rendering'!
  1881. renderBoxOn: html
  1882. sourceArea := SourceArea new.
  1883. sourceArea renderOn: html
  1884. !
  1885. renderButtonsOn: html
  1886. html button
  1887. with: 'DoIt';
  1888. title: 'ctrl+d';
  1889. onClick: [self doIt].
  1890. html button
  1891. with: 'PrintIt';
  1892. title: 'ctrl+p';
  1893. onClick: [self printIt].
  1894. html button
  1895. with: 'InspectIt';
  1896. title: 'ctrl+i';
  1897. onClick: [self inspectIt].
  1898. html button
  1899. with: 'FileIn';
  1900. title: 'ctrl+f';
  1901. onClick: [self fileIn].
  1902. html button
  1903. with: 'Clear workspace';
  1904. onClick: [self clearWorkspace]
  1905. ! !
  1906. !Object methodsFor: '*IDE'!
  1907. inspect
  1908. Inspector new
  1909. inspect: self;
  1910. open
  1911. !
  1912. inspectOn: anInspector
  1913. | variables |
  1914. variables := Dictionary new.
  1915. variables at: '#self' put: self.
  1916. self class allInstanceVariableNames do: [:each |
  1917. variables at: each put: (self instVarAt: each)].
  1918. anInspector
  1919. setLabel: self printString;
  1920. setVariables: variables
  1921. ! !
  1922. !Collection methodsFor: '*IDE'!
  1923. inspectOn: anInspector
  1924. | variables |
  1925. variables := Dictionary new.
  1926. variables at: '#self' put: self.
  1927. self withIndexDo: [:each :i |
  1928. variables at: i put: each].
  1929. anInspector
  1930. setLabel: self printString;
  1931. setVariables: variables
  1932. ! !
  1933. !HashedCollection methodsFor: '*IDE'!
  1934. inspectOn: anInspector
  1935. | variables |
  1936. variables := Dictionary new.
  1937. variables at: '#self' put: self.
  1938. variables at: '#keys' put: self keys.
  1939. self keysAndValuesDo: [:key :value |
  1940. variables at: key put: value].
  1941. anInspector
  1942. setLabel: self printString;
  1943. setVariables: variables
  1944. ! !
  1945. !String methodsFor: '*IDE'!
  1946. inspectOn: anInspector
  1947. | label |
  1948. super inspectOn: anInspector.
  1949. self printString size > 30
  1950. ifTrue: [label := (self printString copyFrom: 1 to: 30), '...''']
  1951. ifFalse: [label := self printString].
  1952. anInspector setLabel: label
  1953. ! !
  1954. !Set methodsFor: '*IDE'!
  1955. inspectOn: anInspector
  1956. | variables |
  1957. variables := Dictionary new.
  1958. variables at: '#self' put: self.
  1959. elements withIndexDo: [:each :i |
  1960. variables at: i put: each].
  1961. anInspector
  1962. setLabel: self printString;
  1963. setVariables: variables
  1964. ! !
  1965. !Date methodsFor: '*IDE'!
  1966. inspectOn: anInspector
  1967. | variables |
  1968. variables := Dictionary new.
  1969. variables at: '#self' put: self.
  1970. variables at: '#year' put: self year.
  1971. variables at: '#month' put: self month.
  1972. variables at: '#day' put: self day.
  1973. variables at: '#hours' put: self hours.
  1974. variables at: '#minutes' put: self minutes.
  1975. variables at: '#seconds' put: self seconds.
  1976. variables at: '#milliseconds' put: self milliseconds.
  1977. anInspector
  1978. setLabel: self printString;
  1979. setVariables: variables
  1980. ! !
  1981. !Date methodsFor: '*IDE'!
  1982. inspectOn: anInspector
  1983. | variables |
  1984. variables := Dictionary new.
  1985. variables at: '#self' put: self.
  1986. variables at: '#year' put: self year.
  1987. variables at: '#month' put: self month.
  1988. variables at: '#day' put: self day.
  1989. variables at: '#hours' put: self hours.
  1990. variables at: '#minutes' put: self minutes.
  1991. variables at: '#seconds' put: self seconds.
  1992. variables at: '#milliseconds' put: self milliseconds.
  1993. anInspector
  1994. setLabel: self printString;
  1995. setVariables: variables
  1996. ! !
  1997. !MethodContext methodsFor: '*IDE'!
  1998. inspectOn: anInspector
  1999. | variables |
  2000. variables := Dictionary new.
  2001. variables at: '#self' put: self.
  2002. variables at: '#home' put: self home.
  2003. variables at: '#receiver' put: self receiver.
  2004. variables at: '#selector' put: self selector.
  2005. variables at: '#temps' put: self temps.
  2006. self class instanceVariableNames do: [:each |
  2007. variables at: each put: (self instVarAt: each)].
  2008. anInspector
  2009. setLabel: self printString;
  2010. setVariables: variables
  2011. ! !