IDE.st 50 KB

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