'From Cuis 2.6 of 10 August 2010 [latest update: #540] on 19 August 2010 at 7:19:58 pm'!

!ChangeList methodsFor: 'menu actions' stamp: 'jmv 8/19/2010 19:09'!
selectRemovalsOfSent
	"Selects all method removal for sent methods"

	Cursor read showWhile: [
		1 to: changeList size do: [ :i | | change |
			change _ changeList at: i.
			listSelections at: i put:
				(change type = #doIt and: [
					change string includesSubString: 'removeSelector: #' ] and: [
						Smalltalk isThereAReferenceTo: (change string copyAfterLast: $#) asSymbol ]) ]].
	self changed: #allSelections! !


!ClassDescription methodsFor: '*system-support' stamp: 'jmv 8/19/2010 19:11'!
allUnreferencedClassVariables
	"Answer a list of the names of all the receiver's unreferenced class vars, including those defined in superclasses"
	| aList |
	aList _ OrderedCollection new.
	self withAllSuperclasses reverseDo: [ :aClass |
		aClass classVarNames do: [ :var |
			(Smalltalk isThereAReferenceTo: (aClass classPool associationAt: var)) ifFalse: [ aList add: var ]]].
	^ aList.! !


!MessageSet methodsFor: 'filtering' stamp: 'jmv 8/19/2010 19:12'!
filterToUnsentMessages
	"Filter the receiver's list down to only those items which have no  
	senders"
	self filterFrom: [ :aClass :aSelector |
		(Smalltalk isThereAReferenceTo: aSelector) not ].! !


!MessageNames methodsFor: 'search' stamp: 'jmv 8/19/2010 19:08'!
computeSelectorListFromSearchString
	"Compute selector list from search string"
	searchString _ searchString asString copyWithout: $ .
	"?dubious?"
	selectorList _ Cursor wait showWhile: [ | sorted |
		sorted _ SortedCollection sortBlock: [ :x :y |
			x asLowercase <= y asLowercase ].
		(searchString findBetweenSubStrs: ';') do: [ :selPat | | raw n m |
			selPat size > 0 ifTrue: [
				(selPat first = $" and: [
					selPat last = $" and: [ selPat size > 2 ]])
					ifTrue: [
						Symbol
							hasInterned:
								(selPat
									copyFrom: 2
									to: selPat size - 1)
							ifTrue: [ :sym |
								sorted add: sym ]]
					ifFalse: [
						raw _ ((n _ selPat occurrencesOf: $*) > 0 | ((m _ selPat occurrencesOf: $#) > 0) and: [ selPat size > (n + m) ])
							ifTrue: [ Symbol selectorsMatching: selPat ]
							ifFalse: [ Symbol selectorsContaining: selPat ].
						sorted addAll: raw ]]].
		sorted asArray ].
	selectorList _ selectorList select: [ :sym |
		(Smalltalk isThereAnImplementorOf: sym) or: [ Smalltalk isThereAReferenceTo: sym ]].
	^ selectorList.! !

!MessageNames methodsFor: 'selector list' stamp: 'jmv 8/19/2010 18:48'!
selectedMessageName
	"Answer the name of the currently selected message."
	^self selectorList at: selectorListIndex ifAbsent: nil! !

!MessageNames methodsFor: 'initialization' stamp: 'jmv 8/19/2010 19:19'!
selectorListKey: aChar from: view
	"Respond to a Command key in the message-list pane."
	aChar == $n ifTrue: [ ^ self browseSenders ].
	aChar == $c ifTrue: [ ^ self copyName ].
	aChar == $b ifTrue: [ ^ self browseMethodFull ].
	aChar == $m ifTrue: [ ^ self browseImplementors ].! !


!Preferences class methodsFor: 'misc' stamp: 'jmv 8/19/2010 19:13'!
cleanUp
	| dict |
	dict _ DictionaryOfPreferences.
	(dict keys select: [ :each |
		(((dict at: each) instVarNamed: 'changeInformee') isKindOf: Behavior) and: [
			((dict at: each) instVarNamed: 'changeInformee') isObsolete ]]) do: [ :eachKey |
				dict removeKey: eachKey ].
	(dict keys select: [ :each |
		(Smalltalk isThereAReferenceTo: each) not ]) do: [ :eachKey |
		dict removeKey: eachKey ].! !


!SystemDictionary methodsFor: 'retrieving' stamp: 'jmv 8/19/2010 19:06'!
isThereAReferenceTo: aLiteral
	"Answer a Collection of all the methods that call on aLiteral."
	"
	Smalltalk isThereAReferenceTo: #open:label:.
	"
	| special byte |

	#(23 48 'fred' (new open:label:)) size.
"Example above should find #open:label:, though it is deeply embedded here."

	special _ self hasSpecialSelector: aLiteral ifTrueSetByte: [:b | byte _ b ].
	Cursor wait showWhile: [
		self allBehaviorsDo: [:class |
			(class whichSelectorsReferTo: aLiteral special: special byte: byte) do: [ :sel |
				sel == #DoIt ifFalse: [
					^true
				]
			]
		]
	].
	^ false! !

Behavior removeSelector: #allCallsOn:!
