IDE.st 50 KB

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