IDE.st 48 KB

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