1
0

IDE.st 49 KB

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