1
0

IDE.st 50 KB

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