IDE.st 51 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. compile
  658. | currentEditLine |
  659. self disableSaveButton.
  660. currentEditLine := sourceArea editor getCursor.
  661. selectedTab = #comment
  662. ifTrue: [
  663. selectedClass ifNotNil: [
  664. self compileClassComment]]
  665. ifFalse: [
  666. (selectedProtocol notNil or: [selectedMethod notNil])
  667. ifFalse: [self compileDefinition]
  668. ifTrue: [self compileMethodDefinition]].
  669. sourceArea editor setCursor: currentEditLine.
  670. !
  671. compileClassComment
  672. selectedClass comment: sourceArea val
  673. !
  674. compileDefinition
  675. | newClass |
  676. newClass := Compiler new evaluateExpression: sourceArea val.
  677. self
  678. resetClassesList;
  679. updateCategoriesList;
  680. updateClassesList.
  681. self selectClass: newClass
  682. !
  683. compileMethodDefinition
  684. selectedTab = #instance
  685. ifTrue: [self compileMethodDefinitionFor: selectedClass]
  686. ifFalse: [self compileMethodDefinitionFor: selectedClass class]
  687. !
  688. compileMethodDefinitionFor: aClass
  689. | compiler method source node |
  690. source := sourceArea val.
  691. selectedProtocol ifNil: [selectedProtocol := selectedMethod category].
  692. compiler := Compiler new.
  693. compiler source: source.
  694. node := compiler parse: source.
  695. node isParseFailure ifTrue: [
  696. ^window alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString].
  697. compiler currentClass: aClass.
  698. method := compiler eval: (compiler compileNode: node).
  699. method category: selectedProtocol.
  700. compiler unknownVariables do: [:each |
  701. "Do not try to redeclare javascript's objects"
  702. (window at: each) ifNil: [
  703. (window confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
  704. self addInstanceVariableNamed: each toClass: aClass.
  705. ^self compileMethodDefinitionFor: aClass]]].
  706. aClass addCompiledMethod: method.
  707. compiler setupClass: aClass.
  708. self updateMethodsList.
  709. self selectMethod: method
  710. !
  711. copyClass
  712. | className |
  713. className := window prompt: 'Copy class'.
  714. (className notNil and: [className notEmpty]) ifTrue: [
  715. ClassBuilder new copyClass: self selectedClass named: className.
  716. self
  717. resetClassesList;
  718. updateClassesList.
  719. self selectClass: (Smalltalk current at: className)]
  720. !
  721. disableSaveButton
  722. saveButton ifNotNil: [
  723. saveButton at: 'disabled' put: true].
  724. unsavedChanges := false
  725. !
  726. handleSourceAreaKeyDown: anEvent
  727. <if(anEvent.ctrlKey) {
  728. if(anEvent.keyCode === 83) { //ctrl+s
  729. self._compile();
  730. anEvent.preventDefault();
  731. return false;
  732. }
  733. }
  734. >
  735. !
  736. hideClassButtons
  737. classButtons asJQuery hide
  738. !
  739. hideMethodButtons
  740. methodButtons asJQuery hide
  741. !
  742. removeClass
  743. (window confirm: 'Do you really want to remove ', selectedClass name, '?')
  744. ifTrue: [
  745. Smalltalk current removeClass: selectedClass.
  746. self resetClassesList.
  747. self selectClass: nil]
  748. !
  749. removeMethod
  750. self cancelChanges ifTrue: [
  751. (window confirm: 'Do you really want to remove #', selectedMethod selector, '?')
  752. ifTrue: [
  753. selectedTab = #instance
  754. ifTrue: [selectedClass removeCompiledMethod: selectedMethod]
  755. ifFalse: [selectedClass class removeCompiledMethod: selectedMethod].
  756. self selectMethod: nil]]
  757. !
  758. removePackage
  759. (window confirm: 'Do you really want to remove the whole package ', selectedPackage, ' with all its classes?')
  760. ifTrue: [
  761. Smalltalk current removePackage: selectedPackage.
  762. self updateCategoriesList]
  763. !
  764. renameClass
  765. | newName |
  766. newName := window prompt: 'Rename class ', selectedClass name.
  767. (newName notNil and: [newName notEmpty]) ifTrue: [
  768. selectedClass rename: newName.
  769. self
  770. updateClassesList;
  771. updateSourceAndButtons]
  772. !
  773. renamePackage
  774. | newName |
  775. newName := window prompt: 'Rename package ', selectedPackage.
  776. newName ifNotNil: [
  777. newName notEmpty ifTrue: [
  778. Smalltalk current renamePackage: selectedPackage to: newName.
  779. self updateCategoriesList]]
  780. !
  781. search: aString
  782. self cancelChanges ifTrue: [| searchedClass |
  783. searchedClass := Smalltalk current at: aString.
  784. searchedClass isClass
  785. ifTrue: [self class openOn: searchedClass]
  786. ifFalse: [self searchReferencesOf: aString]]
  787. !
  788. searchClassReferences
  789. ReferencesBrowser search: selectedClass name
  790. !
  791. searchReferencesOf: aString
  792. ReferencesBrowser search: aString
  793. !
  794. selectCategory: aCategory
  795. self cancelChanges ifTrue: [
  796. selectedPackage := aCategory.
  797. selectedClass := selectedProtocol := selectedMethod := nil.
  798. self resetClassesList.
  799. self
  800. updateCategoriesList;
  801. updateClassesList;
  802. updateProtocolsList;
  803. updateMethodsList;
  804. updateSourceAndButtons]
  805. !
  806. selectClass: aClass
  807. self cancelChanges ifTrue: [
  808. selectedClass := aClass.
  809. selectedProtocol := selectedMethod := nil.
  810. self
  811. updateClassesList;
  812. updateProtocolsList;
  813. updateMethodsList;
  814. updateSourceAndButtons]
  815. !
  816. selectMethod: aMethod
  817. self cancelChanges ifTrue: [
  818. selectedMethod := aMethod.
  819. self
  820. updateProtocolsList;
  821. updateMethodsList;
  822. updateSourceAndButtons]
  823. !
  824. selectProtocol: aString
  825. self cancelChanges ifTrue: [
  826. selectedProtocol := aString.
  827. selectedMethod := nil.
  828. self
  829. updateProtocolsList;
  830. updateMethodsList;
  831. updateSourceAndButtons]
  832. !
  833. selectTab: aString
  834. self cancelChanges ifTrue: [
  835. selectedTab := aString.
  836. self selectProtocol: nil.
  837. self updateTabsList]
  838. !
  839. setMethodProtocol: aString
  840. self cancelChanges ifTrue: [
  841. (self protocols includes: aString)
  842. ifFalse: [self addNewProtocol]
  843. ifTrue: [
  844. selectedMethod category: aString.
  845. selectedProtocol := aString.
  846. selectedMethod := selectedMethod.
  847. self
  848. updateProtocolsList;
  849. updateMethodsList;
  850. updateSourceAndButtons]]
  851. !
  852. showClassButtons
  853. classButtons asJQuery show
  854. !
  855. showMethodButtons
  856. methodButtons asJQuery show
  857. ! !
  858. !Browser methodsFor: 'initialization'!
  859. initialize
  860. super initialize.
  861. selectedTab := #instance.
  862. selectedPackage := self packages first.
  863. unsavedChanges := false
  864. ! !
  865. !Browser methodsFor: 'network'!
  866. ajaxPutAt: anURL data: aString
  867. jQuery
  868. ajax: anURL options: #{ 'type' -> 'PUT'.
  869. 'data' -> aString.
  870. 'contentType' -> 'text/plain;charset=UTF-8'.
  871. 'error' -> [window alert: 'PUT request failed at: ', anURL] }
  872. ! !
  873. !Browser methodsFor: 'rendering'!
  874. renderBottomPanelOn: html
  875. html div
  876. class: 'amber_sourceCode';
  877. with: [
  878. sourceArea := SourceArea new.
  879. sourceArea renderOn: html.
  880. sourceArea onKeyDown: [:e |
  881. self handleSourceAreaKeyDown: e].
  882. sourceArea onKeyUp: [self updateStatus]]
  883. !
  884. renderBoxOn: html
  885. self
  886. renderTopPanelOn: html;
  887. renderTabsOn: html;
  888. renderBottomPanelOn: html
  889. !
  890. renderButtonsOn: html
  891. saveButton := html button.
  892. saveButton
  893. with: 'Save';
  894. onClick: [self compile].
  895. methodButtons := html span.
  896. classButtons := html span.
  897. html div
  898. class: 'right';
  899. with: [
  900. html button
  901. with: 'DoIt';
  902. onClick: [sourceArea doIt].
  903. html button
  904. with: 'PrintIt';
  905. onClick: [sourceArea printIt].
  906. html button with: 'InspectIt';
  907. onClick: [sourceArea inspectIt]].
  908. self updateSourceAndButtons
  909. !
  910. renderTabsOn: html
  911. tabsList := html ul class: 'amber_tabs amber_browser'.
  912. self updateTabsList.
  913. !
  914. renderTopPanelOn: html
  915. html div
  916. class: 'top';
  917. with: [
  918. packagesList := html ul class: 'amber_column browser packages'.
  919. html div class: 'amber_packagesButtons'; with: [
  920. html button
  921. title: 'Commit classes in this package to disk';
  922. onClick: [self commitPackage];
  923. with: 'Commit'.
  924. html button
  925. title: 'Rename package';
  926. onClick: [self renamePackage];
  927. with: 'Rename'.
  928. html button
  929. title: 'Remove this package from the system';
  930. onClick: [self removePackage];
  931. with: 'Remove'].
  932. classesList := ClassesList on: self.
  933. classesList renderOn: html.
  934. protocolsList := html ul class: 'amber_column browser protocols'.
  935. methodsList := html ul class: 'amber_column browser methods'.
  936. self
  937. updateCategoriesList;
  938. updateClassesList;
  939. updateProtocolsList;
  940. updateMethodsList.
  941. html div class: 'amber_clear']
  942. ! !
  943. !Browser methodsFor: 'testing'!
  944. canBeClosed
  945. ^true
  946. ! !
  947. !Browser methodsFor: 'updating'!
  948. resetClassesList
  949. classesList resetNodes
  950. !
  951. updateCategoriesList
  952. packagesList contents: [:html |
  953. self packages do: [:each || li label |
  954. each isEmpty
  955. ifTrue: [label := 'Unclassified']
  956. ifFalse: [label := each].
  957. li := html li.
  958. selectedPackage = each ifTrue: [
  959. li class: 'selected'].
  960. li
  961. with: label;
  962. onClick: [self selectCategory: each]]]
  963. !
  964. updateClassesList
  965. TabManager current update.
  966. classesList updateNodes
  967. !
  968. updateMethodsList
  969. methodsList contents: [:html |
  970. self methods do: [:each || li |
  971. li := html li.
  972. selectedMethod = each ifTrue: [
  973. li class: 'selected'].
  974. li
  975. with: each selector;
  976. onClick: [self selectMethod: each]]]
  977. !
  978. updateProtocolsList
  979. protocolsList contents: [:html |
  980. self protocols do: [:each || li |
  981. li := html li.
  982. selectedProtocol = each ifTrue: [
  983. li class: 'selected'].
  984. li
  985. with: each;
  986. onClick: [self selectProtocol: each]]]
  987. !
  988. updateSourceAndButtons
  989. | currentProtocol |
  990. self disableSaveButton.
  991. classButtons contents: [:html |
  992. html button
  993. title: 'Create a new class';
  994. onClick: [self addNewClass];
  995. with: 'New class'.
  996. html button
  997. with: 'Rename class';
  998. onClick: [self renameClass].
  999. html button
  1000. with: 'Copy class';
  1001. onClick: [self copyClass].
  1002. html button
  1003. with: 'Remove class';
  1004. onClick: [self removeClass].
  1005. html button
  1006. with: 'References';
  1007. onClick: [self searchClassReferences]].
  1008. methodButtons contents: [:html | | protocolSelect referencesSelect |
  1009. html button
  1010. with: 'Remove method';
  1011. onClick: [self removeMethod].
  1012. protocolSelect := html select.
  1013. protocolSelect
  1014. onChange: [ self setMethodProtocol: protocolSelect asJQuery val];
  1015. with: [
  1016. html option
  1017. with: 'Method protocol';
  1018. at: 'disabled' put: 'disabled'.
  1019. html option
  1020. class: 'important';
  1021. with: 'New...'.
  1022. currentProtocol := selectedProtocol.
  1023. (currentProtocol isNil and: [ selectedMethod notNil ])
  1024. ifTrue: [ currentProtocol := selectedMethod category].
  1025. self protocols do: [:each |
  1026. option := html option with: each.
  1027. currentProtocol = each ifTrue: [ option at: 'selected' put: 'selected' ] ]].
  1028. selectedMethod isNil ifFalse: [
  1029. referencesSelect := html select.
  1030. referencesSelect
  1031. onChange: [self searchReferencesOf: referencesSelect asJQuery val];
  1032. with: [ |option|
  1033. html option
  1034. with: 'References';
  1035. at: 'disabled' put: 'disabled';
  1036. at: 'selected' put: 'selected'.
  1037. html option
  1038. class: 'important';
  1039. with: selectedMethod selector.
  1040. selectedMethod messageSends sorted do: [:each |
  1041. html option with: each]]]].
  1042. selectedMethod isNil
  1043. ifTrue: [
  1044. self hideMethodButtons.
  1045. (selectedClass isNil or: [selectedProtocol notNil])
  1046. ifTrue: [self hideClassButtons]
  1047. ifFalse: [self showClassButtons]]
  1048. ifFalse: [
  1049. self hideClassButtons.
  1050. self showMethodButtons].
  1051. sourceArea val: self source
  1052. !
  1053. updateStatus
  1054. sourceArea val = self source
  1055. ifTrue: [
  1056. saveButton ifNotNil: [
  1057. saveButton at: 'disabled' put: true].
  1058. unsavedChanges := false]
  1059. ifFalse: [
  1060. saveButton ifNotNil: [
  1061. saveButton removeAt: 'disabled'].
  1062. unsavedChanges := true]
  1063. !
  1064. updateTabsList
  1065. tabsList contents: [:html || li |
  1066. li := html li.
  1067. selectedTab = #instance ifTrue: [li class: 'selected'].
  1068. li
  1069. with: [
  1070. html span class: 'ltab'.
  1071. html span class: 'mtab'; with: 'Instance'.
  1072. html span class: 'rtab'];
  1073. onClick: [self selectTab: #instance].
  1074. li := html li.
  1075. selectedTab = #class ifTrue: [li class: 'selected'].
  1076. li
  1077. with: [
  1078. html span class: 'ltab'.
  1079. html span class: 'mtab'; with: 'Class'.
  1080. html span class: 'rtab'];
  1081. onClick: [self selectTab: #class].
  1082. li := html li.
  1083. selectedTab = #comment ifTrue: [li class: 'selected'].
  1084. li
  1085. with: [
  1086. html span class: 'ltab'.
  1087. html span class: 'mtab'; with: 'Comment'.
  1088. html span class: 'rtab'];
  1089. onClick: [self selectTab: #comment]]
  1090. ! !
  1091. !Browser class methodsFor: 'accessing'!
  1092. commitPathJs
  1093. ^'js'
  1094. !
  1095. commitPathSt
  1096. ^'st'
  1097. ! !
  1098. !Browser class methodsFor: 'convenience'!
  1099. open
  1100. self new open
  1101. !
  1102. openOn: aClass
  1103. ^self new
  1104. open;
  1105. selectCategory: aClass category;
  1106. selectClass: aClass
  1107. ! !
  1108. TabWidget subclass: #Debugger
  1109. instanceVariableNames: 'error selectedContext sourceArea ul ul2 inspector saveButton unsavedChanges selectedVariable selectedVariableName inspectButton'
  1110. package: 'IDE'!
  1111. !Debugger methodsFor: 'accessing'!
  1112. arguments
  1113. ^self method
  1114. ifNil: [selectedContext temps collect: [:each | nil]]
  1115. ifNotNil: [self method arguments]
  1116. !
  1117. error
  1118. ^error
  1119. !
  1120. error: anError
  1121. error := anError
  1122. !
  1123. label
  1124. ^'[Debugger]'
  1125. !
  1126. method
  1127. ^selectedContext receiver class methodAt: selectedContext selector
  1128. !
  1129. receiver
  1130. ^selectedContext receiver
  1131. !
  1132. source
  1133. ^self method
  1134. ifNil: ['Method doesn''t exist!!']
  1135. ifNotNil: [self method source]
  1136. ! !
  1137. !Debugger methodsFor: 'actions'!
  1138. inspectSelectedVariable
  1139. selectedVariable inspect
  1140. !
  1141. proceed
  1142. self close.
  1143. selectedContext receiver perform: selectedContext selector withArguments: selectedContext temps
  1144. !
  1145. save
  1146. | protocol |
  1147. protocol := (selectedContext receiver class methodDictionary at: selectedContext selector) category.
  1148. selectedContext receiver class compile: sourceArea val category: protocol.
  1149. self updateStatus
  1150. !
  1151. selectContext: aContext
  1152. selectedContext := aContext.
  1153. selectedVariable := nil.
  1154. selectedVariableName := nil.
  1155. self
  1156. updateContextsList;
  1157. updateSourceArea;
  1158. updateInspector;
  1159. updateVariablesList;
  1160. updateStatus
  1161. !
  1162. selectVariable: anObject named: aString
  1163. selectedVariable := anObject.
  1164. selectedVariableName := aString.
  1165. inspector contents: [:html | html with: anObject printString].
  1166. self updateVariablesList
  1167. ! !
  1168. !Debugger methodsFor: 'initialization'!
  1169. initialize
  1170. super initialize.
  1171. unsavedChanges = false
  1172. ! !
  1173. !Debugger methodsFor: 'rendering'!
  1174. renderBottomPanelOn: html
  1175. html div
  1176. class: 'amber_sourceCode debugger';
  1177. with: [
  1178. sourceArea := SourceArea new.
  1179. sourceArea renderOn: html].
  1180. ul2 := html ul class: 'amber_column debugger variables'.
  1181. inspector := html div class: 'amber_column debugger inspector'.
  1182. sourceArea
  1183. onKeyUp: [self updateStatus]
  1184. !
  1185. renderBoxOn: html
  1186. self
  1187. renderTopPanelOn: html;
  1188. renderBottomPanelOn: html
  1189. !
  1190. renderButtonsOn: html
  1191. saveButton := html button
  1192. with: 'Save';
  1193. onClick: [self save].
  1194. html button
  1195. with: 'DoIt';
  1196. onClick: [sourceArea doIt].
  1197. html button
  1198. with: 'PrintIt';
  1199. onClick: [sourceArea printIt].
  1200. html button
  1201. with: 'InspectIt';
  1202. onClick: [sourceArea inspectIt].
  1203. html button
  1204. with: 'Proceed';
  1205. onClick: [self proceed].
  1206. html button
  1207. with: 'Abandon';
  1208. onClick: [self close].
  1209. inspectButton := html button
  1210. class: 'amber_button debugger inspect';
  1211. with: 'Inspect';
  1212. onClick: [self inspectSelectedVariable].
  1213. self
  1214. updateSourceArea;
  1215. updateStatus;
  1216. updateVariablesList;
  1217. updateInspector
  1218. !
  1219. renderContext: aContext on: html
  1220. | li |
  1221. li := html li.
  1222. selectedContext = aContext ifTrue: [
  1223. li class: 'selected'].
  1224. li
  1225. with: aContext asString;
  1226. onClick: [self selectContext: aContext].
  1227. aContext home ifNotNil: [self renderContext: aContext home on: html]
  1228. !
  1229. renderTopPanelOn: html
  1230. selectedContext := self error context.
  1231. html div
  1232. class: 'top';
  1233. with: [
  1234. html div
  1235. class: 'label';
  1236. with: self error messageText.
  1237. ul := html ul
  1238. class: 'amber_column debugger contexts';
  1239. with: [self renderContext: self error context on: html]]
  1240. ! !
  1241. !Debugger methodsFor: 'testing'!
  1242. canBeClosed
  1243. ^true
  1244. ! !
  1245. !Debugger methodsFor: 'updating'!
  1246. updateContextsList
  1247. ul contents: [:html |
  1248. self renderContext: self error context on: html]
  1249. !
  1250. updateInspector
  1251. inspector contents: [:html |]
  1252. !
  1253. updateSourceArea
  1254. sourceArea val: self source
  1255. !
  1256. updateStatus
  1257. sourceArea val = self source
  1258. ifTrue: [
  1259. saveButton ifNotNil: [
  1260. saveButton at: 'disabled' put: true].
  1261. unsavedChanges := false]
  1262. ifFalse: [
  1263. saveButton ifNotNil: [
  1264. saveButton removeAt: 'disabled'].
  1265. unsavedChanges := true]
  1266. !
  1267. updateVariablesList
  1268. ul2 contents: [:html | | li |
  1269. li := html li
  1270. with: 'self';
  1271. onClick: [self selectVariable: self receiver named: 'self'].
  1272. selectedVariableName = 'self' ifTrue: [
  1273. li class: 'selected'].
  1274. self arguments withIndexDo: [:each :index | | param |
  1275. param := selectedContext temps at: index.
  1276. li := html li
  1277. with: each;
  1278. onClick: [self selectVariable: param named: each].
  1279. selectedVariableName = each ifTrue: [
  1280. li class: 'selected']].
  1281. self receiver class allInstanceVariableNames do: [:each | | ivar |
  1282. ivar := self receiver instVarAt: each.
  1283. li := html li
  1284. with: each;
  1285. onClick: [self selectVariable: ivar named: each].
  1286. selectedVariableName = each ifTrue: [
  1287. li class: 'selected']]].
  1288. selectedVariable ifNil: [inspectButton at: 'disabled' put: true] ifNotNil: [inspectButton removeAt: 'disabled']
  1289. ! !
  1290. TabWidget subclass: #IDETranscript
  1291. instanceVariableNames: 'textarea'
  1292. package: 'IDE'!
  1293. !IDETranscript methodsFor: 'accessing'!
  1294. label
  1295. ^'Transcript'
  1296. ! !
  1297. !IDETranscript methodsFor: 'actions'!
  1298. clear
  1299. textarea asJQuery val: ''
  1300. !
  1301. cr
  1302. textarea asJQuery val: textarea asJQuery val, String cr.
  1303. !
  1304. open
  1305. TabManager current
  1306. open;
  1307. selectTab: self
  1308. !
  1309. show: anObject
  1310. textarea ifNil: [self open].
  1311. textarea asJQuery val: textarea asJQuery val, anObject asString.
  1312. ! !
  1313. !IDETranscript methodsFor: 'rendering'!
  1314. renderBoxOn: html
  1315. textarea := html textarea.
  1316. textarea
  1317. class: 'amber_transcript';
  1318. at: 'spellcheck' put: 'false'
  1319. !
  1320. renderButtonsOn: html
  1321. html button
  1322. with: 'Clear transcript';
  1323. onClick: [self clear]
  1324. ! !
  1325. IDETranscript class instanceVariableNames: 'current'!
  1326. !IDETranscript class methodsFor: 'initialization'!
  1327. initialize
  1328. Transcript register: self current
  1329. ! !
  1330. !IDETranscript class methodsFor: 'instance creation'!
  1331. current
  1332. ^current ifNil: [current := super new]
  1333. !
  1334. new
  1335. self shouldNotImplement
  1336. !
  1337. open
  1338. TabManager current
  1339. open;
  1340. selectTab: self current
  1341. ! !
  1342. TabWidget subclass: #Inspector
  1343. instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea diveButton sourceArea'
  1344. package: 'IDE'!
  1345. !Inspector methodsFor: 'accessing'!
  1346. label
  1347. ^label ifNil: ['Inspector (nil)']
  1348. !
  1349. selectedVariable
  1350. ^selectedVariable
  1351. !
  1352. selectedVariable: aString
  1353. selectedVariable := aString
  1354. !
  1355. setLabel: aString
  1356. label := aString
  1357. !
  1358. setVariables: aCollection
  1359. variables := aCollection
  1360. !
  1361. sourceArea
  1362. ^sourceArea
  1363. !
  1364. variables
  1365. ^variables
  1366. ! !
  1367. !Inspector methodsFor: 'actions'!
  1368. dive
  1369. (self variables at: self selectedVariable) inspect
  1370. !
  1371. inspect: anObject
  1372. object := anObject.
  1373. variables := #().
  1374. object inspectOn: self
  1375. !
  1376. refresh
  1377. self
  1378. inspect: object;
  1379. updateVariablesList;
  1380. updateValueTextarea
  1381. ! !
  1382. !Inspector methodsFor: 'rendering'!
  1383. renderBottomPanelOn: html
  1384. html div
  1385. class: 'amber_sourceCode';
  1386. with: [
  1387. sourceArea := SourceArea new
  1388. receiver: object;
  1389. onDoIt: [self refresh];
  1390. yourself.
  1391. sourceArea renderOn: html]
  1392. !
  1393. renderBoxOn: html
  1394. self
  1395. renderTopPanelOn: html;
  1396. renderBottomPanelOn: html
  1397. !
  1398. renderButtonsOn: html
  1399. html button
  1400. with: 'DoIt';
  1401. onClick: [self sourceArea doIt].
  1402. html button
  1403. with: 'PrintIt';
  1404. onClick: [self sourceArea printIt].
  1405. html button
  1406. with: 'InspectIt';
  1407. onClick: [self sourceArea inspectIt].
  1408. self updateButtons
  1409. !
  1410. renderTopPanelOn: html
  1411. html div
  1412. class: 'top';
  1413. with: [
  1414. variablesList := html ul class: 'amber_column variables'.
  1415. valueTextarea := html textarea class: 'amber_column value'; at: 'readonly' put: 'readonly'.
  1416. html div class: 'amber_tabs inspector'; with: [
  1417. html button
  1418. class: 'amber_button inspector refresh';
  1419. with: 'Refresh';
  1420. onClick: [self refresh].
  1421. diveButton := html button
  1422. class: 'amber_button inspector dive';
  1423. with: 'Dive';
  1424. onClick: [self dive]].
  1425. html div class: 'amber_clear'].
  1426. self
  1427. updateVariablesList;
  1428. updateValueTextarea.
  1429. ! !
  1430. !Inspector methodsFor: 'testing'!
  1431. canBeClosed
  1432. ^true
  1433. ! !
  1434. !Inspector methodsFor: 'updating'!
  1435. selectVariable: aString
  1436. self selectedVariable: aString.
  1437. self
  1438. updateVariablesList;
  1439. updateValueTextarea;
  1440. updateButtons
  1441. !
  1442. updateButtons
  1443. (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
  1444. ifFalse: [diveButton at: 'disabled' put: true]
  1445. ifTrue: [diveButton removeAt: 'disabled']
  1446. !
  1447. updateValueTextarea
  1448. valueTextarea asJQuery val: (self selectedVariable isNil
  1449. ifTrue: ['']
  1450. ifFalse: [(self variables at: self selectedVariable) printString])
  1451. !
  1452. updateVariablesList
  1453. variablesList contents: [:html |
  1454. self variables keys do: [:each || li |
  1455. li := html li.
  1456. li
  1457. with: each;
  1458. onClick: [self selectVariable: each].
  1459. self selectedVariable = each ifTrue: [
  1460. li class: 'selected']]]
  1461. ! !
  1462. !Inspector class methodsFor: 'instance creation'!
  1463. on: anObject
  1464. ^self new
  1465. inspect: anObject;
  1466. yourself
  1467. ! !
  1468. TabWidget subclass: #ProgressBar
  1469. instanceVariableNames: 'percent progressDiv div'
  1470. package: 'IDE'!
  1471. !ProgressBar methodsFor: 'accessing'!
  1472. percent
  1473. ^percent ifNil: [0]
  1474. !
  1475. percent: aNumber
  1476. percent := aNumber
  1477. ! !
  1478. !ProgressBar methodsFor: 'rendering'!
  1479. renderOn: html
  1480. div := html div
  1481. class: 'progress_bar';
  1482. yourself.
  1483. self renderProgressBar
  1484. !
  1485. renderProgressBar
  1486. div contents: [:html |
  1487. html div
  1488. class: 'progress';
  1489. style: 'width:', self percent asString, '%']
  1490. ! !
  1491. !ProgressBar methodsFor: 'updating'!
  1492. updatePercent: aNumber
  1493. self percent: aNumber.
  1494. self renderProgressBar
  1495. ! !
  1496. TabWidget subclass: #ReferencesBrowser
  1497. instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList matches matchesList'
  1498. package: 'IDE'!
  1499. !ReferencesBrowser methodsFor: 'accessing'!
  1500. classesAndMetaclasses
  1501. ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
  1502. !
  1503. implementors
  1504. ^implementors ifNil: [implementors := Array new]
  1505. !
  1506. label
  1507. ^'[References]'
  1508. !
  1509. matches
  1510. ^matches ifNil: [matches := Array new]
  1511. !
  1512. referencedClasses
  1513. ^referencedClasses ifNil: [referencedClasses := Array new]
  1514. !
  1515. selector
  1516. ^selector
  1517. !
  1518. senders
  1519. ^senders ifNil: [senders := Array new]
  1520. ! !
  1521. !ReferencesBrowser methodsFor: 'actions'!
  1522. openBrowserOn: aMethod
  1523. | browser |
  1524. browser := Browser openOn: (aMethod methodClass isMetaclass
  1525. ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
  1526. aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
  1527. browser
  1528. selectProtocol: aMethod category;
  1529. selectMethod: aMethod
  1530. !
  1531. search: aString
  1532. self
  1533. searchReferencesFor: aString;
  1534. updateImplementorsList;
  1535. updateSendersList;
  1536. updateReferencedClassesList;
  1537. updateMatchesList
  1538. !
  1539. searchMethodSource
  1540. | regex |
  1541. regex := selector allButFirst.
  1542. self classesAndMetaclasses do: [:each |
  1543. each methodDictionary values do: [:value |
  1544. (value source match: regex) ifTrue: [
  1545. self matches add: value]]]
  1546. !
  1547. searchReferencedClasses
  1548. self classesAndMetaclasses do: [:each |
  1549. each methodDictionary values do: [:value |
  1550. (value referencedClasses includes: selector) ifTrue: [
  1551. self referencedClasses add: value]]]
  1552. !
  1553. searchReferencesFor: aString
  1554. selector := aString.
  1555. implementors := Array new.
  1556. senders := Array new.
  1557. referencedClasses := Array new.
  1558. matches := Array new.
  1559. self searchMethodSource.
  1560. (selector match: '^[A-Z]')
  1561. ifFalse: [self searchSelectorReferences]
  1562. ifTrue: [self searchReferencedClasses]
  1563. !
  1564. searchSelectorReferences
  1565. self classesAndMetaclasses do: [:each |
  1566. each methodDictionary keysAndValuesDo: [:key :value |
  1567. key = selector ifTrue: [self implementors add: value].
  1568. (value messageSends includes: selector) ifTrue: [
  1569. self senders add: value]]]
  1570. ! !
  1571. !ReferencesBrowser methodsFor: 'initialization'!
  1572. initialize
  1573. super initialize.
  1574. selector := ''
  1575. ! !
  1576. !ReferencesBrowser methodsFor: 'private'!
  1577. setInputEvents
  1578. input
  1579. onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
  1580. onKeyDown: [timer ifNotNil: [timer clearTimeout]]
  1581. ! !
  1582. !ReferencesBrowser methodsFor: 'rendering'!
  1583. renderBoxOn: html
  1584. self
  1585. renderInputOn: html;
  1586. renderImplementorsOn: html;
  1587. renderSendersOn: html;
  1588. renderReferencedClassesOn: html;
  1589. renderMatchesOn: html
  1590. !
  1591. renderImplementorsOn: html
  1592. implementorsList := html ul class: 'amber_column implementors'.
  1593. self updateImplementorsList
  1594. !
  1595. renderInputOn: html
  1596. input := html input
  1597. class: 'implementors';
  1598. yourself.
  1599. input asJQuery val: selector.
  1600. self setInputEvents
  1601. !
  1602. renderMatchesOn: html
  1603. matchesList := html ul class: 'amber_column matches'.
  1604. self updateMatchesList
  1605. !
  1606. renderReferencedClassesOn: html
  1607. referencedClassesList := html ul class: 'amber_column referenced_classes'.
  1608. self updateReferencedClassesList
  1609. !
  1610. renderSendersOn: html
  1611. sendersList := html ul class: 'amber_column senders'.
  1612. self updateSendersList
  1613. ! !
  1614. !ReferencesBrowser methodsFor: 'testing'!
  1615. canBeClosed
  1616. ^true
  1617. ! !
  1618. !ReferencesBrowser methodsFor: 'updating'!
  1619. updateImplementorsList
  1620. implementorsList contents: [:html |
  1621. html li
  1622. class: 'column_label';
  1623. with: 'Implementors (', self implementors size asString, ')';
  1624. style: 'font-weight: bold'.
  1625. self implementors do: [:each || li |
  1626. li := html li.
  1627. li
  1628. with: (each methodClass asString, ' >> ', self selector);
  1629. onClick: [self openBrowserOn: each]]]
  1630. !
  1631. updateMatchesList
  1632. matchesList contents: [:html |
  1633. html li
  1634. class: 'column_label';
  1635. with: 'Regex matches (', self matches size asString, ')';
  1636. style: 'font-weight: bold'.
  1637. self matches do: [:each || li |
  1638. li := html li.
  1639. li
  1640. with: (each methodClass asString, ' >> ', each selector);
  1641. onClick: [self openBrowserOn: each]]]
  1642. !
  1643. updateReferencedClassesList
  1644. referencedClassesList contents: [:html |
  1645. html li
  1646. class: 'column_label';
  1647. with: 'Class references (', self referencedClasses size asString, ')';
  1648. style: 'font-weight: bold'.
  1649. self referencedClasses do: [:each |
  1650. html li
  1651. with: (each methodClass asString, ' >> ', each selector);
  1652. onClick: [self openBrowserOn: each]]]
  1653. !
  1654. updateSendersList
  1655. sendersList contents: [:html |
  1656. html li
  1657. class: 'column_label';
  1658. with: 'Senders (', self senders size asString, ')';
  1659. style: 'font-weight: bold'.
  1660. self senders do: [:each |
  1661. html li
  1662. with: (each methodClass asString, ' >> ', each selector);
  1663. onClick: [self openBrowserOn: each]]]
  1664. ! !
  1665. !ReferencesBrowser class methodsFor: 'instance creation'!
  1666. search: aString
  1667. ^self new
  1668. searchReferencesFor: aString;
  1669. open
  1670. ! !
  1671. TabWidget subclass: #TestRunner
  1672. instanceVariableNames: 'selectedCategories packagesList selectedClasses classesList selectedMethods progressBar methodsList result statusDiv'
  1673. package: 'IDE'!
  1674. !TestRunner methodsFor: 'accessing'!
  1675. allClasses
  1676. ^TestCase allSubclasses select: [ :each | each isAbstract not ]
  1677. !
  1678. classes
  1679. ^(self allClasses
  1680. select: [:each | self selectedCategories includes: each category])
  1681. sort: [:a :b | a name > b name]
  1682. !
  1683. label
  1684. ^'SUnit'
  1685. !
  1686. packages
  1687. | packages |
  1688. packages := Array new.
  1689. self allClasses do: [:each |
  1690. (packages includes: each category) ifFalse: [
  1691. packages add: each category]].
  1692. ^packages sort
  1693. !
  1694. progressBar
  1695. ^progressBar ifNil: [progressBar := ProgressBar new]
  1696. !
  1697. result
  1698. ^result
  1699. !
  1700. selectedCategories
  1701. ^selectedCategories ifNil: [selectedCategories := Array new]
  1702. !
  1703. selectedClasses
  1704. ^selectedClasses ifNil: [selectedClasses := Array new]
  1705. !
  1706. statusInfo
  1707. ^self printTotal, self printPasses, self printErrors, self printFailures
  1708. !
  1709. testCases
  1710. | testCases |
  1711. testCases := #().
  1712. (self selectedClasses
  1713. select: [:each | self selectedCategories includes: each category])
  1714. do: [:each | testCases addAll: each buildSuite].
  1715. ^testCases
  1716. ! !
  1717. !TestRunner methodsFor: 'actions'!
  1718. performFailure: aTestCase
  1719. aTestCase runCase
  1720. !
  1721. run: aCollection
  1722. | worker |
  1723. worker := TestSuiteRunner on: aCollection.
  1724. result := worker result.
  1725. worker announcer on: ResultAnnouncement do: [:ann |
  1726. ann result == result ifTrue: [
  1727. self progressBar updatePercent: result runs / result total * 100.
  1728. self updateStatusDiv.
  1729. self updateMethodsList
  1730. ]
  1731. ].
  1732. worker run
  1733. !
  1734. selectAllCategories
  1735. self packages do: [:each |
  1736. (selectedCategories includes: each) ifFalse: [
  1737. self selectedCategories add: each]].
  1738. self
  1739. updateCategoriesList;
  1740. updateClassesList
  1741. !
  1742. selectAllClasses
  1743. self classes do: [:each |
  1744. (selectedClasses includes: each) ifFalse: [
  1745. self selectedClasses add: each]].
  1746. self
  1747. updateCategoriesList;
  1748. updateClassesList
  1749. !
  1750. toggleCategory: aCategory
  1751. (self isSelectedCategory: aCategory)
  1752. ifFalse: [selectedCategories add: aCategory]
  1753. ifTrue: [selectedCategories remove: aCategory].
  1754. self
  1755. updateCategoriesList;
  1756. updateClassesList
  1757. !
  1758. toggleClass: aClass
  1759. (self isSelectedClass: aClass)
  1760. ifFalse: [selectedClasses add: aClass]
  1761. ifTrue: [selectedClasses remove: aClass].
  1762. self
  1763. updateClassesList
  1764. ! !
  1765. !TestRunner methodsFor: 'initialization'!
  1766. initialize
  1767. super initialize.
  1768. result := TestResult new
  1769. ! !
  1770. !TestRunner methodsFor: 'printing'!
  1771. printErrors
  1772. ^self result errors size asString , ' errors, '
  1773. !
  1774. printFailures
  1775. ^self result failures size asString, ' failures'
  1776. !
  1777. printPasses
  1778. ^(self result runs - self result errors size - self result failures size) asString , ' passes, '
  1779. !
  1780. printTotal
  1781. ^self result total asString, ' runs, '
  1782. ! !
  1783. !TestRunner methodsFor: 'rendering'!
  1784. renderBoxOn: html
  1785. self
  1786. renderCategoriesOn: html;
  1787. renderClassesOn: html;
  1788. renderResultsOn: html
  1789. !
  1790. renderButtonsOn: html
  1791. html button
  1792. with: 'Run selected';
  1793. onClick: [self run: self testCases]
  1794. !
  1795. renderCategoriesOn: html
  1796. packagesList := html ul class: 'amber_column sunit packages'.
  1797. self updateCategoriesList
  1798. !
  1799. renderClassesOn: html
  1800. classesList := html ul class: 'amber_column sunit classes'.
  1801. self updateClassesList
  1802. !
  1803. renderErrorsOn: html
  1804. self result errors do: [:each |
  1805. html li
  1806. class: 'errors';
  1807. with: each class name, ' >> ', each selector;
  1808. onClick: [self performFailure: each]]
  1809. !
  1810. renderFailuresOn: html
  1811. self result failures do: [:each |
  1812. html li
  1813. class: 'failures';
  1814. with: each class name, ' >> ', each selector;
  1815. onClick: [self performFailure: each]]
  1816. !
  1817. renderResultsOn: html
  1818. statusDiv := html div.
  1819. html with: self progressBar.
  1820. methodsList := html ul class: 'amber_column sunit results'.
  1821. self updateMethodsList.
  1822. self updateStatusDiv
  1823. ! !
  1824. !TestRunner methodsFor: 'testing'!
  1825. isSelectedCategory: aCategory
  1826. ^(self selectedCategories includes: aCategory)
  1827. !
  1828. isSelectedClass: aClass
  1829. ^(self selectedClasses includes: aClass)
  1830. ! !
  1831. !TestRunner methodsFor: 'updating'!
  1832. updateCategoriesList
  1833. packagesList contents: [:html |
  1834. html li
  1835. class: 'all';
  1836. with: 'All';
  1837. onClick: [self selectAllCategories].
  1838. self packages do: [:each || li |
  1839. li := html li.
  1840. (self selectedCategories includes: each) ifTrue: [
  1841. li class: 'selected'].
  1842. li
  1843. with: each;
  1844. onClick: [self toggleCategory: each]]]
  1845. !
  1846. updateClassesList
  1847. classesList contents: [:html |
  1848. (self selectedCategories isEmpty) ifFalse: [
  1849. html li
  1850. class: 'all';
  1851. with: 'All';
  1852. onClick: [self selectAllClasses]].
  1853. self classes do: [:each || li |
  1854. li := html li.
  1855. (self selectedClasses includes: each) ifTrue: [
  1856. li class: 'selected'].
  1857. li
  1858. with: each name;
  1859. onClick: [self toggleClass: each]]]
  1860. !
  1861. updateMethodsList
  1862. methodsList contents: [:html |
  1863. self renderErrorsOn: html.
  1864. self renderFailuresOn: html]
  1865. !
  1866. updateStatusDiv
  1867. statusDiv class: 'sunit status ', result status.
  1868. statusDiv contents: [:html |
  1869. html span with: self statusInfo]
  1870. ! !
  1871. TabWidget subclass: #Workspace
  1872. instanceVariableNames: 'sourceArea'
  1873. package: 'IDE'!
  1874. !Workspace methodsFor: 'accessing'!
  1875. label
  1876. ^'Workspace'
  1877. ! !
  1878. !Workspace methodsFor: 'actions'!
  1879. clearWorkspace
  1880. sourceArea clear
  1881. !
  1882. doIt
  1883. sourceArea doIt
  1884. !
  1885. fileIn
  1886. sourceArea fileIn
  1887. !
  1888. inspectIt
  1889. sourceArea inspectIt
  1890. !
  1891. printIt
  1892. sourceArea printIt
  1893. !
  1894. show
  1895. super show.
  1896. sourceArea focus.
  1897. ! !
  1898. !Workspace methodsFor: 'rendering'!
  1899. renderBoxOn: html
  1900. sourceArea := SourceArea new.
  1901. sourceArea renderOn: html
  1902. !
  1903. renderButtonsOn: html
  1904. html button
  1905. with: 'DoIt';
  1906. title: 'ctrl+d';
  1907. onClick: [self doIt].
  1908. html button
  1909. with: 'PrintIt';
  1910. title: 'ctrl+p';
  1911. onClick: [self printIt].
  1912. html button
  1913. with: 'InspectIt';
  1914. title: 'ctrl+i';
  1915. onClick: [self inspectIt].
  1916. html button
  1917. with: 'FileIn';
  1918. title: 'ctrl+f';
  1919. onClick: [self fileIn].
  1920. html button
  1921. with: 'Clear workspace';
  1922. onClick: [self clearWorkspace]
  1923. ! !
  1924. !Object methodsFor: '*IDE'!
  1925. inspect
  1926. Inspector new
  1927. inspect: self;
  1928. open
  1929. !
  1930. inspectOn: anInspector
  1931. | variables |
  1932. variables := Dictionary new.
  1933. variables at: '#self' put: self.
  1934. self class allInstanceVariableNames do: [:each |
  1935. variables at: each put: (self instVarAt: each)].
  1936. anInspector
  1937. setLabel: self printString;
  1938. setVariables: variables
  1939. ! !
  1940. !Collection methodsFor: '*IDE'!
  1941. inspectOn: anInspector
  1942. | variables |
  1943. variables := Dictionary new.
  1944. variables at: '#self' put: self.
  1945. self withIndexDo: [:each :i |
  1946. variables at: i put: each].
  1947. anInspector
  1948. setLabel: self printString;
  1949. setVariables: variables
  1950. ! !
  1951. !HashedCollection methodsFor: '*IDE'!
  1952. inspectOn: anInspector
  1953. | variables |
  1954. variables := Dictionary new.
  1955. variables at: '#self' put: self.
  1956. variables at: '#keys' put: self keys.
  1957. self keysAndValuesDo: [:key :value |
  1958. variables at: key put: value].
  1959. anInspector
  1960. setLabel: self printString;
  1961. setVariables: variables
  1962. ! !
  1963. !String methodsFor: '*IDE'!
  1964. inspectOn: anInspector
  1965. | label |
  1966. super inspectOn: anInspector.
  1967. self printString size > 30
  1968. ifTrue: [label := (self printString copyFrom: 1 to: 30), '...''']
  1969. ifFalse: [label := self printString].
  1970. anInspector setLabel: label
  1971. ! !
  1972. !Set methodsFor: '*IDE'!
  1973. inspectOn: anInspector
  1974. | variables |
  1975. variables := Dictionary new.
  1976. variables at: '#self' put: self.
  1977. elements withIndexDo: [:each :i |
  1978. variables at: i put: each].
  1979. anInspector
  1980. setLabel: self printString;
  1981. setVariables: variables
  1982. ! !
  1983. !Date methodsFor: '*IDE'!
  1984. inspectOn: anInspector
  1985. | variables |
  1986. variables := Dictionary new.
  1987. variables at: '#self' put: self.
  1988. variables at: '#year' put: self year.
  1989. variables at: '#month' put: self month.
  1990. variables at: '#day' put: self day.
  1991. variables at: '#hours' put: self hours.
  1992. variables at: '#minutes' put: self minutes.
  1993. variables at: '#seconds' put: self seconds.
  1994. variables at: '#milliseconds' put: self milliseconds.
  1995. anInspector
  1996. setLabel: self printString;
  1997. setVariables: variables
  1998. ! !
  1999. !Date methodsFor: '*IDE'!
  2000. inspectOn: anInspector
  2001. | variables |
  2002. variables := Dictionary new.
  2003. variables at: '#self' put: self.
  2004. variables at: '#year' put: self year.
  2005. variables at: '#month' put: self month.
  2006. variables at: '#day' put: self day.
  2007. variables at: '#hours' put: self hours.
  2008. variables at: '#minutes' put: self minutes.
  2009. variables at: '#seconds' put: self seconds.
  2010. variables at: '#milliseconds' put: self milliseconds.
  2011. anInspector
  2012. setLabel: self printString;
  2013. setVariables: variables
  2014. ! !
  2015. !MethodContext methodsFor: '*IDE'!
  2016. inspectOn: anInspector
  2017. | variables |
  2018. variables := Dictionary new.
  2019. variables at: '#self' put: self.
  2020. variables at: '#home' put: self home.
  2021. variables at: '#receiver' put: self receiver.
  2022. variables at: '#selector' put: self selector.
  2023. variables at: '#temps' put: self temps.
  2024. self class instanceVariableNames do: [:each |
  2025. variables at: each put: (self instVarAt: each)].
  2026. anInspector
  2027. setLabel: self printString;
  2028. setVariables: variables
  2029. ! !