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: 'accessing'!
  1099. commitPathJs
  1100. ^'js'
  1101. !
  1102. commitPathSt
  1103. ^'st'
  1104. ! !
  1105. !Browser class methodsFor: 'convenience'!
  1106. open
  1107. self new open
  1108. !
  1109. openOn: aClass
  1110. ^self new
  1111. open;
  1112. selectCategory: aClass category;
  1113. selectClass: aClass
  1114. ! !
  1115. TabWidget subclass: #Debugger
  1116. instanceVariableNames: 'error selectedContext sourceArea ul ul2 inspector saveButton unsavedChanges selectedVariable selectedVariableName inspectButton'
  1117. package: 'IDE'!
  1118. !Debugger methodsFor: 'accessing'!
  1119. arguments
  1120. ^self method
  1121. ifNil: [selectedContext temps collect: [:each | nil]]
  1122. ifNotNil: [self method arguments]
  1123. !
  1124. error
  1125. ^error
  1126. !
  1127. error: anError
  1128. error := anError
  1129. !
  1130. label
  1131. ^'[Debugger]'
  1132. !
  1133. method
  1134. ^selectedContext receiver class lookupSelector: selectedContext selector
  1135. !
  1136. receiver
  1137. ^selectedContext receiver
  1138. !
  1139. source
  1140. ^self method
  1141. ifNil: ['Method doesn''t exist!!']
  1142. ifNotNil: [self method source]
  1143. ! !
  1144. !Debugger methodsFor: 'actions'!
  1145. inspectSelectedVariable
  1146. selectedVariable inspect
  1147. !
  1148. proceed
  1149. self close.
  1150. selectedContext receiver perform: selectedContext selector withArguments: selectedContext temps
  1151. !
  1152. save
  1153. | protocol |
  1154. protocol := (selectedContext receiver class methodDictionary at: selectedContext selector) category.
  1155. selectedContext receiver class compile: sourceArea val category: protocol.
  1156. self updateStatus
  1157. !
  1158. selectContext: aContext
  1159. selectedContext := aContext.
  1160. selectedVariable := nil.
  1161. selectedVariableName := nil.
  1162. self
  1163. updateContextsList;
  1164. updateSourceArea;
  1165. updateInspector;
  1166. updateVariablesList;
  1167. updateStatus
  1168. !
  1169. selectVariable: anObject named: aString
  1170. selectedVariable := anObject.
  1171. selectedVariableName := aString.
  1172. inspector contents: [:html | html with: anObject printString].
  1173. self updateVariablesList
  1174. ! !
  1175. !Debugger methodsFor: 'initialization'!
  1176. initialize
  1177. super initialize.
  1178. unsavedChanges = false
  1179. ! !
  1180. !Debugger methodsFor: 'rendering'!
  1181. renderBottomPanelOn: html
  1182. html div
  1183. class: 'amber_sourceCode debugger';
  1184. with: [
  1185. sourceArea := SourceArea new.
  1186. sourceArea renderOn: html].
  1187. ul2 := html ul class: 'amber_column debugger variables'.
  1188. inspector := html div class: 'amber_column debugger inspector'.
  1189. sourceArea
  1190. onKeyUp: [self updateStatus]
  1191. !
  1192. renderBoxOn: html
  1193. self
  1194. renderTopPanelOn: html;
  1195. renderBottomPanelOn: html
  1196. !
  1197. renderButtonsOn: html
  1198. self inspect.
  1199. saveButton := html button
  1200. with: 'Save';
  1201. onClick: [self save].
  1202. html button
  1203. with: 'DoIt';
  1204. onClick: [sourceArea doIt].
  1205. html button
  1206. with: 'PrintIt';
  1207. onClick: [sourceArea printIt].
  1208. html button
  1209. with: 'InspectIt';
  1210. onClick: [sourceArea inspectIt].
  1211. html button
  1212. with: 'Proceed';
  1213. onClick: [self proceed].
  1214. html button
  1215. with: 'Abandon';
  1216. onClick: [self close].
  1217. inspectButton := html button
  1218. class: 'amber_button debugger inspect';
  1219. with: 'Inspect';
  1220. onClick: [self inspectSelectedVariable].
  1221. self
  1222. updateSourceArea;
  1223. updateStatus;
  1224. updateVariablesList;
  1225. updateInspector
  1226. !
  1227. renderContext: aContext on: html
  1228. | li |
  1229. li := html li.
  1230. selectedContext = aContext ifTrue: [
  1231. li class: 'selected'].
  1232. li
  1233. with: aContext asString;
  1234. onClick: [self selectContext: aContext].
  1235. aContext home ifNotNil: [self renderContext: aContext home on: html]
  1236. !
  1237. renderTopPanelOn: html
  1238. selectedContext := self error context.
  1239. html div
  1240. class: 'top';
  1241. with: [
  1242. html div
  1243. class: 'label';
  1244. with: self error messageText.
  1245. ul := html ul
  1246. class: 'amber_column debugger contexts';
  1247. with: [self renderContext: self error context on: html]]
  1248. ! !
  1249. !Debugger methodsFor: 'testing'!
  1250. canBeClosed
  1251. ^true
  1252. ! !
  1253. !Debugger methodsFor: 'updating'!
  1254. updateContextsList
  1255. ul contents: [:html |
  1256. self renderContext: self error context on: html]
  1257. !
  1258. updateInspector
  1259. inspector contents: [:html |]
  1260. !
  1261. updateSourceArea
  1262. sourceArea val: self source
  1263. !
  1264. updateStatus
  1265. sourceArea val = self source
  1266. ifTrue: [
  1267. saveButton ifNotNil: [
  1268. saveButton at: 'disabled' put: true].
  1269. unsavedChanges := false]
  1270. ifFalse: [
  1271. saveButton ifNotNil: [
  1272. saveButton removeAt: 'disabled'].
  1273. unsavedChanges := true]
  1274. !
  1275. updateVariablesList
  1276. ul2 contents: [:html | | li |
  1277. li := html li
  1278. with: 'self';
  1279. onClick: [self selectVariable: self receiver named: 'self'].
  1280. selectedVariableName = 'self' ifTrue: [
  1281. li class: 'selected'].
  1282. self arguments withIndexDo: [:each :index | | param |
  1283. param := selectedContext temps at: index.
  1284. li := html li
  1285. with: each;
  1286. onClick: [self selectVariable: param named: each].
  1287. selectedVariableName = each ifTrue: [
  1288. li class: 'selected']].
  1289. self receiver class allInstanceVariableNames do: [:each | | ivar |
  1290. ivar := self receiver instVarAt: each.
  1291. li := html li
  1292. with: each;
  1293. onClick: [self selectVariable: ivar named: each].
  1294. selectedVariableName = each ifTrue: [
  1295. li class: 'selected']]].
  1296. selectedVariable ifNil: [inspectButton at: 'disabled' put: true] ifNotNil: [inspectButton removeAt: 'disabled']
  1297. ! !
  1298. TabWidget subclass: #IDETranscript
  1299. instanceVariableNames: 'textarea'
  1300. package: 'IDE'!
  1301. !IDETranscript methodsFor: 'accessing'!
  1302. label
  1303. ^'Transcript'
  1304. ! !
  1305. !IDETranscript methodsFor: 'actions'!
  1306. clear
  1307. textarea asJQuery val: ''
  1308. !
  1309. cr
  1310. textarea asJQuery val: textarea asJQuery val, String cr.
  1311. !
  1312. open
  1313. TabManager current
  1314. open;
  1315. selectTab: self
  1316. !
  1317. show: anObject
  1318. textarea ifNil: [self open].
  1319. textarea asJQuery val: textarea asJQuery val, anObject asString.
  1320. ! !
  1321. !IDETranscript methodsFor: 'rendering'!
  1322. renderBoxOn: html
  1323. textarea := html textarea.
  1324. textarea
  1325. class: 'amber_transcript';
  1326. at: 'spellcheck' put: 'false'
  1327. !
  1328. renderButtonsOn: html
  1329. html button
  1330. with: 'Clear transcript';
  1331. onClick: [self clear]
  1332. ! !
  1333. IDETranscript class instanceVariableNames: 'current'!
  1334. !IDETranscript class methodsFor: 'initialization'!
  1335. initialize
  1336. Transcript register: self current
  1337. ! !
  1338. !IDETranscript class methodsFor: 'instance creation'!
  1339. current
  1340. ^current ifNil: [current := super new]
  1341. !
  1342. new
  1343. self shouldNotImplement
  1344. !
  1345. open
  1346. TabManager current
  1347. open;
  1348. selectTab: self current
  1349. ! !
  1350. TabWidget subclass: #Inspector
  1351. instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea diveButton sourceArea'
  1352. package: 'IDE'!
  1353. !Inspector methodsFor: 'accessing'!
  1354. label
  1355. ^label ifNil: ['Inspector (nil)']
  1356. !
  1357. selectedVariable
  1358. ^selectedVariable
  1359. !
  1360. selectedVariable: aString
  1361. selectedVariable := aString
  1362. !
  1363. setLabel: aString
  1364. label := aString
  1365. !
  1366. setVariables: aCollection
  1367. variables := aCollection
  1368. !
  1369. sourceArea
  1370. ^sourceArea
  1371. !
  1372. variables
  1373. ^variables
  1374. ! !
  1375. !Inspector methodsFor: 'actions'!
  1376. dive
  1377. (self variables at: self selectedVariable) inspect
  1378. !
  1379. inspect: anObject
  1380. object := anObject.
  1381. variables := #().
  1382. object inspectOn: self
  1383. !
  1384. refresh
  1385. self
  1386. inspect: object;
  1387. updateVariablesList;
  1388. updateValueTextarea
  1389. ! !
  1390. !Inspector methodsFor: 'rendering'!
  1391. renderBottomPanelOn: html
  1392. html div
  1393. class: 'amber_sourceCode';
  1394. with: [
  1395. sourceArea := SourceArea new
  1396. receiver: object;
  1397. onDoIt: [self refresh];
  1398. yourself.
  1399. sourceArea renderOn: html]
  1400. !
  1401. renderBoxOn: html
  1402. self
  1403. renderTopPanelOn: html;
  1404. renderBottomPanelOn: html
  1405. !
  1406. renderButtonsOn: html
  1407. html button
  1408. with: 'DoIt';
  1409. onClick: [self sourceArea doIt].
  1410. html button
  1411. with: 'PrintIt';
  1412. onClick: [self sourceArea printIt].
  1413. html button
  1414. with: 'InspectIt';
  1415. onClick: [self sourceArea inspectIt].
  1416. self updateButtons
  1417. !
  1418. renderTopPanelOn: html
  1419. html div
  1420. class: 'top';
  1421. with: [
  1422. variablesList := html ul class: 'amber_column variables'.
  1423. valueTextarea := html textarea class: 'amber_column value'; at: 'readonly' put: 'readonly'.
  1424. html div class: 'amber_tabs inspector'; with: [
  1425. html button
  1426. class: 'amber_button inspector refresh';
  1427. with: 'Refresh';
  1428. onClick: [self refresh].
  1429. diveButton := html button
  1430. class: 'amber_button inspector dive';
  1431. with: 'Dive';
  1432. onClick: [self dive]].
  1433. html div class: 'amber_clear'].
  1434. self
  1435. updateVariablesList;
  1436. updateValueTextarea.
  1437. ! !
  1438. !Inspector methodsFor: 'testing'!
  1439. canBeClosed
  1440. ^true
  1441. ! !
  1442. !Inspector methodsFor: 'updating'!
  1443. selectVariable: aString
  1444. self selectedVariable: aString.
  1445. self
  1446. updateVariablesList;
  1447. updateValueTextarea;
  1448. updateButtons
  1449. !
  1450. updateButtons
  1451. (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
  1452. ifFalse: [diveButton at: 'disabled' put: true]
  1453. ifTrue: [diveButton removeAt: 'disabled']
  1454. !
  1455. updateValueTextarea
  1456. valueTextarea asJQuery val: (self selectedVariable isNil
  1457. ifTrue: ['']
  1458. ifFalse: [(self variables at: self selectedVariable) printString])
  1459. !
  1460. updateVariablesList
  1461. variablesList contents: [:html |
  1462. self variables keys do: [:each || li |
  1463. li := html li.
  1464. li
  1465. with: each;
  1466. onClick: [self selectVariable: each].
  1467. self selectedVariable = each ifTrue: [
  1468. li class: 'selected']]]
  1469. ! !
  1470. !Inspector class methodsFor: 'instance creation'!
  1471. on: anObject
  1472. ^self new
  1473. inspect: anObject;
  1474. yourself
  1475. ! !
  1476. TabWidget subclass: #ProgressBar
  1477. instanceVariableNames: 'percent progressDiv div'
  1478. package: 'IDE'!
  1479. !ProgressBar methodsFor: 'accessing'!
  1480. percent
  1481. ^percent ifNil: [0]
  1482. !
  1483. percent: aNumber
  1484. percent := aNumber
  1485. ! !
  1486. !ProgressBar methodsFor: 'rendering'!
  1487. renderOn: html
  1488. div := html div
  1489. class: 'progress_bar';
  1490. yourself.
  1491. self renderProgressBar
  1492. !
  1493. renderProgressBar
  1494. div contents: [:html |
  1495. html div
  1496. class: 'progress';
  1497. style: 'width:', self percent asString, '%']
  1498. ! !
  1499. !ProgressBar methodsFor: 'updating'!
  1500. updatePercent: aNumber
  1501. self percent: aNumber.
  1502. self renderProgressBar
  1503. ! !
  1504. TabWidget subclass: #ReferencesBrowser
  1505. instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList matches matchesList'
  1506. package: 'IDE'!
  1507. !ReferencesBrowser methodsFor: 'accessing'!
  1508. classesAndMetaclasses
  1509. ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
  1510. !
  1511. implementors
  1512. ^implementors ifNil: [implementors := Array new]
  1513. !
  1514. label
  1515. ^'[References]'
  1516. !
  1517. matches
  1518. ^matches ifNil: [matches := Array new]
  1519. !
  1520. referencedClasses
  1521. ^referencedClasses ifNil: [referencedClasses := Array new]
  1522. !
  1523. selector
  1524. ^selector
  1525. !
  1526. senders
  1527. ^senders ifNil: [senders := Array new]
  1528. ! !
  1529. !ReferencesBrowser methodsFor: 'actions'!
  1530. openBrowserOn: aMethod
  1531. | browser |
  1532. browser := Browser openOn: (aMethod methodClass isMetaclass
  1533. ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
  1534. aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
  1535. browser
  1536. selectProtocol: aMethod category;
  1537. selectMethod: aMethod
  1538. !
  1539. search: aString
  1540. self
  1541. searchReferencesFor: aString;
  1542. updateImplementorsList;
  1543. updateSendersList;
  1544. updateReferencedClassesList;
  1545. updateMatchesList
  1546. !
  1547. searchMethodSource
  1548. | regex |
  1549. regex := selector allButFirst.
  1550. self classesAndMetaclasses do: [:each |
  1551. each methodDictionary values do: [:value |
  1552. (value source match: regex) ifTrue: [
  1553. self matches add: value]]]
  1554. !
  1555. searchReferencedClasses
  1556. self classesAndMetaclasses do: [:each |
  1557. each methodDictionary values do: [:value |
  1558. (value referencedClasses includes: selector) ifTrue: [
  1559. self referencedClasses add: value]]]
  1560. !
  1561. searchReferencesFor: aString
  1562. selector := aString.
  1563. implementors := Array new.
  1564. senders := Array new.
  1565. referencedClasses := Array new.
  1566. matches := Array new.
  1567. self searchMethodSource.
  1568. (selector match: '^[A-Z]')
  1569. ifFalse: [self searchSelectorReferences]
  1570. ifTrue: [self searchReferencedClasses]
  1571. !
  1572. searchSelectorReferences
  1573. self classesAndMetaclasses do: [:each |
  1574. each methodDictionary keysAndValuesDo: [:key :value |
  1575. key = selector ifTrue: [self implementors add: value].
  1576. (value messageSends includes: selector) ifTrue: [
  1577. self senders add: value]]]
  1578. ! !
  1579. !ReferencesBrowser methodsFor: 'initialization'!
  1580. initialize
  1581. super initialize.
  1582. selector := ''
  1583. ! !
  1584. !ReferencesBrowser methodsFor: 'private'!
  1585. setInputEvents
  1586. input
  1587. onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
  1588. onKeyDown: [timer ifNotNil: [timer clearTimeout]]
  1589. ! !
  1590. !ReferencesBrowser methodsFor: 'rendering'!
  1591. renderBoxOn: html
  1592. self
  1593. renderInputOn: html;
  1594. renderImplementorsOn: html;
  1595. renderSendersOn: html;
  1596. renderReferencedClassesOn: html;
  1597. renderMatchesOn: html
  1598. !
  1599. renderImplementorsOn: html
  1600. implementorsList := html ul class: 'amber_column implementors'.
  1601. self updateImplementorsList
  1602. !
  1603. renderInputOn: html
  1604. input := html input
  1605. class: 'implementors';
  1606. yourself.
  1607. input asJQuery val: selector.
  1608. self setInputEvents
  1609. !
  1610. renderMatchesOn: html
  1611. matchesList := html ul class: 'amber_column matches'.
  1612. self updateMatchesList
  1613. !
  1614. renderReferencedClassesOn: html
  1615. referencedClassesList := html ul class: 'amber_column referenced_classes'.
  1616. self updateReferencedClassesList
  1617. !
  1618. renderSendersOn: html
  1619. sendersList := html ul class: 'amber_column senders'.
  1620. self updateSendersList
  1621. ! !
  1622. !ReferencesBrowser methodsFor: 'testing'!
  1623. canBeClosed
  1624. ^true
  1625. ! !
  1626. !ReferencesBrowser methodsFor: 'updating'!
  1627. updateImplementorsList
  1628. implementorsList contents: [:html |
  1629. html li
  1630. class: 'column_label';
  1631. with: 'Implementors (', self implementors size asString, ')';
  1632. style: 'font-weight: bold'.
  1633. self implementors do: [:each || li |
  1634. li := html li.
  1635. li
  1636. with: (each methodClass asString, ' >> ', self selector);
  1637. onClick: [self openBrowserOn: each]]]
  1638. !
  1639. updateMatchesList
  1640. matchesList contents: [:html |
  1641. html li
  1642. class: 'column_label';
  1643. with: 'Regex matches (', self matches size asString, ')';
  1644. style: 'font-weight: bold'.
  1645. self matches do: [:each || li |
  1646. li := html li.
  1647. li
  1648. with: (each methodClass asString, ' >> ', each selector);
  1649. onClick: [self openBrowserOn: each]]]
  1650. !
  1651. updateReferencedClassesList
  1652. referencedClassesList contents: [:html |
  1653. html li
  1654. class: 'column_label';
  1655. with: 'Class references (', self referencedClasses size asString, ')';
  1656. style: 'font-weight: bold'.
  1657. self referencedClasses do: [:each |
  1658. html li
  1659. with: (each methodClass asString, ' >> ', each selector);
  1660. onClick: [self openBrowserOn: each]]]
  1661. !
  1662. updateSendersList
  1663. sendersList contents: [:html |
  1664. html li
  1665. class: 'column_label';
  1666. with: 'Senders (', self senders size asString, ')';
  1667. style: 'font-weight: bold'.
  1668. self senders do: [:each |
  1669. html li
  1670. with: (each methodClass asString, ' >> ', each selector);
  1671. onClick: [self openBrowserOn: each]]]
  1672. ! !
  1673. !ReferencesBrowser class methodsFor: 'instance creation'!
  1674. search: aString
  1675. ^self new
  1676. searchReferencesFor: aString;
  1677. open
  1678. ! !
  1679. TabWidget subclass: #TestRunner
  1680. instanceVariableNames: 'selectedCategories packagesList selectedClasses classesList selectedMethods progressBar methodsList result statusDiv'
  1681. package: 'IDE'!
  1682. !TestRunner methodsFor: 'accessing'!
  1683. allClasses
  1684. ^TestCase allSubclasses select: [ :each | each isAbstract not ]
  1685. !
  1686. classes
  1687. ^(self allClasses
  1688. select: [:each | self selectedCategories includes: each category])
  1689. sort: [:a :b | a name > b name]
  1690. !
  1691. label
  1692. ^'SUnit'
  1693. !
  1694. packages
  1695. | packages |
  1696. packages := Array new.
  1697. self allClasses do: [:each |
  1698. (packages includes: each category) ifFalse: [
  1699. packages add: each category]].
  1700. ^packages sort
  1701. !
  1702. progressBar
  1703. ^progressBar ifNil: [progressBar := ProgressBar new]
  1704. !
  1705. result
  1706. ^result
  1707. !
  1708. selectedCategories
  1709. ^selectedCategories ifNil: [selectedCategories := Array new]
  1710. !
  1711. selectedClasses
  1712. ^selectedClasses ifNil: [selectedClasses := Array new]
  1713. !
  1714. statusInfo
  1715. ^self printTotal, self printPasses, self printErrors, self printFailures
  1716. !
  1717. testCases
  1718. | testCases |
  1719. testCases := #().
  1720. (self selectedClasses
  1721. select: [:each | self selectedCategories includes: each category])
  1722. do: [:each | testCases addAll: each buildSuite].
  1723. ^testCases
  1724. ! !
  1725. !TestRunner methodsFor: 'actions'!
  1726. performFailure: aTestCase
  1727. aTestCase runCase
  1728. !
  1729. run: aCollection
  1730. | worker |
  1731. worker := TestSuiteRunner on: aCollection.
  1732. result := worker result.
  1733. worker announcer on: ResultAnnouncement do: [:ann |
  1734. ann result == result ifTrue: [
  1735. self progressBar updatePercent: result runs / result total * 100.
  1736. self updateStatusDiv.
  1737. self updateMethodsList
  1738. ]
  1739. ].
  1740. worker run
  1741. !
  1742. selectAllCategories
  1743. self packages do: [:each |
  1744. (selectedCategories includes: each) ifFalse: [
  1745. self selectedCategories add: each]].
  1746. self
  1747. updateCategoriesList;
  1748. updateClassesList
  1749. !
  1750. selectAllClasses
  1751. self classes do: [:each |
  1752. (selectedClasses includes: each) ifFalse: [
  1753. self selectedClasses add: each]].
  1754. self
  1755. updateCategoriesList;
  1756. updateClassesList
  1757. !
  1758. toggleCategory: aCategory
  1759. (self isSelectedCategory: aCategory)
  1760. ifFalse: [selectedCategories add: aCategory]
  1761. ifTrue: [selectedCategories remove: aCategory].
  1762. self
  1763. updateCategoriesList;
  1764. updateClassesList
  1765. !
  1766. toggleClass: aClass
  1767. (self isSelectedClass: aClass)
  1768. ifFalse: [selectedClasses add: aClass]
  1769. ifTrue: [selectedClasses remove: aClass].
  1770. self
  1771. updateClassesList
  1772. ! !
  1773. !TestRunner methodsFor: 'initialization'!
  1774. initialize
  1775. super initialize.
  1776. result := TestResult new
  1777. ! !
  1778. !TestRunner methodsFor: 'printing'!
  1779. printErrors
  1780. ^self result errors size asString , ' errors, '
  1781. !
  1782. printFailures
  1783. ^self result failures size asString, ' failures'
  1784. !
  1785. printPasses
  1786. ^(self result runs - self result errors size - self result failures size) asString , ' passes, '
  1787. !
  1788. printTotal
  1789. ^self result total asString, ' runs, '
  1790. ! !
  1791. !TestRunner methodsFor: 'rendering'!
  1792. renderBoxOn: html
  1793. self
  1794. renderCategoriesOn: html;
  1795. renderClassesOn: html;
  1796. renderResultsOn: html
  1797. !
  1798. renderButtonsOn: html
  1799. html button
  1800. with: 'Run selected';
  1801. onClick: [self run: self testCases]
  1802. !
  1803. renderCategoriesOn: html
  1804. packagesList := html ul class: 'amber_column sunit packages'.
  1805. self updateCategoriesList
  1806. !
  1807. renderClassesOn: html
  1808. classesList := html ul class: 'amber_column sunit classes'.
  1809. self updateClassesList
  1810. !
  1811. renderErrorsOn: html
  1812. self result errors do: [:each |
  1813. html li
  1814. class: 'errors';
  1815. with: each class name, ' >> ', each selector;
  1816. onClick: [self performFailure: each]]
  1817. !
  1818. renderFailuresOn: html
  1819. self result failures do: [:each |
  1820. html li
  1821. class: 'failures';
  1822. with: each class name, ' >> ', each selector;
  1823. onClick: [self performFailure: each]]
  1824. !
  1825. renderResultsOn: html
  1826. statusDiv := html div.
  1827. html with: self progressBar.
  1828. methodsList := html ul class: 'amber_column sunit results'.
  1829. self updateMethodsList.
  1830. self updateStatusDiv
  1831. ! !
  1832. !TestRunner methodsFor: 'testing'!
  1833. isSelectedCategory: aCategory
  1834. ^(self selectedCategories includes: aCategory)
  1835. !
  1836. isSelectedClass: aClass
  1837. ^(self selectedClasses includes: aClass)
  1838. ! !
  1839. !TestRunner methodsFor: 'updating'!
  1840. updateCategoriesList
  1841. packagesList contents: [:html |
  1842. html li
  1843. class: 'all';
  1844. with: 'All';
  1845. onClick: [self selectAllCategories].
  1846. self packages do: [:each || li |
  1847. li := html li.
  1848. (self selectedCategories includes: each) ifTrue: [
  1849. li class: 'selected'].
  1850. li
  1851. with: each;
  1852. onClick: [self toggleCategory: each]]]
  1853. !
  1854. updateClassesList
  1855. classesList contents: [:html |
  1856. (self selectedCategories isEmpty) ifFalse: [
  1857. html li
  1858. class: 'all';
  1859. with: 'All';
  1860. onClick: [self selectAllClasses]].
  1861. self classes do: [:each || li |
  1862. li := html li.
  1863. (self selectedClasses includes: each) ifTrue: [
  1864. li class: 'selected'].
  1865. li
  1866. with: each name;
  1867. onClick: [self toggleClass: each]]]
  1868. !
  1869. updateMethodsList
  1870. methodsList contents: [:html |
  1871. self renderErrorsOn: html.
  1872. self renderFailuresOn: html]
  1873. !
  1874. updateStatusDiv
  1875. statusDiv class: 'sunit status ', result status.
  1876. statusDiv contents: [:html |
  1877. html span with: self statusInfo]
  1878. ! !
  1879. TabWidget subclass: #Workspace
  1880. instanceVariableNames: 'sourceArea'
  1881. package: 'IDE'!
  1882. !Workspace methodsFor: 'accessing'!
  1883. label
  1884. ^'Workspace'
  1885. ! !
  1886. !Workspace methodsFor: 'actions'!
  1887. clearWorkspace
  1888. sourceArea clear
  1889. !
  1890. doIt
  1891. sourceArea doIt
  1892. !
  1893. fileIn
  1894. sourceArea fileIn
  1895. !
  1896. inspectIt
  1897. sourceArea inspectIt
  1898. !
  1899. printIt
  1900. sourceArea printIt
  1901. !
  1902. show
  1903. super show.
  1904. sourceArea focus.
  1905. ! !
  1906. !Workspace methodsFor: 'rendering'!
  1907. renderBoxOn: html
  1908. sourceArea := SourceArea new.
  1909. sourceArea renderOn: html
  1910. !
  1911. renderButtonsOn: html
  1912. html button
  1913. with: 'DoIt';
  1914. title: 'ctrl+d';
  1915. onClick: [self doIt].
  1916. html button
  1917. with: 'PrintIt';
  1918. title: 'ctrl+p';
  1919. onClick: [self printIt].
  1920. html button
  1921. with: 'InspectIt';
  1922. title: 'ctrl+i';
  1923. onClick: [self inspectIt].
  1924. html button
  1925. with: 'FileIn';
  1926. title: 'ctrl+f';
  1927. onClick: [self fileIn].
  1928. html button
  1929. with: 'Clear workspace';
  1930. onClick: [self clearWorkspace]
  1931. ! !
  1932. !Object methodsFor: '*IDE'!
  1933. inspect
  1934. Inspector new
  1935. inspect: self;
  1936. open
  1937. !
  1938. inspectOn: anInspector
  1939. | variables |
  1940. variables := Dictionary new.
  1941. variables at: '#self' put: self.
  1942. self class allInstanceVariableNames do: [:each |
  1943. variables at: each put: (self instVarAt: each)].
  1944. anInspector
  1945. setLabel: self printString;
  1946. setVariables: variables
  1947. ! !
  1948. !Collection methodsFor: '*IDE'!
  1949. inspectOn: anInspector
  1950. | variables |
  1951. variables := Dictionary new.
  1952. variables at: '#self' put: self.
  1953. self withIndexDo: [:each :i |
  1954. variables at: i put: each].
  1955. anInspector
  1956. setLabel: self printString;
  1957. setVariables: variables
  1958. ! !
  1959. !HashedCollection methodsFor: '*IDE'!
  1960. inspectOn: anInspector
  1961. | variables |
  1962. variables := Dictionary new.
  1963. variables at: '#self' put: self.
  1964. variables at: '#keys' put: self keys.
  1965. self keysAndValuesDo: [:key :value |
  1966. variables at: key put: value].
  1967. anInspector
  1968. setLabel: self printString;
  1969. setVariables: variables
  1970. ! !
  1971. !String methodsFor: '*IDE'!
  1972. inspectOn: anInspector
  1973. | label |
  1974. super inspectOn: anInspector.
  1975. self printString size > 30
  1976. ifTrue: [label := (self printString copyFrom: 1 to: 30), '...''']
  1977. ifFalse: [label := self printString].
  1978. anInspector setLabel: label
  1979. ! !
  1980. !Set methodsFor: '*IDE'!
  1981. inspectOn: anInspector
  1982. | variables |
  1983. variables := Dictionary new.
  1984. variables at: '#self' put: self.
  1985. elements withIndexDo: [:each :i |
  1986. variables at: i put: each].
  1987. anInspector
  1988. setLabel: self printString;
  1989. setVariables: variables
  1990. ! !
  1991. !Date methodsFor: '*IDE'!
  1992. inspectOn: anInspector
  1993. | variables |
  1994. variables := Dictionary new.
  1995. variables at: '#self' put: self.
  1996. variables at: '#year' put: self year.
  1997. variables at: '#month' put: self month.
  1998. variables at: '#day' put: self day.
  1999. variables at: '#hours' put: self hours.
  2000. variables at: '#minutes' put: self minutes.
  2001. variables at: '#seconds' put: self seconds.
  2002. variables at: '#milliseconds' put: self milliseconds.
  2003. anInspector
  2004. setLabel: self printString;
  2005. setVariables: variables
  2006. ! !
  2007. !MethodContext methodsFor: '*IDE'!
  2008. inspectOn: anInspector
  2009. | variables |
  2010. variables := Dictionary new.
  2011. variables at: '#self' put: self.
  2012. variables at: '#home' put: self home.
  2013. variables at: '#receiver' put: self receiver.
  2014. variables at: '#selector' put: self selector.
  2015. variables at: '#temps' put: self temps.
  2016. self class instanceVariableNames do: [:each |
  2017. variables at: each put: (self instVarAt: each)].
  2018. anInspector
  2019. setLabel: self printString;
  2020. setVariables: variables
  2021. ! !