[Pkg] The Trunk: Tools-cmm.463.mcz

commits at source.squeak.org commits at source.squeak.org
Mon May 13 21:21:52 UTC 2013


Chris Muller uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-cmm.463.mcz

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

Name: Tools-cmm.463
Author: cmm
Time: 13 May 2013, 4:20:44.3 pm
UUID: 5b1b1665-0bbc-4050-b97f-1dafacfa7c40
Ancestors: Tools-bf.462

MessageTrace improvement:  The user wants to be able to quickly and easily assemble message-traces.  After adding senders or implementors of a heavily overloaded selector to a MessageTrace, typically just a few of the messages are relevant out of many.  In that situation, the user need merely select the range of relevant methods to arrive within two key gestures of trimming the irrelevant methods:  1) Command+I (capital eye) to invert the selection within the local group followed by 2) Command+d to remove that selection from the browser.

=============== Diff against Tools-bf.462 ===============

Item was changed:
  ----- Method: MessageTrace>>addChildMessages:autoSelectString: (in category 'building') -----
  addChildMessages: methodReferences autoSelectString: aString 
  	| currentIndentionLevel addables selectables selectableString |
  	selectableString := aString keywords 
  		ifEmpty: [ String empty ] 
  		ifNotEmptyDo: [ : keywords | keywords first ].
  	[ (messageListIndex between: 1 and: autoSelectStrings size) ]
  		whileFalse:
  			[ autoSelectStrings add: selectableString ].
  	autoSelectStrings 
  		at: messageListIndex
  		put: selectableString.
+ 	currentIndentionLevel := self currentIndentionLevel.
- 	currentIndentionLevel := self indentionsIn: self selection asStringOrText.
  	"Don't add mulitple copies of the same method, if a method is already in the list we will merely select it."
  	addables := methodReferences reject: [ : each | messageList includes: each ].
  	addables do: 
  		[ : each | 
  		each stringVersion: (self indentionPrefixOfSize: currentIndentionLevel + 1) , each asStringOrText.
  		messageList 
  			add: each
  			afterIndex: self messageListIndex.
  		autoSelectStrings 
  			add: nil
  			afterIndex: self messageListIndex.
  		messageSelections 
  			add: false
  			afterIndex: self messageListIndex ].
  	selectables := 
  		addables copy
  			addAll: (methodReferences select: [ : each | messageList includes: each ]) ;
  			yourself.
  	self deselectAll.
  	selectables do:
  		[ : each |
  		self
  			messageAt: (messageList indexOf: each) 
  			beSelected: true ].
  	self changed: #messageList.
  	"Select the first child method."
  	self messageListIndex: 
  		(selectables size > 0
  			ifTrue: [ messageList indexOf: selectables last ]
  			ifFalse: [ messageList ifEmpty: [ 0 ] ifNotEmpty: [ 1 ] ])!

Item was added:
+ ----- Method: MessageTrace>>addExtraShiftedItemsTo: (in category 'message list') -----
+ addExtraShiftedItemsTo: aMenu 
+ 	"The shifted selector-list menu is being built.  Add items specific to MessageTrace."
+ 	super addExtraShiftedItemsTo: aMenu.
+ 	aMenu addList: #(#('invert level selection (I)' #invertLevelSelection) )!

Item was changed:
  ----- Method: MessageTrace>>addParentMessages:autoSelectString: (in category 'building') -----
  addParentMessages: methodReferences autoSelectString: aString 
  	| currentIndentionLevel addables selectables |
  	addables := methodReferences reject: [ : each | messageList includes: each ].
  	selectables := addables copy
  		addAll: (methodReferences select: [ : each | messageList includes: each ]) ;
  		yourself.
+ 	currentIndentionLevel := self currentIndentionLevel.
- 	currentIndentionLevel := self indentionsIn: self selection stringVersion.
  	(currentIndentionLevel = 0 and: [ addables notEmpty ]) ifTrue: 
  		[ self indentEverything.
  		currentIndentionLevel := 1 ].
  	addables do: 
  		[ : each | 
  		each stringVersion: (self indentionPrefixOfSize: currentIndentionLevel - 1) , each asStringOrText.
  		messageList 
  			add: each
  			afterIndex: self messageListIndex - 1.
  		autoSelectStrings 
  			add: aString
  			afterIndex: self messageListIndex - 1.
  		messageSelections 
  			add: false
  			afterIndex: self messageListIndex - 1 ].
  	self deselectAll.
  	selectables do:
  		[ : each | | messageIndex |
  		messageIndex := messageList indexOf: each.
  		self
  			messageAt: messageIndex 
  			beSelected: true.
  		autoSelectStrings
  			at: messageIndex
  			put: aString ].
  	self changed: #messageList.
  	selectables size > 0 ifTrue:
  		[ self messageListIndex: (messageList indexOf: selectables first) ]!

