IDE.st 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753
  1. Widget subclass: #TabManager
  2. instanceVariableNames: 'selectedTab tabs opened ul'
  3. category: 'IDE'!
  4. !TabManager methodsFor: 'accessing'!
  5. tabs
  6. ^tabs ifNil: [tabs := Array new]
  7. ! !
  8. !TabManager methodsFor: 'actions'!
  9. updateBodyMargin
  10. self setBodyMargin: '#jtalk' asJQuery height + 27
  11. !
  12. updatePosition
  13. <jQuery('#jtalk').css('top', '').css('bottom', '27px')>
  14. !
  15. removeBodyMargin
  16. self setBodyMargin: 0
  17. !
  18. setBodyMargin: anInteger
  19. '.jtalkBody' asJQuery cssAt: 'margin-bottom' put: anInteger asString, 'px'
  20. !
  21. onResize: aBlock
  22. <jQuery('#jtalk').resizable({
  23. handles: 'n',
  24. resize: aBlock,
  25. minHeight: 230
  26. })>
  27. !
  28. onWindowResize: aBlock
  29. <jQuery(window).resize(aBlock)>
  30. !
  31. open
  32. opened ifFalse: [
  33. 'body' asJQuery addClass: 'jtalkBody'.
  34. '#jtalk' asJQuery show.
  35. ul asJQuery show.
  36. self updateBodyMargin.
  37. selectedTab show.
  38. opened := true]
  39. !
  40. close
  41. opened ifTrue: [
  42. '#jtalk' asJQuery hide.
  43. ul asJQuery hide.
  44. selectedTab hide.
  45. self removeBodyMargin.
  46. 'body' asJQuery removeClass: 'jtalkBody'.
  47. opened := false]
  48. !
  49. newBrowserTab
  50. Browser open
  51. !
  52. selectTab: aWidget
  53. self open.
  54. selectedTab := aWidget.
  55. self tabs do: [:each |
  56. each hide].
  57. aWidget show.
  58. self update
  59. !
  60. closeTab: aWidget
  61. self removeTab: aWidget.
  62. self selectTab: self tabs last.
  63. aWidget remove.
  64. self update
  65. ! !
  66. !TabManager methodsFor: 'adding/Removing'!
  67. addTab: aWidget
  68. self tabs add: aWidget.
  69. '#jtalk' asJQuery append: aWidget.
  70. aWidget hide
  71. !
  72. removeTab: aWidget
  73. self tabs remove: aWidget.
  74. self update
  75. ! !
  76. !TabManager methodsFor: 'initialization'!
  77. initialize
  78. super initialize.
  79. opened := true.
  80. 'body' asJQuery
  81. append: self;
  82. append: [:html | html div id: 'jtalk'];
  83. addClass: 'jtalkBody'.
  84. self
  85. addTab: Transcript current;
  86. addTab: Workspace new.
  87. self selectTab: self tabs last.
  88. self
  89. onResize: [self updateBodyMargin; updatePosition];
  90. onWindowResize: [self updatePosition]
  91. ! !
  92. !TabManager methodsFor: 'rendering'!
  93. renderOn: html
  94. ul := html ul
  95. id: 'jtalkTabs';
  96. yourself.
  97. self renderTabs
  98. !
  99. renderTabFor: aWidget on: html
  100. | li |
  101. li := html li.
  102. selectedTab = aWidget ifTrue: [
  103. li class: 'selected'].
  104. li with: [
  105. aWidget canBeClosed ifTrue: [
  106. html span
  107. class: 'close';
  108. with: 'x';
  109. onClick: [self closeTab: aWidget]].
  110. html span
  111. with: aWidget label;
  112. onClick: [self selectTab: aWidget]]
  113. !
  114. renderTabs
  115. ul contents: [:html |
  116. html li
  117. class: 'closeAll';
  118. with: 'x';
  119. onClick: [self close].
  120. self tabs do: [:each |
  121. self renderTabFor: each on: html].
  122. html li
  123. class: 'newtab';
  124. with: ' + ';
  125. onClick: [self newBrowserTab]]
  126. ! !
  127. !TabManager methodsFor: 'updating'!
  128. update
  129. self renderTabs
  130. ! !
  131. TabManager class instanceVariableNames: 'current'!
  132. !TabManager class methodsFor: 'instance creation'!
  133. current
  134. ^current ifNil: [current := super new]
  135. !
  136. new
  137. self shouldNotImplement
  138. ! !
  139. Widget subclass: #TabWidget
  140. instanceVariableNames: 'div'
  141. category: 'IDE'!
  142. !TabWidget methodsFor: 'accessing'!
  143. label
  144. self subclassResponsibility
  145. ! !
  146. !TabWidget methodsFor: 'actions'!
  147. open
  148. TabManager current addTab: self.
  149. TabManager current selectTab: self
  150. !
  151. show
  152. div asJQuery show
  153. !
  154. hide
  155. div asJQuery hide
  156. !
  157. remove
  158. div asJQuery remove
  159. ! !
  160. !TabWidget methodsFor: 'rendering'!
  161. renderOn: html
  162. div := html div
  163. class: 'jtalkTool';
  164. yourself.
  165. self renderTab
  166. !
  167. renderBoxOn: html
  168. !
  169. renderButtonsOn: html
  170. !
  171. update
  172. self renderTab
  173. !
  174. renderTab
  175. div contents: [:html |
  176. html div
  177. class: 'jt_box';
  178. with: [self renderBoxOn: html].
  179. html div
  180. class: 'jt_buttons';
  181. with: [self renderButtonsOn: html]]
  182. ! !
  183. !TabWidget methodsFor: 'testing'!
  184. canBeClosed
  185. ^false
  186. ! !
  187. !TabWidget class methodsFor: 'instance creation'!
  188. open
  189. ^self new open
  190. ! !
  191. TabWidget subclass: #Workspace
  192. instanceVariableNames: 'sourceArea'
  193. category: 'IDE'!
  194. !Workspace methodsFor: 'accessing'!
  195. label
  196. ^'[Workspace]'
  197. ! !
  198. !Workspace methodsFor: 'actions'!
  199. clearWorkspace
  200. sourceArea clear
  201. !
  202. doIt
  203. sourceArea doIt
  204. !
  205. printIt
  206. sourceArea printIt
  207. !
  208. inspectIt
  209. sourceArea inspectIt
  210. ! !
  211. !Workspace methodsFor: 'rendering'!
  212. renderBoxOn: html
  213. sourceArea := SourceArea new.
  214. sourceArea renderOn: html
  215. !
  216. renderButtonsOn: html
  217. html button
  218. with: 'DoIt';
  219. title: 'ctrl+d';
  220. onClick: [self doIt].
  221. html button
  222. with: 'PrintIt';
  223. title: 'ctrl+p';
  224. onClick: [self printIt].
  225. html button
  226. with: 'InspectIt';
  227. title: 'ctrl+i';
  228. onClick: [self inspectIt].
  229. html button
  230. with: 'Clear workspace';
  231. onClick: [self clearWorkspace]
  232. ! !
  233. TabWidget subclass: #Transcript
  234. instanceVariableNames: 'textarea'
  235. category: 'IDE'!
  236. !Transcript methodsFor: 'accessing'!
  237. label
  238. ^'[Transcript]'
  239. ! !
  240. !Transcript methodsFor: 'actions'!
  241. show: anObject
  242. textarea asJQuery val: textarea asJQuery val, anObject asString.
  243. !
  244. cr
  245. textarea asJQuery val: textarea asJQuery val, String cr.
  246. !
  247. clear
  248. textarea asJQuery val: ''
  249. ! !
  250. !Transcript methodsFor: 'rendering'!
  251. renderBoxOn: html
  252. textarea := html textarea.
  253. textarea asJQuery call: 'tabby'.
  254. textarea
  255. class: 'jt_transcript';
  256. at: 'spellcheck' put: 'false'
  257. !
  258. renderButtonsOn: html
  259. html button
  260. with: 'Clear transcript';
  261. onClick: [self clear]
  262. ! !
  263. Transcript class instanceVariableNames: 'current'!
  264. !Transcript class methodsFor: 'instance creation'!
  265. open
  266. self current open
  267. !
  268. new
  269. self shouldNotImplement
  270. !
  271. current
  272. ^current ifNil: [current := super new]
  273. ! !
  274. !Transcript class methodsFor: 'printing'!
  275. show: anObject
  276. self current show: anObject
  277. !
  278. cr
  279. self current show: String cr
  280. !
  281. clear
  282. self current clear
  283. ! !
  284. TabWidget subclass: #Browser
  285. instanceVariableNames: 'selectedCategory selectedClass selectedProtocol selectedMethod commitButton categoriesList classesList protocolsList methodsList sourceArea tabsList selectedTab saveButton classButtons methodButtons unsavedChanges input'
  286. category: 'IDE'!
  287. !Browser methodsFor: 'accessing'!
  288. label
  289. ^selectedClass
  290. ifNil: ['Browser (nil)']
  291. ifNotNil: [selectedClass name]
  292. !
  293. categories
  294. | categories |
  295. categories := Array new.
  296. Smalltalk current classes do: [:each |
  297. (categories includes: each category) ifFalse: [
  298. categories add: each category]].
  299. ^categories sort
  300. !
  301. classes
  302. ^(Smalltalk current classes
  303. select: [:each | each category = selectedCategory])
  304. sort: [:a :b | a name > b name]
  305. !
  306. protocols
  307. | klass |
  308. selectedClass ifNotNil: [
  309. selectedTab = #comment ifTrue: [^#()].
  310. klass := selectedTab = #instance
  311. ifTrue: [selectedClass]
  312. ifFalse: [selectedClass class].
  313. klass methodDictionary isEmpty ifTrue: [
  314. ^Array with: 'not yet classified'].
  315. ^klass protocols].
  316. ^Array new
  317. !
  318. methods
  319. | klass |
  320. selectedTab = #comment ifTrue: [^#()].
  321. selectedClass ifNotNil: [
  322. klass := selectedTab = #instance
  323. ifTrue: [selectedClass]
  324. ifFalse: [selectedClass class]].
  325. ^(selectedProtocol
  326. ifNil: [
  327. klass
  328. ifNil: [#()]
  329. ifNotNil: [klass methodDictionary values]]
  330. ifNotNil: [
  331. klass methodDictionary values select: [:each |
  332. each category = selectedProtocol]]) sort: [:a :b | a selector > b selector]
  333. !
  334. source
  335. selectedTab = #comment ifFalse: [
  336. ^(selectedProtocol notNil or: [selectedMethod notNil])
  337. ifFalse: [self declarationSource]
  338. ifTrue: [self methodSource]].
  339. ^selectedClass
  340. ifNil: ['']
  341. ifNotNil: [self classCommentSource]
  342. !
  343. methodSource
  344. ^selectedMethod
  345. ifNil: [self dummyMethodSource]
  346. ifNotNil: [selectedMethod source]
  347. !
  348. dummyMethodSource
  349. ^'messageSelectorAndArgumentNames
  350. "comment stating purpose of message"
  351. | temporary variable names |
  352. statements'
  353. !
  354. declarationSource
  355. ^selectedTab = #instance
  356. ifTrue: [self classDeclarationSource]
  357. ifFalse: [self metaclassDeclarationSource]
  358. !
  359. classDeclarationSource
  360. | stream |
  361. stream := '' writeStream.
  362. selectedClass ifNotNil: [
  363. stream
  364. nextPutAll: selectedClass superclass asString;
  365. nextPutAll: ' subclass: #';
  366. nextPutAll: selectedClass name;
  367. nextPutAll: String lf, String tab;
  368. nextPutAll: 'instanceVariableNames: '''.
  369. selectedClass instanceVariableNames
  370. do: [:each | stream nextPutAll: each]
  371. separatedBy: [stream nextPutAll: ' '].
  372. stream
  373. nextPutAll: '''', String lf, String tab;
  374. nextPutAll: 'category: ''';
  375. nextPutAll: selectedClass category;
  376. nextPutAll: ''''].
  377. ^stream contents
  378. !
  379. metaclassDeclarationSource
  380. | stream |
  381. stream := '' writeStream.
  382. selectedClass ifNotNil: [
  383. stream
  384. nextPutAll: selectedClass asString;
  385. nextPutAll: ' class ';
  386. nextPutAll: 'instanceVariableNames: '''.
  387. selectedClass class instanceVariableNames
  388. do: [:each | stream nextPutAll: each]
  389. separatedBy: [stream nextPutAll: ' '].
  390. stream nextPutAll: ''''].
  391. ^stream contents
  392. !
  393. classCommentSource
  394. ^selectedClass comment
  395. !
  396. selectedClass
  397. ^selectedClass
  398. ! !
  399. !Browser methodsFor: 'actions'!
  400. disableSaveButton
  401. saveButton ifNotNil: [
  402. saveButton at: 'disabled' put: true].
  403. unsavedChanges := false
  404. !
  405. hideClassButtons
  406. classButtons asJQuery hide
  407. !
  408. showClassButtons
  409. classButtons asJQuery show
  410. !
  411. hideMethodButtons
  412. methodButtons asJQuery hide
  413. !
  414. showMethodButtons
  415. methodButtons asJQuery show
  416. !
  417. compile
  418. self disableSaveButton.
  419. selectedTab = #comment
  420. ifTrue: [
  421. selectedClass ifNotNil: [
  422. self compileClassComment]]
  423. ifFalse: [
  424. (selectedProtocol notNil or: [selectedMethod notNil])
  425. ifFalse: [self compileDefinition]
  426. ifTrue: [self compileMethodDefinition]].
  427. !
  428. compileClassComment
  429. selectedClass comment: sourceArea val
  430. !
  431. compileMethodDefinition
  432. selectedTab = #instance
  433. ifTrue: [self compileMethodDefinitionFor: selectedClass]
  434. ifFalse: [self compileMethodDefinitionFor: selectedClass class]
  435. !
  436. compileMethodDefinitionFor: aClass
  437. | compiler method source node |
  438. source := sourceArea val.
  439. selectedProtocol ifNil: [selectedProtocol := selectedMethod category].
  440. compiler := Compiler new.
  441. node := compiler parse: source.
  442. node isParseFailure ifTrue: [
  443. ^self alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString].
  444. compiler currentClass: aClass.
  445. method := compiler eval: (compiler compileNode: node).
  446. method category: selectedProtocol.
  447. compiler unknownVariables do: [:each |
  448. (self confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
  449. self addInstanceVariableNamed: each toClass: aClass.
  450. ^self compileMethodDefinitionFor: aClass]].
  451. aClass addCompiledMethod: method.
  452. compiler setupClass: aClass.
  453. self updateMethodsList.
  454. self selectMethod: method
  455. !
  456. compileDefinition
  457. | newClass |
  458. newClass := Compiler new loadExpression: sourceArea val.
  459. self
  460. resetClassesList;
  461. updateCategoriesList;
  462. updateClassesList
  463. !
  464. commitCategory
  465. selectedCategory ifNotNil: [
  466. (Ajax url: self class commitPathJs, '/', selectedCategory, '.js')
  467. at: 'type' put: 'PUT';
  468. at: 'data' put: (Exporter new exportCategory: selectedCategory);
  469. at: 'error' put: [self alert: 'Commit failed!!'];
  470. send.
  471. (Ajax url: self class commitPathJs, '/', selectedCategory, '.deploy.js')
  472. at: 'type' put: 'PUT';
  473. at: 'data' put: (Exporter new exportCategory: selectedCategory);
  474. at: 'error' put: [self alert: 'Commit failed!!'];
  475. send.
  476. (Ajax url: self class commitPathSt, '/', selectedCategory, '.st')
  477. at: 'type' put: 'PUT';
  478. at: 'data' put: (ChunkExporter new exportCategory: selectedCategory);
  479. at: 'error' put: [self alert: 'Commit failed!!'];
  480. send]
  481. !
  482. cancelChanges
  483. ^unsavedChanges
  484. ifTrue: [self confirm: 'Cancel changes?']
  485. ifFalse: [true]
  486. !
  487. removeClass
  488. (self confirm: 'Do you really want to remove ', selectedClass name, '?')
  489. ifTrue: [
  490. Smalltalk current removeClass: selectedClass.
  491. self resetClassesList.
  492. self selectClass: nil]
  493. !
  494. removeMethod
  495. self cancelChanges ifTrue: [
  496. (self confirm: 'Do you really want to remove #', selectedMethod selector, '?')
  497. ifTrue: [
  498. selectedTab = #instance
  499. ifTrue: [selectedClass removeCompiledMethod: selectedMethod]
  500. ifFalse: [selectedClass class removeCompiledMethod: selectedMethod].
  501. self selectMethod: nil]]
  502. !
  503. setMethodProtocol: aString
  504. self cancelChanges ifTrue: [
  505. (self protocols includes: aString)
  506. ifFalse: [self addNewProtocol]
  507. ifTrue: [
  508. selectedMethod category: aString.
  509. selectedProtocol := aString.
  510. selectedMethod := selectedMethod.
  511. self
  512. updateProtocolsList;
  513. updateMethodsList;
  514. updateSourceAndButtons]]
  515. !
  516. addNewProtocol
  517. | newProtocol |
  518. newProtocol := self prompt: 'New method protocol'.
  519. newProtocol notEmpty ifTrue: [
  520. selectedMethod category: newProtocol.
  521. self setMethodProtocol: newProtocol]
  522. !
  523. selectCategory: aCategory
  524. self cancelChanges ifTrue: [
  525. selectedCategory := aCategory.
  526. selectedClass := selectedProtocol := selectedMethod := nil.
  527. self resetClassesList.
  528. self
  529. updateCategoriesList;
  530. updateClassesList;
  531. updateProtocolsList;
  532. updateMethodsList;
  533. updateSourceAndButtons]
  534. !
  535. selectClass: aClass
  536. self cancelChanges ifTrue: [
  537. selectedClass := aClass.
  538. selectedProtocol := selectedMethod := nil.
  539. self
  540. updateClassesList;
  541. updateProtocolsList;
  542. updateMethodsList;
  543. updateSourceAndButtons]
  544. !
  545. selectProtocol: aString
  546. self cancelChanges ifTrue: [
  547. selectedProtocol := aString.
  548. selectedMethod := nil.
  549. self
  550. updateProtocolsList;
  551. updateMethodsList;
  552. updateSourceAndButtons]
  553. !
  554. selectMethod: aMethod
  555. self cancelChanges ifTrue: [
  556. selectedMethod := aMethod.
  557. self
  558. updateProtocolsList;
  559. updateMethodsList;
  560. updateSourceAndButtons]
  561. !
  562. selectTab: aString
  563. self cancelChanges ifTrue: [
  564. selectedTab := aString.
  565. self selectProtocol: nil.
  566. self updateTabsList]
  567. !
  568. renameClass
  569. | newName |
  570. newName := self prompt: 'Rename class ', selectedClass name.
  571. newName notEmpty ifTrue: [
  572. selectedClass rename: newName.
  573. self
  574. updateClassesList;
  575. updateSourceAndButtons]
  576. !
  577. addInstanceVariableNamed: aString toClass: aClass
  578. ClassBuilder new
  579. addSubclassOf: aClass superclass named: aClass name instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)
  580. !
  581. searchReferencesOf: aString
  582. ReferencesBrowser search: aString
  583. !
  584. searchClassReferences
  585. ReferencesBrowser search: selectedClass name
  586. !
  587. search: aString
  588. self cancelChanges ifTrue: [| searchedClass |
  589. searchedClass := Smalltalk current at: aString.
  590. searchedClass isClass
  591. ifTrue: [self class openOn: searchedClass]
  592. ifFalse: [self searchReferencesOf: aString]]
  593. ! !
  594. !Browser methodsFor: 'initialization'!
  595. initialize
  596. super initialize.
  597. selectedTab := #instance.
  598. unsavedChanges := false
  599. ! !
  600. !Browser methodsFor: 'rendering'!
  601. renderBoxOn: html
  602. self
  603. renderTopPanelOn: html;
  604. renderTabsOn: html;
  605. renderBottomPanelOn: html
  606. !
  607. renderTopPanelOn: html
  608. html div
  609. class: 'top';
  610. with: [
  611. self renderInputOn: html.
  612. categoriesList := html ul class: 'jt_column browser categories'.
  613. commitButton := html button
  614. class: 'jt_commit';
  615. title: 'Commit classes in this category to disk';
  616. onClick: [self commitCategory];
  617. with: 'Commit category'.
  618. classesList := ClassesList on: self.
  619. classesList renderOn: html.
  620. protocolsList := html ul class: 'jt_column browser protocols'.
  621. methodsList := html ul class: 'jt_column browser methods'.
  622. self
  623. updateCategoriesList;
  624. updateClassesList;
  625. updateProtocolsList;
  626. updateMethodsList.
  627. html div class: 'jt_clear']
  628. !
  629. renderTabsOn: html
  630. tabsList := html ul class: 'jt_tabs'.
  631. self updateTabsList.
  632. !
  633. renderBottomPanelOn: html
  634. html div
  635. class: 'jt_sourceCode';
  636. with: [
  637. sourceArea := SourceArea new.
  638. sourceArea renderOn: html.
  639. sourceArea
  640. onKeyUp: [self updateStatus]]
  641. !
  642. renderButtonsOn: html
  643. saveButton := html button.
  644. saveButton
  645. with: 'Save';
  646. onClick: [self compile].
  647. methodButtons := html span.
  648. classButtons := html span.
  649. html div
  650. class: 'right';
  651. with: [
  652. html button
  653. with: 'DoIt';
  654. onClick: [sourceArea doIt].
  655. html button
  656. with: 'PrintIt';
  657. onClick: [sourceArea printIt].
  658. html button with: 'InspectIt';
  659. onClick: [sourceArea inspectit]].
  660. self updateSourceAndButtons
  661. !
  662. renderInputOn: html
  663. input := html input
  664. class: 'implementors';
  665. yourself.
  666. input onKeyPress: [:event |
  667. event keyCode = 13 ifTrue: [
  668. self search: input asJQuery val]]
  669. ! !
  670. !Browser methodsFor: 'testing'!
  671. canBeClosed
  672. ^true
  673. ! !
  674. !Browser methodsFor: 'updating'!
  675. updateCategoriesList
  676. categoriesList contents: [:html |
  677. self categories do: [:each || li label |
  678. each isEmpty
  679. ifTrue: [label := 'Unclassified']
  680. ifFalse: [label := each].
  681. li := html li.
  682. selectedCategory = each ifTrue: [
  683. li class: 'selected'].
  684. li
  685. with: label;
  686. onClick: [self selectCategory: each]]]
  687. !
  688. updateClassesList
  689. TabManager current update.
  690. classesList updateNodes.
  691. "classesList contents: [:html |
  692. self classes do: [:each || li |
  693. li := html li.
  694. selectedClass = each ifTrue: [
  695. li class: 'selected'].
  696. li
  697. with: each name;
  698. onClick: [self selectClass: each]]]"
  699. !
  700. updateProtocolsList
  701. protocolsList contents: [:html |
  702. self protocols do: [:each || li |
  703. li := html li.
  704. selectedProtocol = each ifTrue: [
  705. li class: 'selected'].
  706. li
  707. with: each;
  708. onClick: [self selectProtocol: each]]]
  709. !
  710. updateMethodsList
  711. methodsList contents: [:html |
  712. self methods do: [:each || li |
  713. li := html li.
  714. selectedMethod = each ifTrue: [
  715. li class: 'selected'].
  716. li
  717. with: each selector;
  718. onClick: [self selectMethod: each]]]
  719. !
  720. updateTabsList
  721. tabsList contents: [:html || li |
  722. li := html li.
  723. selectedTab = #instance ifTrue: [li class: 'selected'].
  724. li
  725. with: 'Instance';
  726. onClick: [self selectTab: #instance].
  727. li := html li.
  728. selectedTab = #class ifTrue: [li class: 'selected'].
  729. li
  730. with: 'Class';
  731. onClick: [self selectTab: #class].
  732. li := html li.
  733. selectedTab = #comment ifTrue: [li class: 'selected'].
  734. li
  735. with: 'Comment';
  736. onClick: [self selectTab: #comment]]
  737. !
  738. updateSourceAndButtons
  739. self disableSaveButton.
  740. classButtons contents: [:html |
  741. html button
  742. with: 'Rename class';
  743. onClick: [self renameClass].
  744. html button
  745. with: 'Remove class';
  746. onClick: [self removeClass].
  747. html button
  748. with: 'References';
  749. onClick: [self searchClassReferences]].
  750. methodButtons contents: [:html |
  751. html button
  752. with: 'Remove method';
  753. onClick: [self removeMethod].
  754. html select
  755. onChange: [:e :select | self setMethodProtocol: select val];
  756. with: [
  757. html option
  758. with: 'Method protocol';
  759. at: 'disabled' put: 'disabled'.
  760. html option
  761. class: 'important';
  762. with: 'New...'.
  763. self protocols do: [:each |
  764. html option with: each]].
  765. selectedMethod isNil ifFalse: [
  766. html select
  767. onChange: [:e :select | self searchReferencesOf: select val];
  768. with: [
  769. html option
  770. with: 'References';
  771. at: 'disabled' put: 'disabled'.
  772. html option
  773. class: 'important';
  774. with: selectedMethod selector.
  775. selectedMethod messageSends sorted do: [:each |
  776. html option with: each]]]].
  777. selectedMethod isNil
  778. ifTrue: [
  779. self hideMethodButtons.
  780. (selectedClass isNil or: [selectedProtocol notNil])
  781. ifTrue: [self hideClassButtons]
  782. ifFalse: [self showClassButtons]]
  783. ifFalse: [
  784. self hideClassButtons.
  785. self showMethodButtons].
  786. sourceArea val: self source
  787. !
  788. updateStatus
  789. sourceArea val = self source
  790. ifTrue: [
  791. saveButton ifNotNil: [
  792. saveButton at: 'disabled' put: true].
  793. unsavedChanges := false]
  794. ifFalse: [
  795. saveButton ifNotNil: [
  796. saveButton removeAt: 'disabled'].
  797. unsavedChanges := true]
  798. !
  799. resetClassesList
  800. classesList resetNodes
  801. ! !
  802. !Browser class methodsFor: 'accessing'!
  803. commitPathJs
  804. ^'js'
  805. !
  806. commitPathSt
  807. ^'st'
  808. ! !
  809. !Browser class methodsFor: 'convenience'!
  810. openOn: aClass
  811. ^self new
  812. open;
  813. selectCategory: aClass category;
  814. selectClass: aClass
  815. !
  816. open
  817. self new open
  818. ! !
  819. TabWidget subclass: #Inspector
  820. instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea workspaceTextarea diveButton'
  821. category: 'IDE'!
  822. !Inspector methodsFor: 'accessing'!
  823. label
  824. ^label ifNil: ['Inspector (nil)']
  825. !
  826. variables
  827. ^variables
  828. !
  829. setVariables: aCollection
  830. variables := aCollection
  831. !
  832. setLabel: aString
  833. label := aString
  834. !
  835. selectedVariable
  836. ^selectedVariable
  837. !
  838. selectedVariable: aString
  839. selectedVariable := aString
  840. ! !
  841. !Inspector methodsFor: 'actions'!
  842. inspect: anObject
  843. object := anObject.
  844. variables := #().
  845. object inspectOn: self
  846. !
  847. dive
  848. (self variables at: self selectedVariable) inspect
  849. !
  850. refresh
  851. self
  852. inspect: object;
  853. updateVariablesList;
  854. updateValueTextarea
  855. ! !
  856. !Inspector methodsFor: 'rendering'!
  857. renderBoxOn: html
  858. self
  859. renderTopPanelOn: html;
  860. renderBottomPanelOn: html
  861. !
  862. renderTopPanelOn: html
  863. html div
  864. class: 'top';
  865. with: [
  866. variablesList := html ul class: 'jt_column variables'.
  867. valueTextarea := html textarea class: 'jt_column value'; at: 'readonly' put: 'readonly'.
  868. self
  869. updateVariablesList;
  870. updateValueTextarea.
  871. html div class: 'jt_clear']
  872. !
  873. renderBottomPanelOn: html
  874. html div
  875. class: 'jt_sourceCode';
  876. with: [
  877. workspaceTextarea := html textarea
  878. class: 'source';
  879. at: 'spellcheck' put: 'false'.
  880. workspaceTextarea asJQuery call: 'tabby']
  881. !
  882. renderButtonsOn: html
  883. html button
  884. with: 'Refresh';
  885. onClick: [self refresh].
  886. diveButton := html button
  887. with: 'Dive';
  888. onClick: [self dive].
  889. self updateButtons
  890. ! !
  891. !Inspector methodsFor: 'testing'!
  892. canBeClosed
  893. ^true
  894. ! !
  895. !Inspector methodsFor: 'updating'!
  896. updateVariablesList
  897. variablesList contents: [:html |
  898. self variables keys do: [:each || li |
  899. li := html li.
  900. li
  901. with: each;
  902. onClick: [self selectVariable: each].
  903. self selectedVariable = each ifTrue: [
  904. li class: 'selected']]]
  905. !
  906. selectVariable: aString
  907. self selectedVariable: aString.
  908. self
  909. updateVariablesList;
  910. updateValueTextarea;
  911. updateButtons
  912. !
  913. updateValueTextarea
  914. valueTextarea asJQuery val: (self selectedVariable isNil
  915. ifTrue: ['']
  916. ifFalse: [(self variables at: self selectedVariable) printString])
  917. !
  918. updateButtons
  919. (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
  920. ifFalse: [diveButton at: 'disabled' put: true]
  921. ifTrue: [diveButton removeAt: 'disabled']
  922. ! !
  923. !Inspector class methodsFor: 'instance creation'!
  924. on: anObject
  925. ^self new
  926. inspect: anObject;
  927. yourself
  928. ! !
  929. TabWidget subclass: #ReferencesBrowser
  930. instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList'
  931. category: 'IDE'!
  932. !ReferencesBrowser methodsFor: 'accessing'!
  933. implementors
  934. ^implementors ifNil: [implementors := Array new]
  935. !
  936. label
  937. ^'[ReferencesBrowser]'
  938. !
  939. selector
  940. ^selector
  941. !
  942. senders
  943. ^senders ifNil: [senders := Array new]
  944. !
  945. classesAndMetaclasses
  946. ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
  947. !
  948. referencedClasses
  949. ^referencedClasses ifNil: [referencedClasses := Array new]
  950. ! !
  951. !ReferencesBrowser methodsFor: 'actions'!
  952. openBrowserOn: aMethod
  953. | browser |
  954. browser := Browser openOn: (aMethod class isMetaclass
  955. ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
  956. aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
  957. browser
  958. selectProtocol: aMethod category;
  959. selectMethod: aMethod
  960. !
  961. searchReferencesFor: aString
  962. selector := aString.
  963. implementors := Array new.
  964. senders := Array new.
  965. referencedClasses := Array new.
  966. (selector match: '^[A-Z]')
  967. ifFalse: [self searchSelectorReferencesFor: selector]
  968. ifTrue: [self searchReferencedClassesFor: selector]
  969. !
  970. search: aString
  971. self
  972. searchReferencesFor: aString;
  973. updateImplementorsList;
  974. updateSendersList;
  975. updateReferencedClassesList
  976. !
  977. searchReferencedClassesFor: aString
  978. self classesAndMetaclasses do: [:each |
  979. each methodDictionary values do: [:value |
  980. (((value referencedClasses select: [:each | each notNil])collect: [:each | each name]) includes: selector) ifTrue: [
  981. self referencedClasses add: value]]]
  982. !
  983. searchSelectorReferencesFor: aString
  984. self classesAndMetaclasses do: [:each |
  985. each methodDictionary keysAndValuesDo: [:key :value |
  986. key = selector ifTrue: [self implementors add: value]].
  987. each methodDictionary keysAndValuesDo: [:key :value |
  988. (value messageSends includes: selector) ifTrue: [
  989. self senders add: value]]]
  990. ! !
  991. !ReferencesBrowser methodsFor: 'initialization'!
  992. initialize
  993. super initialize.
  994. selector := ''
  995. ! !
  996. !ReferencesBrowser methodsFor: 'private'!
  997. setInputEvents
  998. input
  999. onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
  1000. onKeyDown: [timer ifNotNil: [timer clearTimeout]]
  1001. ! !
  1002. !ReferencesBrowser methodsFor: 'rendering'!
  1003. renderBoxOn: html
  1004. self
  1005. renderInputOn: html;
  1006. renderImplementorsOn: html;
  1007. renderSendersOn: html;
  1008. renderReferencedClassesOn: html
  1009. !
  1010. renderInputOn: html
  1011. input := html input
  1012. class: 'implementors';
  1013. yourself.
  1014. input asJQuery val: selector.
  1015. self setInputEvents
  1016. !
  1017. renderImplementorsOn: html
  1018. implementorsList := html ul class: 'jt_column implementors'.
  1019. self updateImplementorsList
  1020. !
  1021. renderSendersOn: html
  1022. sendersList := html ul class: 'jt_column senders'.
  1023. self updateSendersList
  1024. !
  1025. renderReferencedClassesOn: html
  1026. referencedClassesList := html ul class: 'jt_column referenced_classes'.
  1027. self updateReferencedClassesList
  1028. ! !
  1029. !ReferencesBrowser methodsFor: 'testing'!
  1030. canBeClosed
  1031. ^true
  1032. ! !
  1033. !ReferencesBrowser methodsFor: 'updating'!
  1034. updateImplementorsList
  1035. implementorsList contents: [:html |
  1036. html li
  1037. class: 'column_label';
  1038. with: 'Implementors (', self implementors size asString, ')';
  1039. style: 'font-weight: bold'.
  1040. self implementors do: [:each || li |
  1041. li := html li.
  1042. li
  1043. with: (each methodClass asString, ' >> ', self selector);
  1044. onClick: [self openBrowserOn: each]]]
  1045. !
  1046. updateSendersList
  1047. sendersList contents: [:html |
  1048. html li
  1049. class: 'column_label';
  1050. with: 'Senders (', self senders size asString, ')';
  1051. style: 'font-weight: bold'.
  1052. self senders do: [:each |
  1053. html li
  1054. with: (each methodClass asString, ' >> ', each selector);
  1055. onClick: [self openBrowserOn: each]]]
  1056. !
  1057. updateReferencedClassesList
  1058. referencedClassesList contents: [:html |
  1059. html li
  1060. class: 'column_label';
  1061. with: 'Class references (', self referencedClasses size asString, ')';
  1062. style: 'font-weight: bold'.
  1063. self referencedClasses do: [:each |
  1064. html li
  1065. with: (each methodClass asString, ' >> ', each selector);
  1066. onClick: [self openBrowserOn: each]]]
  1067. ! !
  1068. !ReferencesBrowser class methodsFor: 'instance creation'!
  1069. search: aString
  1070. ^self new
  1071. searchReferencesFor: aString;
  1072. open
  1073. ! !
  1074. Widget subclass: #SourceArea
  1075. instanceVariableNames: 'editor div'
  1076. category: 'IDE'!
  1077. !SourceArea methodsFor: 'accessing'!
  1078. val
  1079. ^editor getValue
  1080. !
  1081. val: aString
  1082. editor setValue: aString
  1083. !
  1084. currentLine
  1085. ^editor getLine: (editor getCursor line)
  1086. !
  1087. selection
  1088. ^editor getSelection
  1089. !
  1090. selectionEnd
  1091. ^textarea element selectionEnd
  1092. !
  1093. selectionStart
  1094. ^textarea element selectionStart
  1095. !
  1096. selectionStart: anInteger
  1097. textarea element selectionStart: anInteger
  1098. !
  1099. selectionEnd: anInteger
  1100. textarea element selectionEnd: anInteger
  1101. !
  1102. setEditorOn: aTextarea
  1103. <self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  1104. theme: 'jtalk',
  1105. lineNumbers: true,
  1106. enterMode: 'classic',
  1107. matchBrackets: true,
  1108. electricChars: false,
  1109. })>
  1110. !
  1111. editor
  1112. ^editor
  1113. ! !
  1114. !SourceArea methodsFor: 'actions'!
  1115. clear
  1116. textarea asJQuery val: ''
  1117. !
  1118. doIt
  1119. | selection |
  1120. editor somethingSelected
  1121. ifFalse: [selection := self currentLine]
  1122. ifTrue: [selection := self selection].
  1123. ^self eval: selection
  1124. !
  1125. eval: aString
  1126. | compiler node |
  1127. compiler := Compiler new.
  1128. node := compiler parseExpression: aString.
  1129. node isParseFailure ifTrue: [
  1130. ^self alert: node reason, ', position: ', node position].
  1131. ^compiler loadExpression: aString
  1132. !
  1133. handleKeyDown: anEvent
  1134. <if(anEvent.ctrlKey) {
  1135. if(anEvent.keyCode === 80) { //ctrl+p
  1136. self._printIt();
  1137. anEvent.preventDefault();
  1138. return false;
  1139. }
  1140. if(anEvent.keyCode === 68) { //ctrl+d
  1141. self._doIt();
  1142. anEvent.preventDefault();
  1143. return false;
  1144. }
  1145. if(anEvent.keyCode === 73) { //ctrl+i
  1146. self._inspectIt();
  1147. anEvent.preventDefault();
  1148. return false;
  1149. }
  1150. }>
  1151. !
  1152. inspectIt
  1153. self doIt inspect
  1154. !
  1155. print: aString
  1156. | start stop |
  1157. start := Dictionary new.
  1158. stop := Dictionary new.
  1159. start at: 'line' put: (editor getCursor: false) line.
  1160. start at: 'ch' put: (editor getCursor: false) ch.
  1161. stop at: 'line' put: (start at: 'line').
  1162. stop at: 'ch' put: ((start at: 'ch') + aString size + 2).
  1163. editor replaceSelection: (editor getSelection, ' ', aString, ' ').
  1164. editor setCursor: (editor getCursor: true).
  1165. editor setSelection: stop end: start.
  1166. console log: start; log: stop
  1167. !
  1168. printIt
  1169. self print: self doIt printString
  1170. ! !
  1171. !SourceArea methodsFor: 'events'!
  1172. onKeyUp: aBlock
  1173. div onKeyUp: aBlock
  1174. !
  1175. onKeyDown: aBlock
  1176. div onKeyDown: aBlock
  1177. ! !
  1178. !SourceArea methodsFor: 'rendering'!
  1179. renderOn: html
  1180. | textarea |
  1181. div := html div class: 'source'.
  1182. div with: [textarea := html textarea].
  1183. self setEditorOn: textarea element.
  1184. div onKeyDown: [:e | self handleKeyDown: e]
  1185. ! !
  1186. Widget subclass: #ClassesList
  1187. instanceVariableNames: 'browser ul nodes'
  1188. category: 'IDE'!
  1189. !ClassesList methodsFor: 'accessing'!
  1190. category
  1191. ^self browser selectedCategory
  1192. !
  1193. nodes
  1194. nodes ifNil: [nodes := self getNodes].
  1195. ^nodes
  1196. !
  1197. browser
  1198. ^browser
  1199. !
  1200. browser: aBrowser
  1201. browser := aBrowser
  1202. !
  1203. getNodes
  1204. | classes children others |
  1205. classes := self browser classes.
  1206. children := #().
  1207. others := #().
  1208. classes do: [:each |
  1209. (classes includes: each superclass)
  1210. ifFalse: [children add: each]
  1211. ifTrue: [others add: each]].
  1212. ^children collect: [:each |
  1213. ClassesListNode on: each browser: self browser classes: others level: 0]
  1214. !
  1215. resetNodes
  1216. nodes := nil
  1217. ! !
  1218. !ClassesList methodsFor: 'rendering'!
  1219. renderOn: html
  1220. ul := html ul
  1221. class: 'jt_column browser classes';
  1222. yourself.
  1223. self updateNodes
  1224. !
  1225. updateNodes
  1226. ul contents: [:html |
  1227. self nodes do: [:each |
  1228. each renderOn: html]]
  1229. ! !
  1230. !ClassesList class methodsFor: 'instance creation'!
  1231. on: aBrowser
  1232. ^self new
  1233. browser: aBrowser;
  1234. yourself
  1235. ! !
  1236. Widget subclass: #ClassesListNode
  1237. instanceVariableNames: 'browser theClass level nodes'
  1238. category: 'IDE'!
  1239. !ClassesListNode methodsFor: 'accessing'!
  1240. nodes
  1241. ^nodes
  1242. !
  1243. theClass
  1244. ^theClass
  1245. !
  1246. theClass: aClass
  1247. theClass := aClass
  1248. !
  1249. browser
  1250. ^browser
  1251. !
  1252. browser: aBrowser
  1253. browser := aBrowser
  1254. !
  1255. level
  1256. ^level
  1257. !
  1258. level: anInteger
  1259. level := anInteger
  1260. !
  1261. label
  1262. | str |
  1263. str := String new writeStream.
  1264. self level timesRepeat: [
  1265. str nextPutAll: '&nbsp;&nbsp;&nbsp;&nbsp;'].
  1266. str nextPutAll: self theClass name.
  1267. ^str contents
  1268. !
  1269. getNodesFrom: aCollection
  1270. | children others |
  1271. children := #().
  1272. others := #().
  1273. aCollection do: [:each |
  1274. (each superclass = self theClass)
  1275. ifTrue: [children add: each]
  1276. ifFalse: [others add: each]].
  1277. nodes:= children collect: [:each |
  1278. ClassesListNode on: each browser: self browser classes: others level: self level + 1]
  1279. ! !
  1280. !ClassesListNode methodsFor: 'rendering'!
  1281. renderOn: html
  1282. | li |
  1283. li := html li
  1284. onClick: [self browser selectClass: self theClass].
  1285. li asJQuery contents: self label.
  1286. self browser selectedClass = self theClass ifTrue: [
  1287. li class: 'selected'].
  1288. self nodes do: [:each |
  1289. each renderOn: html]
  1290. ! !
  1291. !ClassesListNode class methodsFor: 'instance creation'!
  1292. on: aClass browser: aBrowser classes: aCollection level: anInteger
  1293. ^self new
  1294. theClass: aClass;
  1295. browser: aBrowser;
  1296. level: anInteger;
  1297. getNodesFrom: aCollection;
  1298. yourself
  1299. ! !
  1300. TabWidget subclass: #Debugger
  1301. instanceVariableNames: 'error selectedContext sourceArea ul'
  1302. category: 'IDE'!
  1303. !Debugger methodsFor: 'accessing'!
  1304. error
  1305. ^error
  1306. !
  1307. error: anError
  1308. error := anError
  1309. !
  1310. label
  1311. ^'[Debugger]'
  1312. ! !
  1313. !Debugger methodsFor: 'actions'!
  1314. selectContext: aContext
  1315. selectedContext := aContext.
  1316. self updateContextsList.
  1317. self updateSourceArea
  1318. ! !
  1319. !Debugger methodsFor: 'rendering'!
  1320. renderBoxOn: html
  1321. self
  1322. renderTopPanelOn: html;
  1323. renderBottomPanelOn: html
  1324. !
  1325. renderTopPanelOn: html
  1326. selectedContext := self error context.
  1327. html div
  1328. class: 'top';
  1329. with: [
  1330. html div
  1331. class: 'label';
  1332. with: self error messageText.
  1333. ul := html ul
  1334. class: 'jt_column debugger contexts';
  1335. with: [self renderContext: self error context on: html]]
  1336. !
  1337. renderContext: aContext on: html
  1338. | li |
  1339. li := html li.
  1340. selectedContext = aContext ifTrue: [
  1341. li class: 'selected'].
  1342. li
  1343. with: aContext asString;
  1344. onClick: [self selectContext: aContext].
  1345. aContext home ifNotNil: [self renderContext: aContext home on: html]
  1346. !
  1347. renderBottomPanelOn: html
  1348. html div
  1349. class: 'jt_sourceCode';
  1350. with: [
  1351. sourceArea := SourceArea new.
  1352. sourceArea renderOn: html].
  1353. self updateSourceArea
  1354. ! !
  1355. !Debugger methodsFor: 'testing'!
  1356. canBeClosed
  1357. ^true
  1358. ! !
  1359. !Debugger methodsFor: 'updating'!
  1360. updateContextsList
  1361. ul contents: [:html |
  1362. self renderContext: self error context on: html]
  1363. !
  1364. updateSourceArea
  1365. sourceArea val: (selectedContext receiver class methodAt: selectedContext selector) source
  1366. ! !
  1367. ErrorHandler subclass: #DebugErrorHandler
  1368. instanceVariableNames: ''
  1369. category: 'IDE'!
  1370. !DebugErrorHandler methodsFor: 'error handling'!
  1371. handleError: anError
  1372. [Debugger new
  1373. error: anError;
  1374. open] on: Error do: [:error |
  1375. ErrorHandler new handleError: error]
  1376. ! !
  1377. !DebugErrorHandler class methodsFor: 'initialization'!
  1378. initialize
  1379. self register
  1380. ! !
  1381. !Object methodsFor: '*IDE'!
  1382. inspect
  1383. Inspector new
  1384. inspect: self;
  1385. open
  1386. !
  1387. inspectOn: anInspector
  1388. | variables |
  1389. variables := Dictionary new.
  1390. variables at: '#self' put: self.
  1391. self class allInstanceVariableNames do: [:each |
  1392. variables at: each put: (self instVarAt: each)].
  1393. anInspector
  1394. setLabel: self printString;
  1395. setVariables: variables
  1396. ! !
  1397. !Date methodsFor: '*IDE'!
  1398. inspectOn: anInspector
  1399. | variables |
  1400. variables := Dictionary new.
  1401. variables at: '#self' put: self.
  1402. variables at: '#year' put: self year.
  1403. variables at: '#month' put: self month.
  1404. variables at: '#day' put: self day.
  1405. variables at: '#hours' put: self hours.
  1406. variables at: '#minutes' put: self minutes.
  1407. variables at: '#seconds' put: self seconds.
  1408. variables at: '#milliseconds' put: self milliseconds.
  1409. anInspector
  1410. setLabel: self printString;
  1411. setVariables: variables
  1412. ! !
  1413. !Collection methodsFor: '*IDE'!
  1414. inspectOn: anInspector
  1415. | variables |
  1416. variables := Dictionary new.
  1417. variables at: '#self' put: self.
  1418. self withIndexDo: [:each :i |
  1419. variables at: i put: each].
  1420. anInspector
  1421. setLabel: self printString;
  1422. setVariables: variables
  1423. ! !
  1424. !String methodsFor: '*IDE'!
  1425. inspectOn: anInspector
  1426. | label |
  1427. super inspectOn: anInspector.
  1428. self printString size > 30
  1429. ifTrue: [label := (self printString copyFrom: 1 to: 30), '...''']
  1430. ifFalse: [label := self printString].
  1431. anInspector setLabel: label
  1432. ! !
  1433. !MethodContext methodsFor: '*IDE'!
  1434. inspectOn: anInspector
  1435. | variables |
  1436. variables := Dictionary new.
  1437. variables at: '#self' put: self.
  1438. variables at: '#home' put: self home.
  1439. variables at: '#receiver' put: self receiver.
  1440. variables at: '#selector' put: self selector.
  1441. variables at: '#temps' put: self temps.
  1442. self class instanceVariableNames do: [:each |
  1443. variables at: each put: (self instVarAt: each)].
  1444. anInspector
  1445. setLabel: self printString;
  1446. setVariables: variables
  1447. ! !
  1448. !Dictionary methodsFor: '*IDE'!
  1449. inspectOn: anInspector
  1450. | variables |
  1451. variables := Dictionary new.
  1452. variables at: '#self' put: self.
  1453. variables at: '#keys' put: self keys.
  1454. self keysAndValuesDo: [:key :value |
  1455. variables at: key put: value].
  1456. anInspector
  1457. setLabel: self printString;
  1458. setVariables: variables
  1459. ! !