1
0

IDE.st 48 KB

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