[Pkg] The Trunk: Tools-fbs.453.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Mar 8 09:39:17 UTC 2013


Frank Shearar uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-fbs.453.mcz

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

Name: Tools-fbs.453
Author: fbs
Time: 8 March 2013, 8:50:08.04 am
UUID: ad8bee49-70a9-443a-80ac-8020d148dc2b
Ancestors: Tools-fbs.452

Using #isKindOf: here (a) ties our hands to a particular representation when we should only care about the protocol an object speaks/requires and (b) forces a hard dependency on Morphic.

#respondsTo: serves the same intent, without the nastiness.

=============== Diff against Tools-fbs.452 ===============

Item was changed:
  ----- Method: Inspector>>inspectElement (in category 'menu commands') -----
  inspectElement
  	| sel selSize countString count nameStrs |
  	"Create and schedule an Inspector on an element of the receiver's model's currently selected collection."
  
  	self selectionIndex = 0 ifTrue: [^ self changed: #flash].
  	((sel := self selection) isKindOf: SequenceableCollection) ifFalse:
+ 		[(sel respondsTo: #inspectElement) ifTrue: [^ sel inspectElement].
- 		[(sel isKindOf: MorphExtension) ifTrue: [^ sel inspectElement].
  		^ sel inspect].
  	(selSize := sel size) = 1 ifTrue: [^ sel first inspect].
  	selSize <= 20 ifTrue:
  		[nameStrs := (1 to: selSize) asArray collect: [:ii | 
  			ii printString, '   ', (((sel at: ii) printStringLimitedTo: 25) replaceAll: Character cr with: Character space)].
  		count := UIManager default chooseFrom: (nameStrs substrings) title: 'which element?'.
  		count = 0 ifTrue: [^ self].
  		^ (sel at: count) inspect].
  
  	countString := UIManager default request: 'Which element? (1 to ', selSize printString, ')' initialAnswer: '1'.
  	countString isEmptyOrNil ifTrue: [^ self].
  	count := Integer readFrom: (ReadStream on: countString).
  	(count > 0 and: [count <= selSize])
  		ifTrue: [(sel at: count) inspect]
  		ifFalse: [Beeper beep]!



More information about the Packages mailing list