IDE.st 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750
  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 ifTrue: [
  420. selectedClass ifNotNil: [
  421. self compileClassComment]].
  422. (selectedProtocol notNil or: [selectedMethod notNil])
  423. ifFalse: [self compileDefinition]
  424. ifTrue: [self compileMethodDefinition]
  425. !
  426. compileClassComment
  427. selectedClass comment: sourceArea val
  428. !
  429. compileMethodDefinition
  430. selectedTab = #instance
  431. ifTrue: [self compileMethodDefinitionFor: selectedClass]
  432. ifFalse: [self compileMethodDefinitionFor: selectedClass class]
  433. !
  434. compileMethodDefinitionFor: aClass
  435. | compiler method source node |
  436. source := sourceArea val.
  437. selectedProtocol ifNil: [selectedProtocol := selectedMethod category].
  438. compiler := Compiler new.
  439. node := compiler parse: source.
  440. node isParseFailure ifTrue: [
  441. ^self alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString].
  442. compiler currentClass: aClass.
  443. method := compiler eval: (compiler compileNode: node).
  444. method category: selectedProtocol.
  445. compiler unknownVariables do: [:each |
  446. (self confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
  447. self addInstanceVariableNamed: each toClass: aClass.
  448. ^self compileMethodDefinitionFor: aClass]].
  449. aClass addCompiledMethod: method.
  450. compiler setupClass: aClass.
  451. self updateMethodsList.
  452. self selectMethod: method
  453. !
  454. compileDefinition
  455. | newClass |
  456. newClass := Compiler new loadExpression: sourceArea val.
  457. self
  458. resetClassesList;
  459. updateCategoriesList;
  460. updateClassesList
  461. !
  462. commitCategory
  463. selectedCategory ifNotNil: [
  464. (Ajax url: self class commitPathJs, '/', selectedCategory, '.js')
  465. at: 'type' put: 'PUT';
  466. at: 'data' put: (Exporter new exportCategory: selectedCategory);
  467. at: 'error' put: [self alert: 'Commit failed!!'];
  468. send.
  469. (Ajax url: self class commitPathJs, '/', selectedCategory, '.deploy.js')
  470. at: 'type' put: 'PUT';
  471. at: 'data' put: (StrippedExporter new exportCategory: selectedCategory);
  472. at: 'error' put: [self alert: 'Commit failed!!'];
  473. send.
  474. (Ajax url: self class commitPathSt, '/', selectedCategory, '.st')
  475. at: 'type' put: 'PUT';
  476. at: 'data' put: (ChunkExporter new exportCategory: selectedCategory);
  477. at: 'error' put: [self alert: 'Commit failed!!'];
  478. send]
  479. !
  480. cancelChanges
  481. ^unsavedChanges
  482. ifTrue: [self confirm: 'Cancel changes?']
  483. ifFalse: [true]
  484. !
  485. removeClass
  486. (self confirm: 'Do you really want to remove ', selectedClass name, '?')
  487. ifTrue: [
  488. Smalltalk current removeClass: selectedClass.
  489. self resetClassesList.
  490. self selectClass: nil]
  491. !
  492. removeMethod
  493. self cancelChanges ifTrue: [
  494. (self confirm: 'Do you really want to remove #', selectedMethod selector, '?')
  495. ifTrue: [
  496. selectedTab = #instance
  497. ifTrue: [selectedClass removeCompiledMethod: selectedMethod]
  498. ifFalse: [selectedClass class removeCompiledMethod: selectedMethod].
  499. self selectMethod: nil]]
  500. !
  501. setMethodProtocol: aString
  502. self cancelChanges ifTrue: [
  503. (self protocols includes: aString)
  504. ifFalse: [self addNewProtocol]
  505. ifTrue: [
  506. selectedMethod category: aString.
  507. selectedProtocol := aString.
  508. selectedMethod := selectedMethod.
  509. self
  510. updateProtocolsList;
  511. updateMethodsList;
  512. updateSourceAndButtons]]
  513. !
  514. addNewProtocol
  515. | newProtocol |
  516. newProtocol := self prompt: 'New method protocol'.
  517. newProtocol notEmpty ifTrue: [
  518. selectedMethod category: newProtocol.
  519. self setMethodProtocol: newProtocol]
  520. !
  521. selectCategory: aCategory
  522. self cancelChanges ifTrue: [
  523. selectedCategory := aCategory.
  524. selectedClass := selectedProtocol := selectedMethod := nil.
  525. self resetClassesList.
  526. self
  527. updateCategoriesList;
  528. updateClassesList;
  529. updateProtocolsList;
  530. updateMethodsList;
  531. updateSourceAndButtons]
  532. !
  533. selectClass: aClass
  534. self cancelChanges ifTrue: [
  535. selectedClass := aClass.
  536. selectedProtocol := selectedMethod := nil.
  537. self
  538. updateClassesList;
  539. updateProtocolsList;
  540. updateMethodsList;
  541. updateSourceAndButtons]
  542. !
  543. selectProtocol: aString
  544. self cancelChanges ifTrue: [
  545. selectedProtocol := aString.
  546. selectedMethod := nil.
  547. self
  548. updateProtocolsList;
  549. updateMethodsList;
  550. updateSourceAndButtons]
  551. !
  552. selectMethod: aMethod
  553. self cancelChanges ifTrue: [
  554. selectedMethod := aMethod.
  555. self
  556. updateProtocolsList;
  557. updateMethodsList;
  558. updateSourceAndButtons]
  559. !
  560. selectTab: aString
  561. self cancelChanges ifTrue: [
  562. selectedTab := aString.
  563. self selectProtocol: nil.
  564. self updateTabsList]
  565. !
  566. renameClass
  567. | newName |
  568. newName := self prompt: 'Rename class ', selectedClass name.
  569. newName notEmpty ifTrue: [
  570. selectedClass rename: newName.
  571. self
  572. updateClassesList;
  573. updateSourceAndButtons]
  574. !
  575. addInstanceVariableNamed: aString toClass: aClass
  576. ClassBuilder new
  577. addSubclassOf: aClass superclass named: aClass name instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)
  578. !
  579. searchReferencesOf: aString
  580. ReferencesBrowser search: aString
  581. !
  582. searchClassReferences
  583. ReferencesBrowser search: selectedClass name
  584. !
  585. search: aString
  586. self cancelChanges ifTrue: [| searchedClass |
  587. searchedClass := Smalltalk current at: aString.
  588. searchedClass isClass
  589. ifTrue: [self class openOn: searchedClass]
  590. ifFalse: [self searchReferencesOf: aString]]
  591. ! !
  592. !Browser methodsFor: 'initialization'!
  593. initialize
  594. super initialize.
  595. selectedTab := #instance.
  596. unsavedChanges := false
  597. ! !
  598. !Browser methodsFor: 'rendering'!
  599. renderBoxOn: html
  600. self
  601. renderTopPanelOn: html;
  602. renderTabsOn: html;
  603. renderBottomPanelOn: html
  604. !
  605. renderTopPanelOn: html
  606. html div
  607. class: 'top';
  608. with: [
  609. self renderInputOn: html.
  610. categoriesList := html ul class: 'jt_column browser categories'.
  611. commitButton := html button
  612. class: 'jt_commit';
  613. title: 'Commit classes in this category to disk';
  614. onClick: [self commitCategory];
  615. with: 'Commit category'.
  616. classesList := ClassesList on: self.
  617. classesList renderOn: html.
  618. protocolsList := html ul class: 'jt_column browser protocols'.
  619. methodsList := html ul class: 'jt_column browser methods'.
  620. self
  621. updateCategoriesList;
  622. updateClassesList;
  623. updateProtocolsList;
  624. updateMethodsList.
  625. html div class: 'jt_clear']
  626. !
  627. renderTabsOn: html
  628. tabsList := html ul class: 'jt_tabs'.
  629. self updateTabsList.
  630. !
  631. renderBottomPanelOn: html
  632. html div
  633. class: 'jt_sourceCode';
  634. with: [
  635. sourceArea := SourceArea new.
  636. sourceArea renderOn: html.
  637. sourceArea
  638. onKeyUp: [self updateStatus]]
  639. !
  640. renderButtonsOn: html
  641. saveButton := html button.
  642. saveButton
  643. with: 'Save';
  644. onClick: [self compile].
  645. methodButtons := html span.
  646. classButtons := html span.
  647. html div
  648. class: 'right';
  649. with: [
  650. html button
  651. with: 'DoIt';
  652. onClick: [sourceArea doIt].
  653. html button
  654. with: 'PrintIt';
  655. onClick: [sourceArea printIt].
  656. html button with: 'InspectIt';
  657. onClick: [sourceArea inspectit]].
  658. self updateSourceAndButtons
  659. !
  660. renderInputOn: html
  661. input := html input
  662. class: 'implementors';
  663. yourself.
  664. input onKeyPress: [:event |
  665. event keyCode = 13 ifTrue: [
  666. self search: input asJQuery val]]
  667. ! !
  668. !Browser methodsFor: 'testing'!
  669. canBeClosed
  670. ^true
  671. ! !
  672. !Browser methodsFor: 'updating'!
  673. updateCategoriesList
  674. categoriesList contents: [:html |
  675. self categories do: [:each || li label |
  676. each isEmpty
  677. ifTrue: [label := 'Unclassified']
  678. ifFalse: [label := each].
  679. li := html li.
  680. selectedCategory = each ifTrue: [
  681. li class: 'selected'].
  682. li
  683. with: label;
  684. onClick: [self selectCategory: each]]]
  685. !
  686. updateClassesList
  687. TabManager current update.
  688. classesList updateNodes.
  689. "classesList contents: [:html |
  690. self classes do: [:each || li |
  691. li := html li.
  692. selectedClass = each ifTrue: [
  693. li class: 'selected'].
  694. li
  695. with: each name;
  696. onClick: [self selectClass: each]]]"
  697. !
  698. updateProtocolsList
  699. protocolsList contents: [:html |
  700. self protocols do: [:each || li |
  701. li := html li.
  702. selectedProtocol = each ifTrue: [
  703. li class: 'selected'].
  704. li
  705. with: each;
  706. onClick: [self selectProtocol: each]]]
  707. !
  708. updateMethodsList
  709. methodsList contents: [:html |
  710. self methods do: [:each || li |
  711. li := html li.
  712. selectedMethod = each ifTrue: [
  713. li class: 'selected'].
  714. li
  715. with: each selector;
  716. onClick: [self selectMethod: each]]]
  717. !
  718. updateTabsList
  719. tabsList contents: [:html || li |
  720. li := html li.
  721. selectedTab = #instance ifTrue: [li class: 'selected'].
  722. li
  723. with: 'Instance';
  724. onClick: [self selectTab: #instance].
  725. li := html li.
  726. selectedTab = #class ifTrue: [li class: 'selected'].
  727. li
  728. with: 'Class';
  729. onClick: [self selectTab: #class].
  730. li := html li.
  731. selectedTab = #comment ifTrue: [li class: 'selected'].
  732. li
  733. with: 'Comment';
  734. onClick: [self selectTab: #comment]]
  735. !
  736. updateSourceAndButtons
  737. self disableSaveButton.
  738. classButtons contents: [:html |
  739. html button
  740. with: 'Rename class';
  741. onClick: [self renameClass].
  742. html button
  743. with: 'Remove class';
  744. onClick: [self removeClass].
  745. html button
  746. with: 'References';
  747. onClick: [self searchClassReferences]].
  748. methodButtons contents: [:html |
  749. html button
  750. with: 'Remove method';
  751. onClick: [self removeMethod].
  752. html select
  753. onChange: [:e :select | self setMethodProtocol: select val];
  754. with: [
  755. html option
  756. with: 'Method protocol';
  757. at: 'disabled' put: 'disabled'.
  758. html option
  759. class: 'important';
  760. with: 'New...'.
  761. self protocols do: [:each |
  762. html option with: each]].
  763. selectedMethod isNil ifFalse: [
  764. html select
  765. onChange: [:e :select | self searchReferencesOf: select val];
  766. with: [
  767. html option
  768. with: 'References';
  769. at: 'disabled' put: 'disabled'.
  770. html option
  771. class: 'important';
  772. with: selectedMethod selector.
  773. selectedMethod messageSends sorted do: [:each |
  774. html option with: each]]]].
  775. selectedMethod isNil
  776. ifTrue: [
  777. self hideMethodButtons.
  778. (selectedClass isNil or: [selectedProtocol notNil])
  779. ifTrue: [self hideClassButtons]
  780. ifFalse: [self showClassButtons]]
  781. ifFalse: [
  782. self hideClassButtons.
  783. self showMethodButtons].
  784. sourceArea val: self source
  785. !
  786. updateStatus
  787. sourceArea val = self source
  788. ifTrue: [
  789. saveButton ifNotNil: [
  790. saveButton at: 'disabled' put: true].
  791. unsavedChanges := false]
  792. ifFalse: [
  793. saveButton ifNotNil: [
  794. saveButton removeAt: 'disabled'].
  795. unsavedChanges := true]
  796. !
  797. resetClassesList
  798. classesList resetNodes
  799. ! !
  800. !Browser class methodsFor: 'accessing'!
  801. commitPathJs
  802. ^'js'
  803. !
  804. commitPathSt
  805. ^'st'
  806. ! !
  807. !Browser class methodsFor: 'convenience'!
  808. openOn: aClass
  809. ^self new
  810. open;
  811. selectCategory: aClass category;
  812. selectClass: aClass
  813. !
  814. open
  815. self new open
  816. ! !
  817. TabWidget subclass: #Inspector
  818. instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea workspaceTextarea diveButton'
  819. category: 'IDE'!
  820. !Inspector methodsFor: 'accessing'!
  821. label
  822. ^label ifNil: ['Inspector (nil)']
  823. !
  824. variables
  825. ^variables
  826. !
  827. setVariables: aCollection
  828. variables := aCollection
  829. !
  830. setLabel: aString
  831. label := aString
  832. !
  833. selectedVariable
  834. ^selectedVariable
  835. !
  836. selectedVariable: aString
  837. selectedVariable := aString
  838. ! !
  839. !Inspector methodsFor: 'actions'!
  840. inspect: anObject
  841. object := anObject.
  842. variables := #().
  843. object inspectOn: self
  844. !
  845. dive
  846. (self variables at: self selectedVariable) inspect
  847. !
  848. refresh
  849. self
  850. inspect: object;
  851. updateVariablesList;
  852. updateValueTextarea
  853. ! !
  854. !Inspector methodsFor: 'rendering'!
  855. renderBoxOn: html
  856. self
  857. renderTopPanelOn: html;
  858. renderBottomPanelOn: html
  859. !
  860. renderTopPanelOn: html
  861. html div
  862. class: 'top';
  863. with: [
  864. variablesList := html ul class: 'jt_column variables'.
  865. valueTextarea := html textarea class: 'jt_column value'; at: 'readonly' put: 'readonly'.
  866. self
  867. updateVariablesList;
  868. updateValueTextarea.
  869. html div class: 'jt_clear']
  870. !
  871. renderBottomPanelOn: html
  872. html div
  873. class: 'jt_sourceCode';
  874. with: [
  875. workspaceTextarea := html textarea
  876. class: 'source';
  877. at: 'spellcheck' put: 'false'.
  878. workspaceTextarea asJQuery call: 'tabby']
  879. !
  880. renderButtonsOn: html
  881. html button
  882. with: 'Refresh';
  883. onClick: [self refresh].
  884. diveButton := html button
  885. with: 'Dive';
  886. onClick: [self dive].
  887. self updateButtons
  888. ! !
  889. !Inspector methodsFor: 'testing'!
  890. canBeClosed
  891. ^true
  892. ! !
  893. !Inspector methodsFor: 'updating'!
  894. updateVariablesList
  895. variablesList contents: [:html |
  896. self variables keys do: [:each || li |
  897. li := html li.
  898. li
  899. with: each;
  900. onClick: [self selectVariable: each].
  901. self selectedVariable = each ifTrue: [
  902. li class: 'selected']]]
  903. !
  904. selectVariable: aString
  905. self selectedVariable: aString.
  906. self
  907. updateVariablesList;
  908. updateValueTextarea;
  909. updateButtons
  910. !
  911. updateValueTextarea
  912. valueTextarea asJQuery val: (self selectedVariable isNil
  913. ifTrue: ['']
  914. ifFalse: [(self variables at: self selectedVariable) printString])
  915. !
  916. updateButtons
  917. (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
  918. ifFalse: [diveButton at: 'disabled' put: true]
  919. ifTrue: [diveButton removeAt: 'disabled']
  920. ! !
  921. !Inspector class methodsFor: 'instance creation'!
  922. on: anObject
  923. ^self new
  924. inspect: anObject;
  925. yourself
  926. ! !
  927. TabWidget subclass: #ReferencesBrowser
  928. instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList'
  929. category: 'IDE'!
  930. !ReferencesBrowser methodsFor: 'accessing'!
  931. implementors
  932. ^implementors ifNil: [implementors := Array new]
  933. !
  934. label
  935. ^'[ReferencesBrowser]'
  936. !
  937. selector
  938. ^selector
  939. !
  940. senders
  941. ^senders ifNil: [senders := Array new]
  942. !
  943. classesAndMetaclasses
  944. ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
  945. !
  946. referencedClasses
  947. ^referencedClasses ifNil: [referencedClasses := Array new]
  948. ! !
  949. !ReferencesBrowser methodsFor: 'actions'!
  950. openBrowserOn: aMethod
  951. | browser |
  952. browser := Browser openOn: (aMethod class isMetaclass
  953. ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
  954. aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
  955. browser
  956. selectProtocol: aMethod category;
  957. selectMethod: aMethod
  958. !
  959. searchReferencesFor: aString
  960. selector := aString.
  961. implementors := Array new.
  962. senders := Array new.
  963. referencedClasses := Array new.
  964. (selector match: '^[A-Z]')
  965. ifFalse: [self searchSelectorReferencesFor: selector]
  966. ifTrue: [self searchReferencedClassesFor: selector]
  967. !
  968. search: aString
  969. self
  970. searchReferencesFor: aString;
  971. updateImplementorsList;
  972. updateSendersList;
  973. updateReferencedClassesList
  974. !
  975. searchReferencedClassesFor: aString
  976. self classesAndMetaclasses do: [:each |
  977. each methodDictionary values do: [:value |
  978. (((value referencedClasses select: [:each | each notNil])collect: [:each | each name]) includes: selector) ifTrue: [
  979. self referencedClasses add: value]]]
  980. !
  981. searchSelectorReferencesFor: aString
  982. self classesAndMetaclasses do: [:each |
  983. each methodDictionary keysAndValuesDo: [:key :value |
  984. key = selector ifTrue: [self implementors add: value]].
  985. each methodDictionary keysAndValuesDo: [:key :value |
  986. (value messageSends includes: selector) ifTrue: [
  987. self senders add: value]]]
  988. ! !
  989. !ReferencesBrowser methodsFor: 'initialization'!
  990. initialize
  991. super initialize.
  992. selector := ''
  993. ! !
  994. !ReferencesBrowser methodsFor: 'private'!
  995. setInputEvents
  996. input
  997. onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
  998. onKeyDown: [timer ifNotNil: [timer clearTimeout]]
  999. ! !
  1000. !ReferencesBrowser methodsFor: 'rendering'!
  1001. renderBoxOn: html
  1002. self
  1003. renderInputOn: html;
  1004. renderImplementorsOn: html;
  1005. renderSendersOn: html;
  1006. renderReferencedClassesOn: html
  1007. !
  1008. renderInputOn: html
  1009. input := html input
  1010. class: 'implementors';
  1011. yourself.
  1012. input asJQuery val: selector.
  1013. self setInputEvents
  1014. !
  1015. renderImplementorsOn: html
  1016. implementorsList := html ul class: 'jt_column implementors'.
  1017. self updateImplementorsList
  1018. !
  1019. renderSendersOn: html
  1020. sendersList := html ul class: 'jt_column senders'.
  1021. self updateSendersList
  1022. !
  1023. renderReferencedClassesOn: html
  1024. referencedClassesList := html ul class: 'jt_column referenced_classes'.
  1025. self updateReferencedClassesList
  1026. ! !
  1027. !ReferencesBrowser methodsFor: 'testing'!
  1028. canBeClosed
  1029. ^true
  1030. ! !
  1031. !ReferencesBrowser methodsFor: 'updating'!
  1032. updateImplementorsList
  1033. implementorsList contents: [:html |
  1034. html li
  1035. class: 'column_label';
  1036. with: 'Implementors (', self implementors size asString, ')';
  1037. style: 'font-weight: bold'.
  1038. self implementors do: [:each || li |
  1039. li := html li.
  1040. li
  1041. with: (each methodClass asString, ' >> ', self selector);
  1042. onClick: [self openBrowserOn: each]]]
  1043. !
  1044. updateSendersList
  1045. sendersList contents: [:html |
  1046. html li
  1047. class: 'column_label';
  1048. with: 'Senders (', self senders size asString, ')';
  1049. style: 'font-weight: bold'.
  1050. self senders do: [:each |
  1051. html li
  1052. with: (each methodClass asString, ' >> ', each selector);
  1053. onClick: [self openBrowserOn: each]]]
  1054. !
  1055. updateReferencedClassesList
  1056. referencedClassesList contents: [:html |
  1057. html li
  1058. class: 'column_label';
  1059. with: 'Class references (', self referencedClasses size asString, ')';
  1060. style: 'font-weight: bold'.
  1061. self referencedClasses do: [:each |
  1062. html li
  1063. with: (each methodClass asString, ' >> ', each selector);
  1064. onClick: [self openBrowserOn: each]]]
  1065. ! !
  1066. !ReferencesBrowser class methodsFor: 'instance creation'!
  1067. search: aString
  1068. ^self new
  1069. searchReferencesFor: aString;
  1070. open
  1071. ! !
  1072. Widget subclass: #SourceArea
  1073. instanceVariableNames: 'editor div'
  1074. category: 'IDE'!
  1075. !SourceArea methodsFor: 'accessing'!
  1076. val
  1077. ^editor getValue
  1078. !
  1079. val: aString
  1080. editor setValue: aString
  1081. !
  1082. currentLine
  1083. ^editor getLine: (editor getCursor line)
  1084. !
  1085. selection
  1086. ^editor getSelection
  1087. !
  1088. selectionEnd
  1089. ^textarea element selectionEnd
  1090. !
  1091. selectionStart
  1092. ^textarea element selectionStart
  1093. !
  1094. selectionStart: anInteger
  1095. textarea element selectionStart: anInteger
  1096. !
  1097. selectionEnd: anInteger
  1098. textarea element selectionEnd: anInteger
  1099. !
  1100. setEditorOn: aTextarea
  1101. <self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  1102. theme: 'jtalk',
  1103. lineNumbers: true,
  1104. enterMode: 'classic',
  1105. matchBrackets: true,
  1106. electricChars: false,
  1107. })>
  1108. !
  1109. editor
  1110. ^editor
  1111. ! !
  1112. !SourceArea methodsFor: 'actions'!
  1113. clear
  1114. textarea asJQuery val: ''
  1115. !
  1116. doIt
  1117. | selection |
  1118. editor somethingSelected
  1119. ifFalse: [selection := self currentLine]
  1120. ifTrue: [selection := self selection].
  1121. ^self eval: selection
  1122. !
  1123. eval: aString
  1124. | compiler node |
  1125. compiler := Compiler new.
  1126. node := compiler parseExpression: aString.
  1127. node isParseFailure ifTrue: [
  1128. ^self alert: node reason, ', position: ', node position].
  1129. ^compiler loadExpression: aString
  1130. !
  1131. handleKeyDown: anEvent
  1132. <if(anEvent.ctrlKey) {
  1133. if(anEvent.keyCode === 80) { //ctrl+p
  1134. self._printIt();
  1135. anEvent.preventDefault();
  1136. return false;
  1137. }
  1138. if(anEvent.keyCode === 68) { //ctrl+d
  1139. self._doIt();
  1140. anEvent.preventDefault();
  1141. return false;
  1142. }
  1143. if(anEvent.keyCode === 73) { //ctrl+i
  1144. self._inspectIt();
  1145. anEvent.preventDefault();
  1146. return false;
  1147. }
  1148. }>
  1149. !
  1150. inspectIt
  1151. self doIt inspect
  1152. !
  1153. print: aString
  1154. | start stop |
  1155. start := Dictionary new.
  1156. stop := Dictionary new.
  1157. start at: 'line' put: (editor getCursor: false) line.
  1158. start at: 'ch' put: (editor getCursor: false) ch.
  1159. stop at: 'line' put: (start at: 'line').
  1160. stop at: 'ch' put: ((start at: 'ch') + aString size + 2).
  1161. editor replaceSelection: (editor getSelection, ' ', aString, ' ').
  1162. editor setCursor: (editor getCursor: true).
  1163. editor setSelection: stop end: start
  1164. !
  1165. printIt
  1166. self print: self doIt printString
  1167. ! !
  1168. !SourceArea methodsFor: 'events'!
  1169. onKeyUp: aBlock
  1170. div onKeyUp: aBlock
  1171. !
  1172. onKeyDown: aBlock
  1173. div onKeyDown: aBlock
  1174. ! !
  1175. !SourceArea methodsFor: 'rendering'!
  1176. renderOn: html
  1177. | textarea |
  1178. div := html div class: 'source'.
  1179. div with: [textarea := html textarea].
  1180. self setEditorOn: textarea element.
  1181. div onKeyDown: [:e | self handleKeyDown: e]
  1182. ! !
  1183. Widget subclass: #ClassesList
  1184. instanceVariableNames: 'browser ul nodes'
  1185. category: 'IDE'!
  1186. !ClassesList methodsFor: 'accessing'!
  1187. category
  1188. ^self browser selectedCategory
  1189. !
  1190. nodes
  1191. nodes ifNil: [nodes := self getNodes].
  1192. ^nodes
  1193. !
  1194. browser
  1195. ^browser
  1196. !
  1197. browser: aBrowser
  1198. browser := aBrowser
  1199. !
  1200. getNodes
  1201. | classes children others |
  1202. classes := self browser classes.
  1203. children := #().
  1204. others := #().
  1205. classes do: [:each |
  1206. (classes includes: each superclass)
  1207. ifFalse: [children add: each]
  1208. ifTrue: [others add: each]].
  1209. ^children collect: [:each |
  1210. ClassesListNode on: each browser: self browser classes: others level: 0]
  1211. !
  1212. resetNodes
  1213. nodes := nil
  1214. ! !
  1215. !ClassesList methodsFor: 'rendering'!
  1216. renderOn: html
  1217. ul := html ul
  1218. class: 'jt_column browser classes';
  1219. yourself.
  1220. self updateNodes
  1221. !
  1222. updateNodes
  1223. ul contents: [:html |
  1224. self nodes do: [:each |
  1225. each renderOn: html]]
  1226. ! !
  1227. !ClassesList class methodsFor: 'instance creation'!
  1228. on: aBrowser
  1229. ^self new
  1230. browser: aBrowser;
  1231. yourself
  1232. ! !
  1233. Widget subclass: #ClassesListNode
  1234. instanceVariableNames: 'browser theClass level nodes'
  1235. category: 'IDE'!
  1236. !ClassesListNode methodsFor: 'accessing'!
  1237. nodes
  1238. ^nodes
  1239. !
  1240. theClass
  1241. ^theClass
  1242. !
  1243. theClass: aClass
  1244. theClass := aClass
  1245. !
  1246. browser
  1247. ^browser
  1248. !
  1249. browser: aBrowser
  1250. browser := aBrowser
  1251. !
  1252. level
  1253. ^level
  1254. !
  1255. level: anInteger
  1256. level := anInteger
  1257. !
  1258. label
  1259. | str |
  1260. str := String new writeStream.
  1261. self level timesRepeat: [
  1262. str nextPutAll: '&nbsp;&nbsp;&nbsp;&nbsp;'].
  1263. str nextPutAll: self theClass name.
  1264. ^str contents
  1265. !
  1266. getNodesFrom: aCollection
  1267. | children others |
  1268. children := #().
  1269. others := #().
  1270. aCollection do: [:each |
  1271. (each superclass = self theClass)
  1272. ifTrue: [children add: each]
  1273. ifFalse: [others add: each]].
  1274. nodes:= children collect: [:each |
  1275. ClassesListNode on: each browser: self browser classes: others level: self level + 1]
  1276. ! !
  1277. !ClassesListNode methodsFor: 'rendering'!
  1278. renderOn: html
  1279. | li |
  1280. li := html li
  1281. onClick: [self browser selectClass: self theClass].
  1282. li asJQuery contents: self label.
  1283. self browser selectedClass = self theClass ifTrue: [
  1284. li class: 'selected'].
  1285. self nodes do: [:each |
  1286. each renderOn: html]
  1287. ! !
  1288. !ClassesListNode class methodsFor: 'instance creation'!
  1289. on: aClass browser: aBrowser classes: aCollection level: anInteger
  1290. ^self new
  1291. theClass: aClass;
  1292. browser: aBrowser;
  1293. level: anInteger;
  1294. getNodesFrom: aCollection;
  1295. yourself
  1296. ! !
  1297. TabWidget subclass: #Debugger
  1298. instanceVariableNames: 'error selectedContext sourceArea ul'
  1299. category: 'IDE'!
  1300. !Debugger methodsFor: 'accessing'!
  1301. error
  1302. ^error
  1303. !
  1304. error: anError
  1305. error := anError
  1306. !
  1307. label
  1308. ^'[Debugger]'
  1309. ! !
  1310. !Debugger methodsFor: 'actions'!
  1311. selectContext: aContext
  1312. selectedContext := aContext.
  1313. self updateContextsList.
  1314. self updateSourceArea
  1315. ! !
  1316. !Debugger methodsFor: 'rendering'!
  1317. renderBoxOn: html
  1318. self
  1319. renderTopPanelOn: html;
  1320. renderBottomPanelOn: html
  1321. !
  1322. renderTopPanelOn: html
  1323. selectedContext := self error context.
  1324. html div
  1325. class: 'top';
  1326. with: [
  1327. html div
  1328. class: 'label';
  1329. with: self error messageText.
  1330. ul := html ul
  1331. class: 'jt_column debugger contexts';
  1332. with: [self renderContext: self error context on: html]]
  1333. !
  1334. renderContext: aContext on: html
  1335. | li |
  1336. li := html li.
  1337. selectedContext = aContext ifTrue: [
  1338. li class: 'selected'].
  1339. li
  1340. with: aContext asString;
  1341. onClick: [self selectContext: aContext].
  1342. aContext home ifNotNil: [self renderContext: aContext home on: html]
  1343. !
  1344. renderBottomPanelOn: html
  1345. html div
  1346. class: 'jt_sourceCode';
  1347. with: [
  1348. sourceArea := SourceArea new.
  1349. sourceArea renderOn: html].
  1350. self updateSourceArea
  1351. ! !
  1352. !Debugger methodsFor: 'testing'!
  1353. canBeClosed
  1354. ^true
  1355. ! !
  1356. !Debugger methodsFor: 'updating'!
  1357. updateContextsList
  1358. ul contents: [:html |
  1359. self renderContext: self error context on: html]
  1360. !
  1361. updateSourceArea
  1362. sourceArea val: (selectedContext receiver class methodAt: selectedContext selector) source
  1363. ! !
  1364. ErrorHandler subclass: #DebugErrorHandler
  1365. instanceVariableNames: ''
  1366. category: 'IDE'!
  1367. !DebugErrorHandler methodsFor: 'error handling'!
  1368. handleError: anError
  1369. [Debugger new
  1370. error: anError;
  1371. open] on: Error do: [:error |
  1372. ErrorHandler new handleError: error]
  1373. ! !
  1374. !DebugErrorHandler class methodsFor: 'initialization'!
  1375. initialize
  1376. self register
  1377. ! !
  1378. !Object methodsFor: '*IDE'!
  1379. inspect
  1380. Inspector new
  1381. inspect: self;
  1382. open
  1383. !
  1384. inspectOn: anInspector
  1385. | variables |
  1386. variables := Dictionary new.
  1387. variables at: '#self' put: self.
  1388. self class allInstanceVariableNames do: [:each |
  1389. variables at: each put: (self instVarAt: each)].
  1390. anInspector
  1391. setLabel: self printString;
  1392. setVariables: variables
  1393. ! !
  1394. !Date methodsFor: '*IDE'!
  1395. inspectOn: anInspector
  1396. | variables |
  1397. variables := Dictionary new.
  1398. variables at: '#self' put: self.
  1399. variables at: '#year' put: self year.
  1400. variables at: '#month' put: self month.
  1401. variables at: '#day' put: self day.
  1402. variables at: '#hours' put: self hours.
  1403. variables at: '#minutes' put: self minutes.
  1404. variables at: '#seconds' put: self seconds.
  1405. variables at: '#milliseconds' put: self milliseconds.
  1406. anInspector
  1407. setLabel: self printString;
  1408. setVariables: variables
  1409. ! !
  1410. !Collection methodsFor: '*IDE'!
  1411. inspectOn: anInspector
  1412. | variables |
  1413. variables := Dictionary new.
  1414. variables at: '#self' put: self.
  1415. self withIndexDo: [:each :i |
  1416. variables at: i put: each].
  1417. anInspector
  1418. setLabel: self printString;
  1419. setVariables: variables
  1420. ! !
  1421. !String methodsFor: '*IDE'!
  1422. inspectOn: anInspector
  1423. | label |
  1424. super inspectOn: anInspector.
  1425. self printString size > 30
  1426. ifTrue: [label := (self printString copyFrom: 1 to: 30), '...''']
  1427. ifFalse: [label := self printString].
  1428. anInspector setLabel: label
  1429. ! !
  1430. !MethodContext methodsFor: '*IDE'!
  1431. inspectOn: anInspector
  1432. | variables |
  1433. variables := Dictionary new.
  1434. variables at: '#self' put: self.
  1435. variables at: '#home' put: self home.
  1436. variables at: '#receiver' put: self receiver.
  1437. variables at: '#selector' put: self selector.
  1438. variables at: '#temps' put: self temps.
  1439. self class instanceVariableNames do: [:each |
  1440. variables at: each put: (self instVarAt: each)].
  1441. anInspector
  1442. setLabel: self printString;
  1443. setVariables: variables
  1444. ! !
  1445. !Dictionary methodsFor: '*IDE'!
  1446. inspectOn: anInspector
  1447. | variables |
  1448. variables := Dictionary new.
  1449. variables at: '#self' put: self.
  1450. variables at: '#keys' put: self keys.
  1451. self keysAndValuesDo: [:key :value |
  1452. variables at: key put: value].
  1453. anInspector
  1454. setLabel: self printString;
  1455. setVariables: variables
  1456. ! !