'From Squeak3.2alpha of 8 October 2001 [latest update: #4418] on 16 October 2001 at 4:21:29 pm'! "Published in 3.3a as 4669ExplorerRefactorings-hg.cs"! !ObjectExplorer methodsFor: 'as yet unclassified' stamp: 'hg 9/7/2001 12:35'! explorerFor: anObject | window listMorph | rootObject _ anObject. window _ (SystemWindow labelled: self label) model: self. window addMorph: (listMorph _ SimpleHierarchicalListMorph on: self list: #getList selected: #getCurrentSelection changeSelected: #noteNewSelection: menu: #genericMenu: keystroke: nil) frame: (0@0 corner: 1@0.8). window addMorph: ((PluggableTextMorph on: self text: #trash accept: #trash: readSelection: #contentsSelection menu: #codePaneMenu:shifted:) askBeforeDiscardingEdits: false) frame: (0@0.8 corner: 1@1). listMorph autoDeselect: false. ^ window! ! !ObjectExplorer methodsFor: 'as yet unclassified' stamp: 'hg 9/7/2001 12:12'! label ^ rootObject printStringLimitedTo: 32! ! !ObjectExplorerWrapper methodsFor: 'as yet unclassified' stamp: 'hg 9/7/2001 12:15'! contents (item respondsTo: #explorerContents) ifTrue: [^item explorerContents]. "For all others, show named vars first, then indexed vars" ^(item class allInstVarNames asOrderedCollection withIndexCollect: [:each :index | self class with: (item instVarAt: index) name: each model: item]) , ((1 to: item basicSize) collect: [:index | self class with: (item basicAt: index) name: index printString model: item])! ! !ObjectExplorerWrapper methodsFor: 'converting' stamp: 'hg 9/7/2001 19:58'! asString | explorerString string | explorerString _ [item asExplorerString] on: Error do: ['']. string _ (itemName ifNotNil: [itemName , ': '] ifNil: ['']) , explorerString. (string includes: Character cr) ifTrue: [^ string withSeparatorsCompacted]. ^ string! ! !SequenceableCollection methodsFor: 'explorer' stamp: 'hg 9/7/2001 12:01'! explorerContents ^self asOrderedCollection withIndexCollect: [:value :index | ObjectExplorerWrapper with: value name: index printString model: self]! ! !Set methodsFor: 'explorer' stamp: 'hg 9/7/2001 11:51'! explorerContents ^self asOrderedCollection withIndexCollect: [:each :index | ObjectExplorerWrapper with: each name: index printString model: self]! ! !Set methodsFor: 'explorer' stamp: 'hg 9/7/2001 11:51'! hasContentsInExplorer ^self isEmpty not! ! !Dictionary methodsFor: 'user interface' stamp: 'hg 10/3/2001 20:47'! explorerContents | contents | contents _ OrderedCollection new. self keysSortedSafely do: [:key | contents add: (ObjectExplorerWrapper with: (self at: key) name: (key printString contractTo: 32) model: self)]. ^contents ! ! !SimpleHierarchicalListMorph methodsFor: 'events'! expandAll (selectedMorph isNil or: [selectedMorph isExpanded]) ifTrue: [^self]. self expandAll: selectedMorph. self adjustSubmorphPositions! ! !SimpleHierarchicalListMorph methodsFor: 'events'! expandAll: aMorph | allChildren | aMorph toggleExpandedState. allChildren _ OrderedCollection new: 10. aMorph recursiveAddTo: allChildren. allChildren do: [:each | (each canExpand and: [each isExpanded not]) ifTrue: [self expandAll: each]]. ! !