IDE.st 51 KB

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