IDE.st 35 KB

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