IDE.st 50 KB

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