2
0

IDE.st 50 KB

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