'From Cuis 2.0 of 4 January 2010 [latest update: #393] on 9 February 2010 at 11:22:24 am'!

!ProcessBrowser methodsFor: 'process list' stamp: 'jmv 2/9/2010 11:22'!
nextContext
	| initialProcessIndex initialStackIndex |

	searchString isEmpty ifTrue: [ ^false ].
	initialProcessIndex _ self processListIndex.
	initialStackIndex _ self stackListIndex.
	initialProcessIndex
		to: self processList size
		do: [ :pi | 
			self processListIndex: pi.
			self stackNameList withIndexDo: [ :name :si |
				(pi ~= initialProcessIndex or: [si > initialStackIndex])
					ifTrue: [
						(name includesSubString: searchString)
							ifTrue: [
								self stackListIndex: si.
								^true ]]]].
	self processListIndex: initialProcessIndex.
	self stackListIndex: initialStackIndex.
	^false! !

!ProcessBrowser methodsFor: 'updating' stamp: 'jmv 2/9/2010 11:04'!
setUpdateCallbackAfter: seconds

	deferredMessageRecipient ifNotNil: [
		[
			(Delay forSeconds: seconds) wait.
			deferredMessageRecipient addDeferredUIMessage: [self updateProcessList]
		] fork
	]! !


!TimeProfileBrowser methodsFor: 'private' stamp: 'jmv 2/9/2010 11:21'!
setClassAndSelectorIn: csBlock
	"Decode strings of the form    <selectorName> (<className> [class])  "

	self flag: #mref.	"fix for faster references to methods"

	^[
		| string strm class sel parens |
		string _ self selection asString.
		string first == $* ifTrue: [ ^contents := nil ].		"Ignore lines starting with *"
		parens := string includes: $(.					"Does it have open-paren?"
		strm := ReadStream on: string.
		parens
			ifTrue: [
				strm skipTo: $(.		"easy case"
				class := strm upTo: $).
				strm next: 2.
				sel := strm upToEnd ]
			ifFalse: [
				strm position: (string findString: ' class>>').
				strm position > 0
					ifFalse: [strm position: (string findLast: [ :ch | ch == $ ])]
					ifTrue: [
						| subString |  "find the next to last space character"
						subString := strm contents copyFrom: 1 to: (string findLast: [ :ch | ch == $ ]) - 1.
						strm position: (subString findLast: [ :ch | ch == $ ])].
				class := strm upTo: $>.
				strm next.
				sel := strm upToEnd ].
		MessageSet parse: (class, ' ', sel) toClassAndSelector: csBlock
	]
		on: Error 
		do: [ :ex | contents _ nil ]! !

