2
0

IDE.st 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390
  1. Smalltalk 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. Object 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 register: self new
  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: 'default',
  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 globals 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. Inspector register: IDEInspector.
  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 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 methodsInProtocol: selectedProtocol ])
  595. sort: [ :a :b | a selector < b selector ]
  596. !
  597. packages
  598. | packages |
  599. packages := Array new.
  600. Smalltalk classes do: [ :each |
  601. (packages includes: each category) ifFalse: [
  602. packages add: each category ]].
  603. ^ packages sort
  604. !
  605. protocols
  606. | klass |
  607. selectedClass ifNotNil: [
  608. selectedTab = #comment ifTrue: [ ^ #() ].
  609. klass := selectedTab = #instance
  610. ifTrue: [ selectedClass ]
  611. ifFalse: [ selectedClass class ].
  612. klass methodDictionary isEmpty ifTrue: [
  613. ^ Array with: 'not yet classified' ].
  614. ^ klass protocols ].
  615. ^ Array new
  616. !
  617. selectedClass
  618. ^ selectedClass
  619. !
  620. selectedPackage
  621. ^ selectedPackage
  622. !
  623. source
  624. selectedTab = #comment ifFalse: [
  625. ^ (selectedProtocol notNil or: [ selectedMethod notNil ])
  626. ifFalse: [ self declarationSource ]
  627. ifTrue: [ self methodSource ]].
  628. ^ selectedClass
  629. ifNil: [ '' ]
  630. ifNotNil: [ self classCommentSource ]
  631. ! !
  632. !Browser methodsFor: 'actions'!
  633. addInstanceVariableNamed: aString toClass: aClass
  634. ClassBuilder new
  635. addSubclassOf: aClass superclass
  636. named: aClass name
  637. instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)
  638. package: aClass package name
  639. !
  640. addNewClass
  641. | className |
  642. className := self prompt: 'New class'.
  643. (className notNil and: [ className notEmpty ]) ifTrue: [
  644. Object subclass: className instanceVariableNames: '' package: self selectedPackage.
  645. self
  646. resetClassesList;
  647. updateClassesList.
  648. self selectClass: (Smalltalk globals at: className) ]
  649. !
  650. addNewProtocol
  651. | newProtocol |
  652. newProtocol := self prompt: 'New method protocol'.
  653. (newProtocol notNil and: [ newProtocol notEmpty ]) ifTrue: [
  654. selectedMethod protocol: newProtocol.
  655. self setMethodProtocol: newProtocol ]
  656. !
  657. cancelChanges
  658. ^ unsavedChanges
  659. ifTrue: [ self confirm: 'Cancel changes?' ]
  660. ifFalse: [ true ]
  661. !
  662. commitPackage
  663. selectedPackage ifNotNil: [
  664. (Package named: selectedPackage) commit ]
  665. !
  666. compile
  667. | currentEditLine |
  668. self disableSaveButton.
  669. currentEditLine := sourceArea editor getCursor.
  670. selectedTab = #comment
  671. ifTrue: [
  672. selectedClass ifNotNil: [
  673. self compileClassComment ]]
  674. ifFalse: [
  675. (selectedProtocol notNil or: [ selectedMethod notNil ])
  676. ifFalse: [ self compileDefinition ]
  677. ifTrue: [ self compileMethodDefinition ]].
  678. sourceArea editor setCursor: currentEditLine.
  679. !
  680. compileClassComment
  681. selectedClass comment: sourceArea val
  682. !
  683. compileDefinition
  684. | newClass |
  685. newClass := Compiler new evaluateExpression: sourceArea val.
  686. self
  687. resetClassesList;
  688. updateCategoriesList;
  689. updateClassesList.
  690. self selectClass: newClass
  691. !
  692. compileMethodDefinition
  693. selectedTab = #instance
  694. ifTrue: [ self compileMethodDefinitionFor: selectedClass ]
  695. ifFalse: [ self compileMethodDefinitionFor: selectedClass class ]
  696. !
  697. compileMethodDefinitionFor: aClass
  698. | compiler method source node |
  699. source := sourceArea val.
  700. selectedProtocol ifNil: [ selectedProtocol := selectedMethod protocol ].
  701. compiler := Compiler new.
  702. compiler source: source.
  703. node := compiler parse: source.
  704. node isParseFailure ifTrue: [
  705. ^ self alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString ].
  706. compiler currentClass: aClass.
  707. method := compiler eval: (compiler compileNode: node).
  708. compiler unknownVariables do: [ :each |
  709. "Do not try to redeclare javascript's objects"
  710. (PlatformInterface existsGlobal: each) ifFalse: [
  711. (self confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
  712. self addInstanceVariableNamed: each toClass: aClass.
  713. ^ self compileMethodDefinitionFor: aClass ]] ].
  714. ClassBuilder new installMethod: method forClass: aClass protocol: selectedProtocol.
  715. self updateMethodsList.
  716. self selectMethod: method
  717. !
  718. copyClass
  719. | className |
  720. className := self prompt: 'Copy class'.
  721. (className notNil and: [ className notEmpty ]) ifTrue: [
  722. ClassBuilder new copyClass: self selectedClass named: className.
  723. self
  724. resetClassesList;
  725. updateClassesList.
  726. self selectClass: (Smalltalk globals at: className) ]
  727. !
  728. disableSaveButton
  729. saveButton ifNotNil: [
  730. saveButton at: 'disabled' put: true ].
  731. unsavedChanges := false
  732. !
  733. handleSourceAreaKeyDown: anEvent
  734. <if(anEvent.ctrlKey) {
  735. if(anEvent.keyCode === 83) { //ctrl+s
  736. self._compile();
  737. anEvent.preventDefault();
  738. return false;
  739. }
  740. }
  741. >
  742. !
  743. hideClassButtons
  744. classButtons asJQuery hide
  745. !
  746. hideMethodButtons
  747. methodButtons asJQuery hide
  748. !
  749. removeClass
  750. (self confirm: 'Do you really want to remove ', selectedClass name, '?')
  751. ifTrue: [
  752. Smalltalk removeClass: selectedClass.
  753. self resetClassesList.
  754. self selectClass: nil ]
  755. !
  756. removeMethod
  757. self cancelChanges ifTrue: [
  758. (self confirm: 'Do you really want to remove #', selectedMethod selector, '?')
  759. ifTrue: [
  760. selectedTab = #instance
  761. ifTrue: [ selectedClass removeCompiledMethod: selectedMethod ]
  762. ifFalse: [ selectedClass class removeCompiledMethod: selectedMethod ].
  763. self selectMethod: nil ]]
  764. !
  765. removePackage
  766. (self confirm: 'Do you really want to remove the whole package ', selectedPackage, ' with all its classes?')
  767. ifTrue: [
  768. Smalltalk removePackage: selectedPackage.
  769. self updateCategoriesList ]
  770. !
  771. renameClass
  772. | newName |
  773. newName := self prompt: 'Rename class ', selectedClass name.
  774. (newName notNil and: [ newName notEmpty ]) ifTrue: [
  775. selectedClass rename: newName.
  776. self
  777. updateClassesList;
  778. updateSourceAndButtons ]
  779. !
  780. renamePackage
  781. | newName |
  782. newName := self prompt: 'Rename package ', selectedPackage.
  783. newName ifNotNil: [
  784. newName notEmpty ifTrue: [
  785. Smalltalk renamePackage: selectedPackage to: newName.
  786. self updateCategoriesList ]]
  787. !
  788. search: aString
  789. self cancelChanges ifTrue: [ | searchedClass |
  790. searchedClass := Smalltalk globals at: aString.
  791. searchedClass isClass
  792. ifTrue: [ self class openOn: searchedClass ]
  793. ifFalse: [ self searchReferencesOf: aString ]]
  794. !
  795. searchClassReferences
  796. ReferencesBrowser search: selectedClass name
  797. !
  798. searchReferencesOf: aString
  799. ReferencesBrowser search: aString
  800. !
  801. selectCategory: aCategory
  802. self cancelChanges ifTrue: [
  803. selectedPackage := aCategory.
  804. selectedClass := selectedProtocol := selectedMethod := nil.
  805. self resetClassesList.
  806. self
  807. updateCategoriesList;
  808. updateClassesList;
  809. updateProtocolsList;
  810. updateMethodsList;
  811. updateSourceAndButtons ]
  812. !
  813. selectClass: aClass
  814. self cancelChanges ifTrue: [
  815. selectedClass := aClass.
  816. selectedProtocol := selectedMethod := nil.
  817. self
  818. updateClassesList;
  819. updateProtocolsList;
  820. updateMethodsList;
  821. updateSourceAndButtons ]
  822. !
  823. selectMethod: aMethod
  824. self cancelChanges ifTrue: [
  825. selectedMethod := aMethod.
  826. self
  827. updateProtocolsList;
  828. updateMethodsList;
  829. updateSourceAndButtons ]
  830. !
  831. selectProtocol: aString
  832. self cancelChanges ifTrue: [
  833. selectedProtocol := aString.
  834. selectedMethod := nil.
  835. self
  836. updateProtocolsList;
  837. updateMethodsList;
  838. updateSourceAndButtons ]
  839. !
  840. selectTab: aString
  841. self cancelChanges ifTrue: [
  842. selectedTab := aString.
  843. self selectProtocol: nil.
  844. self updateTabsList ]
  845. !
  846. setMethodProtocol: aString
  847. self cancelChanges ifTrue: [
  848. (self protocols includes: aString)
  849. ifFalse: [ self addNewProtocol ]
  850. ifTrue: [
  851. selectedMethod protocol: aString.
  852. selectedProtocol := aString.
  853. selectedMethod := selectedMethod.
  854. self
  855. updateProtocolsList;
  856. updateMethodsList;
  857. updateSourceAndButtons ]]
  858. !
  859. showClassButtons
  860. classButtons asJQuery show
  861. !
  862. showMethodButtons
  863. methodButtons asJQuery show
  864. ! !
  865. !Browser methodsFor: 'initialization'!
  866. initialize
  867. super initialize.
  868. selectedTab := #instance.
  869. selectedPackage := self packages first.
  870. unsavedChanges := false
  871. ! !
  872. !Browser methodsFor: 'rendering'!
  873. renderBottomPanelOn: html
  874. html div
  875. class: 'amber_sourceCode';
  876. with: [
  877. sourceArea := SourceArea new.
  878. sourceArea renderOn: html.
  879. sourceArea onKeyDown: [ :e |
  880. self handleSourceAreaKeyDown: e ].
  881. sourceArea onKeyUp: [ self updateStatus ]]
  882. !
  883. renderBoxOn: html
  884. self
  885. renderTopPanelOn: html;
  886. renderTabsOn: html;
  887. renderBottomPanelOn: html
  888. !
  889. renderButtonsOn: html
  890. saveButton := html button.
  891. saveButton
  892. with: 'Save';
  893. onClick: [ self compile ].
  894. methodButtons := html span.
  895. classButtons := html span.
  896. html div
  897. class: 'right';
  898. with: [
  899. html button
  900. with: 'DoIt';
  901. onClick: [ sourceArea doIt ].
  902. html button
  903. with: 'PrintIt';
  904. onClick: [ sourceArea printIt ].
  905. html button with: 'InspectIt';
  906. onClick: [ sourceArea inspectIt ]].
  907. self updateSourceAndButtons
  908. !
  909. renderTabsOn: html
  910. tabsList := html ul class: 'amber_tabs amber_browser'.
  911. self updateTabsList.
  912. !
  913. renderTopPanelOn: html
  914. html div
  915. class: 'top';
  916. with: [
  917. packagesList := html ul class: 'amber_column browser packages'.
  918. html div class: 'amber_packagesButtons'; with: [
  919. html button
  920. title: 'Commit classes in this package to disk';
  921. onClick: [ self commitPackage ];
  922. with: 'Commit'.
  923. html button
  924. title: 'Rename package';
  925. onClick: [ self renamePackage ];
  926. with: 'Rename'.
  927. html button
  928. title: 'Remove this package from the system';
  929. onClick: [ self removePackage ];
  930. with: 'Remove' ].
  931. classesList := ClassesList on: self.
  932. classesList renderOn: html.
  933. protocolsList := html ul class: 'amber_column browser protocols'.
  934. methodsList := html ul class: 'amber_column browser methods'.
  935. self
  936. updateCategoriesList;
  937. updateClassesList;
  938. updateProtocolsList;
  939. updateMethodsList.
  940. html div class: 'amber_clear' ]
  941. ! !
  942. !Browser methodsFor: 'testing'!
  943. canBeClosed
  944. ^ true
  945. ! !
  946. !Browser methodsFor: 'updating'!
  947. resetClassesList
  948. classesList resetNodes
  949. !
  950. updateCategoriesList
  951. packagesList contents: [ :html |
  952. self packages do: [ :each || li label |
  953. each isEmpty
  954. ifTrue: [ label := 'Unclassified' ]
  955. ifFalse: [ label := each ].
  956. li := html li.
  957. selectedPackage = each ifTrue: [
  958. li class: 'selected' ].
  959. li
  960. with: label;
  961. onClick: [ self selectCategory: each ]] ]
  962. !
  963. updateClassesList
  964. TabManager current update.
  965. classesList updateNodes
  966. !
  967. updateMethodsList
  968. methodsList contents: [ :html |
  969. self methods do: [ :each || li |
  970. li := html li.
  971. selectedMethod = each ifTrue: [
  972. li class: 'selected' ].
  973. li
  974. with: each selector;
  975. onClick: [ self selectMethod: each ]] ]
  976. !
  977. updateProtocolsList
  978. protocolsList contents: [ :html |
  979. self protocols do: [ :each || li |
  980. li := html li.
  981. selectedProtocol = each ifTrue: [
  982. li class: 'selected' ].
  983. li
  984. with: each;
  985. onClick: [ self selectProtocol: each ]] ]
  986. !
  987. updateSourceAndButtons
  988. | currentProtocol |
  989. self disableSaveButton.
  990. classButtons contents: [ :html |
  991. html button
  992. title: 'Create a new class';
  993. onClick: [ self addNewClass ];
  994. with: 'New class'.
  995. html button
  996. with: 'Rename class';
  997. onClick: [ self renameClass ].
  998. html button
  999. with: 'Copy class';
  1000. onClick: [ self copyClass ].
  1001. html button
  1002. with: 'Remove class';
  1003. onClick: [ self removeClass ].
  1004. html button
  1005. with: 'References';
  1006. onClick: [ self searchClassReferences ]].
  1007. methodButtons contents: [ :html | | protocolSelect referencesSelect |
  1008. html button
  1009. with: 'Remove method';
  1010. onClick: [ self removeMethod ].
  1011. protocolSelect := html select.
  1012. protocolSelect
  1013. onChange: [ self setMethodProtocol: protocolSelect asJQuery val ];
  1014. with: [
  1015. html option
  1016. with: 'Method protocol';
  1017. at: 'disabled' put: 'disabled'.
  1018. html option
  1019. class: 'important';
  1020. with: 'New...'.
  1021. currentProtocol := selectedProtocol.
  1022. (currentProtocol isNil and: [ selectedMethod notNil ])
  1023. ifTrue: [ currentProtocol := selectedMethod category ].
  1024. self protocols do: [ :each | | option |
  1025. option := html option with: each.
  1026. currentProtocol = each ifTrue: [ option at: 'selected' put: 'selected' ] ] ].
  1027. selectedMethod isNil ifFalse: [
  1028. referencesSelect := html select.
  1029. referencesSelect
  1030. onChange: [ self searchReferencesOf: referencesSelect asJQuery val ];
  1031. with: [ |option|
  1032. html option
  1033. with: 'References';
  1034. at: 'disabled' put: 'disabled';
  1035. at: 'selected' put: 'selected'.
  1036. html option
  1037. class: 'important';
  1038. with: selectedMethod selector.
  1039. selectedMethod messageSends sorted do: [ :each |
  1040. html option with: each ]] ]].
  1041. selectedMethod isNil
  1042. ifTrue: [
  1043. self hideMethodButtons.
  1044. (selectedClass isNil or: [ selectedProtocol notNil ])
  1045. ifTrue: [ self hideClassButtons ]
  1046. ifFalse: [ self showClassButtons ]]
  1047. ifFalse: [
  1048. self hideClassButtons.
  1049. self showMethodButtons ].
  1050. sourceArea val: self source
  1051. !
  1052. updateStatus
  1053. sourceArea val = self source
  1054. ifTrue: [
  1055. saveButton ifNotNil: [
  1056. saveButton at: 'disabled' put: true ].
  1057. unsavedChanges := false ]
  1058. ifFalse: [
  1059. saveButton ifNotNil: [
  1060. saveButton removeAt: 'disabled' ].
  1061. unsavedChanges := true ]
  1062. !
  1063. updateTabsList
  1064. tabsList contents: [ :html || li |
  1065. li := html li.
  1066. selectedTab = #instance ifTrue: [ li class: 'selected' ].
  1067. li
  1068. with: [
  1069. html span class: 'ltab'.
  1070. html span class: 'mtab'; with: 'Instance'.
  1071. html span class: 'rtab' ];
  1072. onClick: [ self selectTab: #instance ].
  1073. li := html li.
  1074. selectedTab = #class ifTrue: [ li class: 'selected' ].
  1075. li
  1076. with: [
  1077. html span class: 'ltab'.
  1078. html span class: 'mtab'; with: 'Class'.
  1079. html span class: 'rtab' ];
  1080. onClick: [ self selectTab: #class ].
  1081. li := html li.
  1082. selectedTab = #comment ifTrue: [ li class: 'selected' ].
  1083. li
  1084. with: [
  1085. html span class: 'ltab'.
  1086. html span class: 'mtab'; with: 'Comment'.
  1087. html span class: 'rtab' ];
  1088. onClick: [ self selectTab: #comment ]]
  1089. ! !
  1090. !Browser class methodsFor: 'convenience'!
  1091. open
  1092. self new open
  1093. !
  1094. openOn: aClass
  1095. ^ self new
  1096. open;
  1097. selectCategory: aClass category;
  1098. selectClass: aClass
  1099. ! !
  1100. TabWidget subclass: #Debugger
  1101. instanceVariableNames: 'error selectedContext sourceArea ul ul2 inspector saveButton unsavedChanges selectedVariable selectedVariableName inspectButton'
  1102. package: 'IDE'!
  1103. !Debugger methodsFor: 'accessing'!
  1104. allVariables
  1105. | all |
  1106. all := Dictionary new.
  1107. self receiver class allInstanceVariableNames do: [ :each |
  1108. all at: each put: (self receiver instVarAt: each) ].
  1109. selectedContext locals keysAndValuesDo: [ :key :value |
  1110. all at: key put: value ].
  1111. ^ all
  1112. !
  1113. error
  1114. ^ error
  1115. !
  1116. error: anError
  1117. error := anError
  1118. !
  1119. label
  1120. ^ '[ Debugger ]'
  1121. !
  1122. method
  1123. ^ selectedContext method
  1124. !
  1125. receiver
  1126. ^ selectedContext receiver
  1127. !
  1128. source
  1129. ^ self method
  1130. ifNil: [ 'Method doesn''t exist!!' ]
  1131. ifNotNil: [ self method source ]
  1132. ! !
  1133. !Debugger methodsFor: 'actions'!
  1134. inspectSelectedVariable
  1135. selectedVariable inspect
  1136. !
  1137. proceed
  1138. self close.
  1139. selectedContext receiver perform: selectedContext selector withArguments: selectedContext temps
  1140. !
  1141. save
  1142. | protocol |
  1143. protocol := (selectedContext receiver class methodDictionary at: selectedContext selector) category.
  1144. selectedContext receiver class compile: sourceArea val category: protocol.
  1145. self updateStatus
  1146. !
  1147. selectContext: aContext
  1148. selectedContext := aContext.
  1149. selectedVariable := nil.
  1150. selectedVariableName := nil.
  1151. self
  1152. updateContextsList;
  1153. updateSourceArea;
  1154. updateInspector;
  1155. updateVariablesList;
  1156. updateStatus
  1157. !
  1158. selectVariable: anObject named: aString
  1159. selectedVariable := anObject.
  1160. selectedVariableName := aString.
  1161. inspector contents: [ :html | html with: anObject printString ].
  1162. self updateVariablesList
  1163. ! !
  1164. !Debugger methodsFor: 'initialization'!
  1165. initialize
  1166. super initialize.
  1167. unsavedChanges = false
  1168. ! !
  1169. !Debugger methodsFor: 'rendering'!
  1170. renderBottomPanelOn: html
  1171. html div
  1172. class: 'amber_sourceCode debugger';
  1173. with: [
  1174. sourceArea := SourceArea new.
  1175. sourceArea renderOn: html ].
  1176. ul2 := html ul class: 'amber_column debugger variables'.
  1177. inspector := html div class: 'amber_column debugger inspector'.
  1178. sourceArea
  1179. onKeyUp: [ self updateStatus ]
  1180. !
  1181. renderBoxOn: html
  1182. self
  1183. renderTopPanelOn: html;
  1184. renderBottomPanelOn: html
  1185. !
  1186. renderButtonsOn: html
  1187. saveButton := html button
  1188. with: 'Save';
  1189. onClick: [ self save ].
  1190. html button
  1191. with: 'DoIt';
  1192. onClick: [ sourceArea doIt ].
  1193. html button
  1194. with: 'PrintIt';
  1195. onClick: [ sourceArea printIt ].
  1196. html button
  1197. with: 'InspectIt';
  1198. onClick: [ sourceArea inspectIt ].
  1199. html button
  1200. with: 'Proceed';
  1201. onClick: [ self proceed ].
  1202. html button
  1203. with: 'Abandon';
  1204. onClick: [ self close ].
  1205. inspectButton := html button
  1206. class: 'amber_button debugger inspect';
  1207. with: 'Inspect';
  1208. onClick: [ self inspectSelectedVariable ].
  1209. self
  1210. updateSourceArea;
  1211. updateStatus;
  1212. updateVariablesList;
  1213. updateInspector
  1214. !
  1215. renderContext: aContext on: html
  1216. | li |
  1217. li := html li.
  1218. selectedContext = aContext ifTrue: [
  1219. li class: 'selected' ].
  1220. li
  1221. with: aContext asString;
  1222. onClick: [ self selectContext: aContext ].
  1223. aContext outerContext ifNotNil: [ self renderContext: aContext outerContext on: html ]
  1224. !
  1225. renderTopPanelOn: html
  1226. selectedContext := self error context.
  1227. html div
  1228. class: 'top';
  1229. with: [
  1230. html div
  1231. class: 'label';
  1232. with: self error messageText.
  1233. ul := html ul
  1234. class: 'amber_column debugger contexts';
  1235. with: [ self renderContext: self error context on: html ]]
  1236. ! !
  1237. !Debugger methodsFor: 'testing'!
  1238. canBeClosed
  1239. ^ true
  1240. ! !
  1241. !Debugger methodsFor: 'updating'!
  1242. updateContextsList
  1243. ul contents: [ :html |
  1244. self renderContext: self error context on: html ]
  1245. !
  1246. updateInspector
  1247. inspector contents: [ :html | ]
  1248. !
  1249. updateSourceArea
  1250. sourceArea val: self source
  1251. !
  1252. updateStatus
  1253. sourceArea val = self source
  1254. ifTrue: [
  1255. saveButton ifNotNil: [
  1256. saveButton at: 'disabled' put: true ].
  1257. unsavedChanges := false ]
  1258. ifFalse: [
  1259. saveButton ifNotNil: [
  1260. saveButton removeAt: 'disabled' ].
  1261. unsavedChanges := true ]
  1262. !
  1263. updateVariablesList
  1264. ul2 contents: [ :html | | li |
  1265. li := html li
  1266. with: 'self';
  1267. onClick: [ self selectVariable: self receiver named: 'self' ].
  1268. selectedVariableName = 'self' ifTrue: [ li class: 'selected' ].
  1269. self allVariables keysAndValuesDo: [ :key :value |
  1270. li := html li
  1271. with: key;
  1272. onClick: [ self selectVariable: value named: key ].
  1273. selectedVariableName = key ifTrue: [
  1274. li class: 'selected' ] ] ].
  1275. selectedVariable
  1276. ifNil: [ inspectButton at: 'disabled' put: true ]
  1277. ifNotNil: [ inspectButton removeAt: 'disabled' ]
  1278. ! !
  1279. TabWidget subclass: #IDEInspector
  1280. instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea diveButton sourceArea'
  1281. package: 'IDE'!
  1282. !IDEInspector methodsFor: 'accessing'!
  1283. label
  1284. ^ label ifNil: [ 'Inspector (nil)' ]
  1285. !
  1286. selectedVariable
  1287. ^ selectedVariable
  1288. !
  1289. selectedVariable: aString
  1290. selectedVariable := aString
  1291. !
  1292. setLabel: aString
  1293. label := aString
  1294. !
  1295. setVariables: aCollection
  1296. variables := aCollection
  1297. !
  1298. sourceArea
  1299. ^ sourceArea
  1300. !
  1301. variables
  1302. ^ variables
  1303. ! !
  1304. !IDEInspector methodsFor: 'actions'!
  1305. dive
  1306. (self variables at: self selectedVariable) inspect
  1307. !
  1308. inspect: anObject
  1309. object := anObject.
  1310. variables := #().
  1311. object inspectOn: self
  1312. !
  1313. refresh
  1314. self
  1315. inspect: object;
  1316. updateVariablesList;
  1317. updateValueTextarea
  1318. ! !
  1319. !IDEInspector methodsFor: 'rendering'!
  1320. renderBottomPanelOn: html
  1321. html div
  1322. class: 'amber_sourceCode';
  1323. with: [
  1324. sourceArea := SourceArea new
  1325. receiver: object;
  1326. onDoIt: [ self refresh ];
  1327. yourself.
  1328. sourceArea renderOn: html ]
  1329. !
  1330. renderBoxOn: html
  1331. self
  1332. renderTopPanelOn: html;
  1333. renderBottomPanelOn: html
  1334. !
  1335. renderButtonsOn: html
  1336. html button
  1337. with: 'DoIt';
  1338. onClick: [ self sourceArea doIt ].
  1339. html button
  1340. with: 'PrintIt';
  1341. onClick: [ self sourceArea printIt ].
  1342. html button
  1343. with: 'InspectIt';
  1344. onClick: [ self sourceArea inspectIt ].
  1345. self updateButtons
  1346. !
  1347. renderTopPanelOn: html
  1348. html div
  1349. class: 'top';
  1350. with: [
  1351. variablesList := html ul class: 'amber_column variables'.
  1352. valueTextarea := html textarea class: 'amber_column value'; at: 'readonly' put: 'readonly'; yourself.
  1353. html div class: 'amber_tabs inspector'; with: [
  1354. html button
  1355. class: 'amber_button inspector refresh';
  1356. with: 'Refresh';
  1357. onClick: [ self refresh ].
  1358. diveButton := html button
  1359. class: 'amber_button inspector dive';
  1360. with: 'Dive';
  1361. onClick: [ self dive ]].
  1362. html div class: 'amber_clear' ].
  1363. self
  1364. updateVariablesList;
  1365. updateValueTextarea.
  1366. ! !
  1367. !IDEInspector methodsFor: 'testing'!
  1368. canBeClosed
  1369. ^ true
  1370. ! !
  1371. !IDEInspector methodsFor: 'updating'!
  1372. selectVariable: aString
  1373. self selectedVariable: aString.
  1374. self
  1375. updateVariablesList;
  1376. updateValueTextarea;
  1377. updateButtons
  1378. !
  1379. updateButtons
  1380. (self selectedVariable notNil and: [ (self variables at: self selectedVariable) notNil ])
  1381. ifFalse: [ diveButton at: 'disabled' put: true ]
  1382. ifTrue: [ diveButton removeAt: 'disabled' ]
  1383. !
  1384. updateValueTextarea
  1385. valueTextarea asJQuery val: (self selectedVariable isNil
  1386. ifTrue: [ '' ]
  1387. ifFalse: [ (self variables at: self selectedVariable) printString ])
  1388. !
  1389. updateVariablesList
  1390. variablesList contents: [ :html |
  1391. self variables keysDo: [ :each || li |
  1392. li := html li.
  1393. li
  1394. with: each;
  1395. onClick: [ self selectVariable: each ].
  1396. self selectedVariable = each ifTrue: [
  1397. li class: 'selected' ]] ]
  1398. ! !
  1399. !IDEInspector class methodsFor: 'instance creation'!
  1400. inspect: anObject
  1401. ^ self new
  1402. inspect: anObject;
  1403. open;
  1404. yourself
  1405. !
  1406. on: anObject
  1407. ^ self new
  1408. inspect: anObject;
  1409. yourself
  1410. ! !
  1411. TabWidget subclass: #IDETranscript
  1412. instanceVariableNames: 'textarea'
  1413. package: 'IDE'!
  1414. !IDETranscript methodsFor: 'accessing'!
  1415. label
  1416. ^ 'Transcript'
  1417. ! !
  1418. !IDETranscript methodsFor: 'actions'!
  1419. clear
  1420. textarea asJQuery val: ''
  1421. !
  1422. cr
  1423. textarea asJQuery val: textarea asJQuery val, String cr.
  1424. !
  1425. open
  1426. TabManager current
  1427. open;
  1428. selectTab: self
  1429. !
  1430. show: anObject
  1431. textarea ifNil: [ self open ].
  1432. textarea asJQuery val: textarea asJQuery val, anObject asString.
  1433. ! !
  1434. !IDETranscript methodsFor: 'rendering'!
  1435. renderBoxOn: html
  1436. textarea := html textarea.
  1437. textarea
  1438. class: 'amber_transcript';
  1439. at: 'spellcheck' put: 'false'
  1440. !
  1441. renderButtonsOn: html
  1442. html button
  1443. with: 'Clear transcript';
  1444. onClick: [ self clear ]
  1445. ! !
  1446. IDETranscript class instanceVariableNames: 'current'!
  1447. !IDETranscript class methodsFor: 'initialization'!
  1448. initialize
  1449. Transcript register: self current
  1450. ! !
  1451. !IDETranscript class methodsFor: 'instance creation'!
  1452. current
  1453. ^ current ifNil: [ current := super new ]
  1454. !
  1455. new
  1456. self shouldNotImplement
  1457. !
  1458. open
  1459. TabManager current
  1460. open;
  1461. selectTab: self current
  1462. ! !
  1463. TabWidget subclass: #ProgressBar
  1464. instanceVariableNames: 'percent progressDiv div'
  1465. package: 'IDE'!
  1466. !ProgressBar methodsFor: 'accessing'!
  1467. percent
  1468. ^ percent ifNil: [ 0 ]
  1469. !
  1470. percent: aNumber
  1471. percent := aNumber
  1472. ! !
  1473. !ProgressBar methodsFor: 'rendering'!
  1474. renderOn: html
  1475. div := html div
  1476. class: 'progress_bar';
  1477. yourself.
  1478. self renderProgressBar
  1479. !
  1480. renderProgressBar
  1481. div contents: [ :html |
  1482. html div
  1483. class: 'progress';
  1484. style: 'width:', self percent asString, '%' ]
  1485. ! !
  1486. !ProgressBar methodsFor: 'updating'!
  1487. updatePercent: aNumber
  1488. self percent: aNumber.
  1489. self renderProgressBar
  1490. ! !
  1491. TabWidget subclass: #ReferencesBrowser
  1492. instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList matches matchesList'
  1493. package: 'IDE'!
  1494. !ReferencesBrowser methodsFor: 'accessing'!
  1495. classesAndMetaclasses
  1496. ^ Smalltalk classes, (Smalltalk classes collect: [ :each | each class ])
  1497. !
  1498. implementors
  1499. ^ implementors ifNil: [ implementors := Array new ]
  1500. !
  1501. label
  1502. ^ '[ References ]'
  1503. !
  1504. matches
  1505. ^ matches ifNil: [ matches := Array new ]
  1506. !
  1507. referencedClasses
  1508. ^ referencedClasses ifNil: [ referencedClasses := Array new ]
  1509. !
  1510. selector
  1511. ^ selector
  1512. !
  1513. senders
  1514. ^ senders ifNil: [ senders := Array new ]
  1515. ! !
  1516. !ReferencesBrowser methodsFor: 'actions'!
  1517. openBrowserOn: aMethod
  1518. | browser |
  1519. browser := Browser openOn: (aMethod methodClass isMetaclass
  1520. ifTrue: [ aMethod methodClass instanceClass ] ifFalse: [ aMethod methodClass ]).
  1521. aMethod methodClass isMetaclass ifTrue: [ browser selectTab: #class ].
  1522. browser
  1523. selectProtocol: aMethod category;
  1524. selectMethod: aMethod
  1525. !
  1526. search: aString
  1527. self
  1528. searchReferencesFor: aString;
  1529. updateImplementorsList;
  1530. updateSendersList;
  1531. updateReferencedClassesList;
  1532. updateMatchesList
  1533. !
  1534. searchMethodSource
  1535. | regex |
  1536. regex := selector allButFirst.
  1537. self classesAndMetaclasses do: [ :each |
  1538. each methodDictionary valuesDo: [ :value |
  1539. (value source match: regex) ifTrue: [
  1540. self matches add: value ]] ]
  1541. !
  1542. searchReferencedClasses
  1543. self classesAndMetaclasses do: [ :each |
  1544. each methodDictionary valuesDo: [ :value |
  1545. (value referencedClasses includes: selector) ifTrue: [
  1546. self referencedClasses add: value ]] ]
  1547. !
  1548. searchReferencesFor: aString
  1549. selector := aString.
  1550. implementors := Array new.
  1551. senders := Array new.
  1552. referencedClasses := Array new.
  1553. matches := Array new.
  1554. self searchMethodSource.
  1555. (selector match: '^[A-Z]')
  1556. ifFalse: [ self searchSelectorReferences ]
  1557. ifTrue: [ self searchReferencedClasses ]
  1558. !
  1559. searchSelectorReferences
  1560. self classesAndMetaclasses do: [ :each |
  1561. each methodDictionary keysAndValuesDo: [ :key :value |
  1562. key = selector ifTrue: [ self implementors add: value ].
  1563. (value messageSends includes: selector) ifTrue: [
  1564. self senders add: value ]] ]
  1565. ! !
  1566. !ReferencesBrowser methodsFor: 'initialization'!
  1567. initialize
  1568. super initialize.
  1569. selector := ''
  1570. ! !
  1571. !ReferencesBrowser methodsFor: 'private'!
  1572. setInputEvents
  1573. input
  1574. onKeyUp: [ timer := [ self search: input asJQuery val ] valueWithTimeout: 100 ];
  1575. onKeyDown: [ timer ifNotNil: [ timer clearTimeout ]]
  1576. ! !
  1577. !ReferencesBrowser methodsFor: 'rendering'!
  1578. renderBoxOn: html
  1579. self
  1580. renderInputOn: html;
  1581. renderImplementorsOn: html;
  1582. renderSendersOn: html;
  1583. renderReferencedClassesOn: html;
  1584. renderMatchesOn: html
  1585. !
  1586. renderImplementorsOn: html
  1587. implementorsList := html ul class: 'amber_column implementors'.
  1588. self updateImplementorsList
  1589. !
  1590. renderInputOn: html
  1591. input := html input
  1592. class: 'implementors';
  1593. yourself.
  1594. input asJQuery val: selector.
  1595. self setInputEvents
  1596. !
  1597. renderMatchesOn: html
  1598. matchesList := html ul class: 'amber_column matches'.
  1599. self updateMatchesList
  1600. !
  1601. renderReferencedClassesOn: html
  1602. referencedClassesList := html ul class: 'amber_column referenced_classes'.
  1603. self updateReferencedClassesList
  1604. !
  1605. renderSendersOn: html
  1606. sendersList := html ul class: 'amber_column senders'.
  1607. self updateSendersList
  1608. ! !
  1609. !ReferencesBrowser methodsFor: 'testing'!
  1610. canBeClosed
  1611. ^ true
  1612. ! !
  1613. !ReferencesBrowser methodsFor: 'updating'!
  1614. updateImplementorsList
  1615. implementorsList contents: [ :html |
  1616. html li
  1617. class: 'column_label';
  1618. with: 'Implementors (', self implementors size asString, ')';
  1619. style: 'font-weight: bold'.
  1620. self implementors do: [ :each || li |
  1621. li := html li.
  1622. li
  1623. with: (each methodClass asString, ' >> ', self selector);
  1624. onClick: [ self openBrowserOn: each ]] ]
  1625. !
  1626. updateMatchesList
  1627. matchesList contents: [ :html |
  1628. html li
  1629. class: 'column_label';
  1630. with: 'Regex matches (', self matches size asString, ')';
  1631. style: 'font-weight: bold'.
  1632. self matches do: [ :each || li |
  1633. li := html li.
  1634. li
  1635. with: (each methodClass asString, ' >> ', each selector);
  1636. onClick: [ self openBrowserOn: each ]] ]
  1637. !
  1638. updateReferencedClassesList
  1639. referencedClassesList contents: [ :html |
  1640. html li
  1641. class: 'column_label';
  1642. with: 'Class references (', self referencedClasses size asString, ')';
  1643. style: 'font-weight: bold'.
  1644. self referencedClasses do: [ :each |
  1645. html li
  1646. with: (each methodClass asString, ' >> ', each selector);
  1647. onClick: [ self openBrowserOn: each ]] ]
  1648. !
  1649. updateSendersList
  1650. sendersList contents: [ :html |
  1651. html li
  1652. class: 'column_label';
  1653. with: 'Senders (', self senders size asString, ')';
  1654. style: 'font-weight: bold'.
  1655. self senders do: [ :each |
  1656. html li
  1657. with: (each methodClass asString, ' >> ', each selector);
  1658. onClick: [ self openBrowserOn: each ]] ]
  1659. ! !
  1660. !ReferencesBrowser class methodsFor: 'instance creation'!
  1661. search: aString
  1662. ^ self new
  1663. searchReferencesFor: aString;
  1664. open
  1665. ! !
  1666. TabWidget subclass: #TestRunner
  1667. instanceVariableNames: 'selectedCategories packagesList selectedClasses classesList selectedMethods progressBar methodsList result statusDiv'
  1668. package: 'IDE'!
  1669. !TestRunner methodsFor: 'accessing'!
  1670. allClasses
  1671. ^ TestCase allSubclasses select: [ :each | each isAbstract not ]
  1672. !
  1673. classes
  1674. ^ (self allClasses
  1675. select: [ :each | self selectedCategories includes: each category ])
  1676. sort: [ :a :b | a name > b name ]
  1677. !
  1678. label
  1679. ^ 'SUnit'
  1680. !
  1681. packages
  1682. | packages |
  1683. packages := Array new.
  1684. self allClasses do: [ :each |
  1685. (packages includes: each category) ifFalse: [
  1686. packages add: each category ]].
  1687. ^ packages sort
  1688. !
  1689. progressBar
  1690. ^ progressBar ifNil: [ progressBar := ProgressBar new ]
  1691. !
  1692. result
  1693. ^ result
  1694. !
  1695. selectedCategories
  1696. ^ selectedCategories ifNil: [ selectedCategories := Array new ]
  1697. !
  1698. selectedClasses
  1699. ^ selectedClasses ifNil: [ selectedClasses := Array new ]
  1700. !
  1701. statusInfo
  1702. ^ self printTotal, self printPasses, self printErrors, self printFailures
  1703. !
  1704. testCases
  1705. | testCases |
  1706. testCases := #().
  1707. (self selectedClasses
  1708. select: [ :each | self selectedCategories includes: each category ])
  1709. do: [ :each | testCases addAll: each buildSuite ].
  1710. ^ testCases
  1711. ! !
  1712. !TestRunner methodsFor: 'actions'!
  1713. performFailure: aTestCase
  1714. aTestCase runCase
  1715. !
  1716. run: aCollection
  1717. | worker |
  1718. worker := TestSuiteRunner on: aCollection.
  1719. result := worker result.
  1720. worker announcer on: ResultAnnouncement do: [ :ann |
  1721. ann result == result ifTrue: [
  1722. self progressBar updatePercent: result runs / result total * 100.
  1723. self updateStatusDiv.
  1724. self updateMethodsList
  1725. ]
  1726. ].
  1727. worker run
  1728. !
  1729. selectAllCategories
  1730. self packages do: [ :each |
  1731. (selectedCategories includes: each) ifFalse: [
  1732. self selectedCategories add: each ]].
  1733. self
  1734. updateCategoriesList;
  1735. updateClassesList
  1736. !
  1737. selectAllClasses
  1738. self classes do: [ :each |
  1739. (selectedClasses includes: each) ifFalse: [
  1740. self selectedClasses add: each ]].
  1741. self
  1742. updateCategoriesList;
  1743. updateClassesList
  1744. !
  1745. toggleCategory: aCategory
  1746. (self isSelectedCategory: aCategory)
  1747. ifFalse: [ selectedCategories add: aCategory ]
  1748. ifTrue: [ selectedCategories remove: aCategory ].
  1749. self
  1750. updateCategoriesList;
  1751. updateClassesList
  1752. !
  1753. toggleClass: aClass
  1754. (self isSelectedClass: aClass)
  1755. ifFalse: [ selectedClasses add: aClass ]
  1756. ifTrue: [ selectedClasses remove: aClass ].
  1757. self
  1758. updateClassesList
  1759. ! !
  1760. !TestRunner methodsFor: 'initialization'!
  1761. initialize
  1762. super initialize.
  1763. result := TestResult new
  1764. ! !
  1765. !TestRunner methodsFor: 'printing'!
  1766. printErrors
  1767. ^ self result errors size asString , ' errors, '
  1768. !
  1769. printFailures
  1770. ^ self result failures size asString, ' failures'
  1771. !
  1772. printPasses
  1773. ^ (self result runs - self result errors size - self result failures size) asString , ' passes, '
  1774. !
  1775. printTotal
  1776. ^ self result total asString, ' runs, '
  1777. ! !
  1778. !TestRunner methodsFor: 'rendering'!
  1779. renderBoxOn: html
  1780. self
  1781. renderCategoriesOn: html;
  1782. renderClassesOn: html;
  1783. renderResultsOn: html
  1784. !
  1785. renderButtonsOn: html
  1786. html button
  1787. with: 'Run selected';
  1788. onClick: [ self run: self testCases ]
  1789. !
  1790. renderCategoriesOn: html
  1791. packagesList := html ul class: 'amber_column sunit packages'.
  1792. self updateCategoriesList
  1793. !
  1794. renderClassesOn: html
  1795. classesList := html ul class: 'amber_column sunit classes'.
  1796. self updateClassesList
  1797. !
  1798. renderErrorsOn: html
  1799. self result errors do: [ :each |
  1800. html li
  1801. class: 'errors';
  1802. with: each class name, ' >> ', each selector;
  1803. onClick: [ self performFailure: each ]]
  1804. !
  1805. renderFailuresOn: html
  1806. self result failures do: [ :each |
  1807. html li
  1808. class: 'failures';
  1809. with: each class name, ' >> ', each selector;
  1810. onClick: [ self performFailure: each ]]
  1811. !
  1812. renderResultsOn: html
  1813. statusDiv := html div.
  1814. html with: self progressBar.
  1815. methodsList := html ul class: 'amber_column sunit results'.
  1816. self updateMethodsList.
  1817. self updateStatusDiv
  1818. ! !
  1819. !TestRunner methodsFor: 'testing'!
  1820. isSelectedCategory: aCategory
  1821. ^ (self selectedCategories includes: aCategory)
  1822. !
  1823. isSelectedClass: aClass
  1824. ^ (self selectedClasses includes: aClass)
  1825. ! !
  1826. !TestRunner methodsFor: 'updating'!
  1827. updateCategoriesList
  1828. packagesList contents: [ :html |
  1829. html li
  1830. class: 'all';
  1831. with: 'All';
  1832. onClick: [ self selectAllCategories ].
  1833. self packages do: [ :each || li |
  1834. li := html li.
  1835. (self selectedCategories includes: each) ifTrue: [
  1836. li class: 'selected' ].
  1837. li
  1838. with: each;
  1839. onClick: [ self toggleCategory: each ]] ]
  1840. !
  1841. updateClassesList
  1842. classesList contents: [ :html |
  1843. (self selectedCategories isEmpty) ifFalse: [
  1844. html li
  1845. class: 'all';
  1846. with: 'All';
  1847. onClick: [ self selectAllClasses ]].
  1848. self classes do: [ :each || li |
  1849. li := html li.
  1850. (self selectedClasses includes: each) ifTrue: [
  1851. li class: 'selected' ].
  1852. li
  1853. with: each name;
  1854. onClick: [ self toggleClass: each ]] ]
  1855. !
  1856. updateMethodsList
  1857. methodsList contents: [ :html |
  1858. self renderErrorsOn: html.
  1859. self renderFailuresOn: html ]
  1860. !
  1861. updateStatusDiv
  1862. statusDiv class: 'sunit status ', result status.
  1863. statusDiv contents: [ :html |
  1864. html span with: self statusInfo ]
  1865. ! !
  1866. TabWidget subclass: #Workspace
  1867. instanceVariableNames: 'sourceArea'
  1868. package: 'IDE'!
  1869. !Workspace methodsFor: 'accessing'!
  1870. label
  1871. ^ 'Workspace'
  1872. ! !
  1873. !Workspace methodsFor: 'actions'!
  1874. clearWorkspace
  1875. sourceArea clear
  1876. !
  1877. doIt
  1878. sourceArea doIt
  1879. !
  1880. fileIn
  1881. sourceArea fileIn
  1882. !
  1883. inspectIt
  1884. sourceArea inspectIt
  1885. !
  1886. printIt
  1887. sourceArea printIt
  1888. !
  1889. show
  1890. super show.
  1891. sourceArea focus.
  1892. ! !
  1893. !Workspace methodsFor: 'rendering'!
  1894. renderBoxOn: html
  1895. sourceArea := SourceArea new.
  1896. sourceArea renderOn: html
  1897. !
  1898. renderButtonsOn: html
  1899. html button
  1900. with: 'DoIt';
  1901. title: 'ctrl+d';
  1902. onClick: [ self doIt ].
  1903. html button
  1904. with: 'PrintIt';
  1905. title: 'ctrl+p';
  1906. onClick: [ self printIt ].
  1907. html button
  1908. with: 'InspectIt';
  1909. title: 'ctrl+i';
  1910. onClick: [ self inspectIt ].
  1911. html button
  1912. with: 'FileIn';
  1913. title: 'ctrl+f';
  1914. onClick: [ self fileIn ].
  1915. html button
  1916. with: 'Clear workspace';
  1917. onClick: [ self clearWorkspace ]
  1918. ! !
  1919. !Date methodsFor: '*IDE'!
  1920. inspectOn: anInspector
  1921. | variables |
  1922. variables := Dictionary new.
  1923. variables at: '#self' put: self.
  1924. variables at: '#year' put: self year.
  1925. variables at: '#month' put: self month.
  1926. variables at: '#day' put: self day.
  1927. variables at: '#hours' put: self hours.
  1928. variables at: '#minutes' put: self minutes.
  1929. variables at: '#seconds' put: self seconds.
  1930. variables at: '#milliseconds' put: self milliseconds.
  1931. anInspector
  1932. setLabel: self printString;
  1933. setVariables: variables
  1934. ! !
  1935. !Collection methodsFor: '*IDE'!
  1936. inspectOn: anInspector
  1937. | variables |
  1938. variables := Dictionary new.
  1939. variables at: '#self' put: self.
  1940. self withIndexDo: [ :each :i |
  1941. variables at: i put: each ].
  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. !MethodContext methodsFor: '*IDE'!
  1956. inspectOn: anInspector
  1957. | variables |
  1958. variables := Dictionary new.
  1959. variables at: '#self' put: self.
  1960. variables at: '#home' put: self home.
  1961. variables at: '#receiver' put: self receiver.
  1962. variables at: '#selector' put: self selector.
  1963. variables at: '#temps' put: self temps.
  1964. self class instanceVariableNames do: [ :each |
  1965. variables at: each put: (self instVarAt: each) ].
  1966. anInspector
  1967. setLabel: self printString;
  1968. setVariables: variables
  1969. ! !
  1970. !AssociativeCollection methodsFor: '*IDE'!
  1971. inspectOn: anInspector
  1972. | variables |
  1973. variables := Dictionary new.
  1974. variables at: '#self' put: self.
  1975. variables at: '#keys' put: self keys.
  1976. self keysAndValuesDo: [ :key :value |
  1977. variables at: key put: value ].
  1978. anInspector
  1979. setLabel: self printString;
  1980. setVariables: variables
  1981. ! !
  1982. !Set methodsFor: '*IDE'!
  1983. inspectOn: anInspector
  1984. | variables i |
  1985. variables := Dictionary new.
  1986. variables at: '#self' put: self.
  1987. i := 1.
  1988. self do: [ :each |
  1989. variables at: i put: each.
  1990. i := i + 1 ].
  1991. anInspector
  1992. setLabel: self printString;
  1993. setVariables: variables
  1994. ! !