1
0

IDE.st 50 KB

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