220 |
222 |
221 !ExternalStreamMonitor methodsFor:'drawing'! |
223 !ExternalStreamMonitor methodsFor:'drawing'! |
222 |
224 |
223 titleLine |
225 titleLine |
224 OperatingSystem isMSWINDOWSlike ifTrue:[ |
226 OperatingSystem isMSWINDOWSlike ifTrue:[ |
225 ^ 'Type Global Handle Detail'. |
227 ^ 'Type Global Handle Detail'. |
226 ] ifFalse:[ |
228 ] ifFalse:[ |
227 ^ 'Type Global FD Detail'. |
229 ^ 'Type Global FD Detail'. |
228 ]. |
230 ]. |
229 |
231 |
230 " |
232 " |
231 ExternalStreamMonitor open |
233 ExternalStreamMonitor open |
232 " |
234 " |
233 |
235 |
234 "Modified: / 17.6.1998 / 14:52:48 / cg" |
236 "Modified: / 17-06-1998 / 14:52:48 / cg" |
|
237 "Modified: / 29-10-2018 / 15:28:22 / Claus Gittinger" |
235 ! |
238 ! |
236 |
239 |
237 updateList |
240 updateList |
238 "update list of semaphores" |
241 "update list of semaphores" |
239 |
242 |
251 ]. |
254 ]. |
252 self filterConnectedSocketsOnlyHolder value ifTrue:[ |
255 self filterConnectedSocketsOnlyHolder value ifTrue:[ |
253 newList := newList select:[:eachStream | eachStream isSocket and:[eachStream isConnected]]. |
256 newList := newList select:[:eachStream | eachStream isSocket and:[eachStream isConnected]]. |
254 ]. |
257 ]. |
255 |
258 |
256 "sort by hashKey - will not always generate unique numbers, |
|
257 but most of the time, this works ... for now" |
|
258 |
|
259 newList sort:[:s1 :s2 | |
259 newList sort:[:s1 :s2 | |
260 s1 className < s2 className |
260 s1 className < s2 className |
261 or:[ s1 className = s2 className |
261 or:[ s1 className = s2 className |
262 and:[false]] |
262 and:[false]] |
263 ]. |
263 ]. |
265 newList ~= streams ifTrue:[ |
265 newList ~= streams ifTrue:[ |
266 self updateStatus:newList |
266 self updateStatus:newList |
267 ]. |
267 ]. |
268 ]. |
268 ]. |
269 self installDelayedUpdate. |
269 self installDelayedUpdate. |
|
270 |
|
271 "Modified (comment): / 29-10-2018 / 15:32:00 / Claus Gittinger" |
270 ! |
272 ! |
271 |
273 |
272 updateStatus:newStreamsList |
274 updateStatus:newStreamsList |
273 "update status display of semaphores" |
275 "update status display of semaphores" |
274 |
276 |
285 newStreamsList notNil ifTrue:[ |
287 newStreamsList notNil ifTrue:[ |
286 streams := WeakArray withAll:newStreamsList. |
288 streams := WeakArray withAll:newStreamsList. |
287 ]. |
289 ]. |
288 streams notNil ifTrue:[ |
290 streams notNil ifTrue:[ |
289 list := OrderedCollection new:(streams size + self numberOfHeadlines). |
291 list := OrderedCollection new:(streams size + self numberOfHeadlines). |
|
292 list add:'Time: ',(Time now printString). |
290 list add:self titleLine. |
293 list add:self titleLine. |
291 list add:(String new:self titleLine size withAll:$-). |
294 list add:(String new:(self titleLine size+20) withAll:$-). |
292 |
295 |
293 streams validElementsDo:[:aStream | |
296 streams validElementsDo:[:aStream | |
294 |waiters waitersNames type globalNameOrNil handleString |
297 |waiters waitersNames type globalNameOrNil handleString |
295 isOpen handle detail color line| |
298 isOpen handle detail color line| |
296 |
299 |
324 "/ ] |
327 "/ ] |
325 "/ ] ifFalse:[ |
328 "/ ] ifFalse:[ |
326 "/ nm := '' |
329 "/ nm := '' |
327 "/ ]. |
330 "/ ]. |
328 type := aStream className. |
331 type := aStream className. |
329 |
332 "/ beware of aliases... |
330 globalNameOrNil := Smalltalk keyAtValue:aStream. |
333 aStream = Stdin ifTrue:[ |
331 |
334 globalNameOrNil := 'Stdin'. |
|
335 ] ifFalse:[ |
|
336 aStream = Stdout ifTrue:[ |
|
337 globalNameOrNil := 'Stdout'. |
|
338 ] ifFalse:[ |
|
339 aStream = Stderr ifTrue:[ |
|
340 globalNameOrNil := 'Stderr'. |
|
341 ] ifFalse:[ |
|
342 globalNameOrNil := Smalltalk keyAtValue:aStream. |
|
343 ] |
|
344 ] |
|
345 ]. |
332 aStream isFileStream ifTrue:[ |
346 aStream isFileStream ifTrue:[ |
333 detail := aStream pathName. |
347 detail := aStream pathName. |
334 ] ifFalse:[ |
348 ] ifFalse:[ |
335 aStream isSocket ifTrue:[ |
349 aStream isSocket ifTrue:[ |
336 detail := ''. |
350 detail := ''. |
337 aStream getPeer notNil ifTrue:[ |
351 aStream getPeer notNil ifTrue:[ |
338 detail := detail,(aStream getPeerName printString),(aStream getPeer printString). |
352 detail := detail,(aStream getPeerName printString),'[',(aStream getPeer printString),']'. |
339 ]. |
353 ]. |
340 aStream port notNil ifTrue:[ |
354 aStream port notNil ifTrue:[ |
341 detail := detail,':',aStream port printString |
355 detail := detail,':',aStream port printString |
342 ]. |
356 ]. |
343 ] ifFalse:[ |
357 ] ifFalse:[ |
358 ]. |
372 ]. |
359 handleString := (handleString ? '') leftPaddedTo:7 |
373 handleString := (handleString ? '') leftPaddedTo:7 |
360 ] ifFalse:[ |
374 ] ifFalse:[ |
361 aStream isOpen ifTrue:[ |
375 aStream isOpen ifTrue:[ |
362 [ |
376 [ |
|
377 handleString := aStream fileDescriptor printString |
363 ] on:StreamError do:[ |
378 ] on:StreamError do:[ |
364 handleString := aStream fileDescriptor printString |
|
365 ]. |
379 ]. |
366 ]. |
380 ]. |
367 handleString := (handleString ? '') leftPaddedTo:3 |
381 handleString := (handleString ? '') leftPaddedTo:3 |
368 ]. |
382 ]. |
369 |
383 |
370 line := (type contractTo:20) paddedTo:20. |
384 line := (type contractTo:30) paddedTo:30. |
371 line := line , ' ' , (((globalNameOrNil ? '') contractTo:25) paddedTo:25). |
385 line := line , ' ' , (((globalNameOrNil ? '') contractTo:30) paddedTo:30). |
372 line := line , ' ' , handleString. |
386 line := line , ' ' , handleString. |
373 line := line , ' ' , (detail ? ''). |
387 line := line , ' ' , (detail ? ''). |
374 |
388 |
375 isOpen := aStream isOpen. |
389 isOpen := aStream isOpen. |
376 |
390 |