2
0

IDE.st 50 KB

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