Item was changed:
  ----- Method: MessageTrace>>addParentMethodsSending: (in category 'building') -----
  addParentMethodsSending: selectorSymbol
  
  	| methodsList |
+ 	(methodsList := self systemNavigation allCallsOn: selectorSymbol) isEmpty
- 	(methodsList := self filteredSelectorsSending: selectorSymbol) isEmpty
  		ifTrue:
  			[ ^(PopUpMenu labels: ' OK ')
  				startUpWithCaption: 'There are no methods that send ', selectorSymbol ]
  		ifFalse:
  			[ self
  				addParentMessages: methodsList
  				autoSelectString: selectorSymbol ]
  !

Item was added:
+ ----- Method: MessageTrace>>currentIndentionLevel (in category 'private accessing') -----
+ currentIndentionLevel
+ 	^ messageListIndex isZero ifFalse: [ self indentionLevelAt: messageListIndex ]!

Item was removed:
- ----- Method: MessageTrace>>filteredSelectorsSending: (in category 'filtering') -----
- filteredSelectorsSending: selectorSymbol
- 	^ self systemNavigation allCallsOn: selectorSymbol!

Item was added:
+ ----- Method: MessageTrace>>indentionLevelAt: (in category 'private accessing') -----
+ indentionLevelAt: msgListIndex
+ 	^ self indentionsIn: (messageList at: msgListIndex) stringVersion!

Item was added:
+ ----- Method: MessageTrace>>invertLevelSelection (in category 'actions') -----
+ invertLevelSelection
+ 	"The user wants to be able to quickly and easily assemble message-traces.  When browsing senders or implementors of a heavily overloaded selector, typically just one or two messages are relevant out of several.  In that situation, the user need merely select the range of relevant methods to arrive within two gestures of trimming the irrelevant methods:  Command+I (capital eye) to invert the selection within the local group followed by Command+d to remove that selection from the browser."
+ 	| index currentLevel start |
+ 	currentLevel := self currentIndentionLevel ifNil:
+ 		[ | possibilities |
+ 		possibilities := ((1 to: messageSelections size) select:
+ 			[ : idx | messageSelections at: idx ]) collect:
+ 			[ : eachSelectedIndex | self indentionLevelAt: eachSelectedIndex ].
+ 		possibilities asSet size > 1
+ 			ifTrue: [ ^ self ]
+ 			ifFalse:
+ 				[ start := messageSelections indexOf: true.
+ 				possibilities anyOne ] ].
+ 	"First invert at messageListIndex then crawl up and down from there until a different level is reached, inverting as we go."
+ 	messageListIndex > 0 ifTrue: [ start := messageListIndex ].
+ 	self toggleMessageSelectionAt: start.
+ 	index := start.
+ 	[ index := index - 1.
+ 	index > 0 and: [ (self indentionLevelAt: index) = currentLevel ] ] whileTrue: [ self toggleMessageSelectionAt: index ].
+ 	index := start.
+ 	[ index := index + 1.
+ 	index <= messageList size and: [ (self indentionLevelAt: index) = currentLevel ] ] whileTrue: [ self toggleMessageSelectionAt: index ].
+ 	self
+ 		 messageListIndex: 0 ;
+ 		 changed: #messageList!

Item was added:
+ ----- Method: MessageTrace>>messageListKey:from: (in category 'message list') -----
+ messageListKey: aChar from: view 
+ 	aChar == $I ifTrue: [ ^ self invertLevelSelection ].
+ 	^ super messageListKey: aChar from: view!

Item was changed:
  ----- Method: MessageTrace>>removeMessageFromBrowser (in category 'building') -----
  removeMessageFromBrowser
  	| indexToSelect |
- 	self hasMessageSelected ifFalse: [^ self].
  	"Try to keep the same selection index."
  	indexToSelect := (messageSelections indexOf: true) max: 1.
  	self selectedMessages do: [ :eachMethodReference | self deleteFromMessageList: eachMethodReference ].
  	self deselectAll.
  	messageSelections ifNotEmpty:
  		[ messageSelections 
  			at: (indexToSelect min: messageSelections size)  "safety"
  			put: true ].
  	anchorIndex := indexToSelect min: messageSelections size.
  	self 
  		messageListIndex: anchorIndex ; 
  		reformulateList!



More information about the Packages mailing list