[squeak-dev] The Inbox: Tools-LM.829.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Aug 16 00:01:11 UTC 2018


A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-LM.829.mcz

==================== Summary ====================

Name: Tools-LM.829
Author: LM
Time: 16 August 2018, 2:01:04.706807 am
UUID: 46879fde-2c09-ca4a-9b63-b14a1e21e4c0
Ancestors: Tools-LM.828

In response to the feedback I received to Tools-LM.828 ( http://forum.world.st/The-Inbox-Tools-LM-828-mcz-td5082873.html ).

I now made the ObjectExplorer only exclude those ObjectExplorerWrappers from the "chase pointers" search that are a submorph of the ActiveWorld.
This is helpful if, for example, one reference to the object in question is held by an ObjectExplorer in another project that you forgot about.

The findDeepSubmorphsIn:that: method should probably be moved into the Morph class, because it is a classic case of feature envy and Morph already contains a findDeepSubmorphThat:ifAbsent: method, which is similar. I just didn't want to mess with one of the core Morphic classes.

I know that the way I find which ObjectExplorerWrappers are visible is not ideal, because it violates the principle of MVC that the model should not know about the implementation specifics of the view. So any feedback and suggestions in that regard would be appreciated.

=============== Diff against Tools-LM.828 ===============

Item was changed:
  ----- Method: ObjectExplorer>>chasePointersForSelection (in category 'menus - actions') -----
  chasePointersForSelection
  	
+ 	PointerFinder on: self object except: self possibleReferencesToSelection!
- 	PointerFinder on: self object except: {self}, ObjectExplorerWrapper allInstances!

Item was added:
+ ----- Method: ObjectExplorer>>findDeepSubmorphsIn:that: (in category 'accessing - view') -----
+ findDeepSubmorphsIn: aMorph that: aBlock
+ 
+ 	| selectedSubmorphs |
+ 	selectedSubmorphs := aMorph submorphs select: aBlock.
+ 	^ selectedSubmorphs, (aMorph submorphs collect: [:each |
+ 		self findDeepSubmorphsIn: each that: aBlock]) flatten!

Item was added:
+ ----- Method: ObjectExplorer>>possibleReferencesToSelection (in category 'accessing - view') -----
+ possibleReferencesToSelection
+ 
+ 	^ {self}, self visibleObjectExplorerWrappers!

Item was added:
+ ----- Method: ObjectExplorer>>views (in category 'accessing - view') -----
+ views
+ 
+ 	^ self findDeepSubmorphsIn: ActiveWorld that: [:morph | 
+ 		morph modelOrNil = self]!

Item was added:
+ ----- Method: ObjectExplorer>>visibleListItems (in category 'accessing - view') -----
+ visibleListItems
+ 
+ 	| lists |
+ 	lists := self views select: [:morph |
+ 		(morph isKindOf: PluggableTreeMorph)].
+ 	^ (lists collect: [:each|
+ 		each items]) flatten!

Item was added:
+ ----- Method: ObjectExplorer>>visibleObjectExplorerWrappers (in category 'accessing - view') -----
+ visibleObjectExplorerWrappers
+ 
+ 	| listItems |
+ 	listItems := self visibleListItems.
+ 	^ listItems collect: [:each | each complexContents]!

Item was changed:
  ----- Method: PointerFinder>>buildList (in category 'application') -----
  buildList
  	| list obj parent object key |
  	list := OrderedCollection new.
  	obj := goal.
- 	
  	[list addFirst: obj.
+ 	obj := parents at: obj ifAbsent: [].
- 	obj := parents at: obj ifAbsent: [nil].
  	obj == nil] whileFalse.
  	list removeFirst.
  	parent := Smalltalk.
  	objectList := OrderedCollection new.
  	pointerList := OrderedCollection new.
  	[list isEmpty]
  		whileFalse: 
  			[object := list removeFirst.
  			key := nil.
  			(parent isKindOf: Dictionary)
  				ifTrue: [list size >= 2
  						ifTrue: 
  							[key := parent keyAtValue: list second ifAbsent: [].
  							key == nil
  								ifFalse: 
  									[object := list removeFirst; removeFirst.
  									pointerList add: key printString , ' -> ' , object class name]]].
  			key == nil
  				ifTrue: 
  					[parent class == object ifTrue: [key := 'CLASS'].
  					key == nil ifTrue: [1 to: parent class instSize do: [:i | key == nil ifTrue: [(parent instVarAt: i)
  									== object ifTrue: [key := parent class instVarNameForIndex: i]]]].
  					key == nil ifTrue: [parent isCompiledCode ifTrue: [key := 'literals?']].
  					key == nil ifTrue: [1 to: parent basicSize do: [:i | key == nil ifTrue: [(parent basicAt: i)
  									== object ifTrue: [key := i printString]]]].
  					key == nil ifTrue: [(parent isMorph and: [object isKindOf: Array]) ifTrue: [key := 'submorphs?']].
  					key == nil ifTrue: [key := '???'].
  					pointerList add: key , ': ' , object class name, (object isMorph ifTrue: [' (', object identityHash asString, ')'] ifFalse: [ String empty ]) ].
  			objectList add: object.
  			parent := object]!



More information about the Squeak-dev mailing list