[GOODIE] ProcessBrowser
Bob Arning
arning at charm.net
Fri Oct 27 16:06:41 UTC 2000
On Fri, 27 Oct 2000 08:42:03 -0800 ned konz <ned at bike-nomad.com> wrote:
>Change Set: ProcessBrowser
>Date: 27 October 2000
>Author: Ned Konz
Ned,
Here's my contribution.
Cheers,
Bob
=====code follows=====
'From Squeak2.9alpha of 17 July 2000 [latest update: #2911] on 27 October 2000 at 12:01:42 pm'!
"Change Set: processMods
Date: 27 October 2000
Author: Bob Arning
alters process display in Ned's ProcessBrowser to
- show process priority
- drop 'a Process in' that appears on each line
- show in priority order"!
!Process methodsFor: 'printing' stamp: 'RAA 10/27/2000 11:54'!
browserPrintString
^'(',priority printString,') ',suspendedContext printString! !
!ProcessBrowser methodsFor: 'process list' stamp: 'RAA 10/27/2000 11:54'!
processNameList
"since processList is a WeakArray, we have to strengthen the result"
| retval |
retval _ Array new: (processList size).
processList withIndexDo: [ :each :n | retval at: n put: (each
ifNil: ['no process']
ifNotNil: [each browserPrintString])
].
^retval! !
!ProcessBrowser methodsFor: 'process list' stamp: 'RAA 10/27/2000 11:58'!
updateProcessList
| oldSelectedProcess newIndex |
Smalltalk garbageCollect. "lose defunct processes"
oldSelectedProcess _ selectedProcess.
processList _ Process allInstances reject: [:each | each suspendedContext isNil].
processList _ processList sortBy: [ :a :b |
a priority >= b priority
].
processList _ WeakArray withAll: processList.
newIndex _ processList
indexOf: oldSelectedProcess
ifAbsent: [0].
self changed: #processNameList.
self processListIndex: newIndex! !
More information about the Squeak-dev
mailing list
|