IDE.st 49 KB

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