IDE.st 50 KB

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