2
0

IDE.st 48 KB

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