author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 30 Jan 2012 17:49:41 +0000 | |
branch | jv |
changeset 12128 | a7ff7d66ee85 |
parent 12125 | 0c49a3b13e43 |
child 12431 | 9f0c59c742d5 |
permissions | -rw-r--r-- |
2744 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
2699 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
981 | 14 |
SimpleView subclass:#SystemStatusMonitor |
15 |
instanceVariableNames:'listView listUpdateDelay updateDelay updateBlock listUpdateBlock |
|
16 |
updateProcess' |
|
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
1053 | 19 |
category:'Monitors-ST/X' |
981 | 20 |
! |
21 |
||
2744 | 22 |
!SystemStatusMonitor class methodsFor:'documentation'! |
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! ! |
|
981 | 37 |
|
38 |
!SystemStatusMonitor class methodsFor:'defaults'! |
|
39 |
||
40 |
defaultIcon |
|
41 |
^ StandardSystemView defaultIcon |
|
42 |
||
43 |
"Created: 23.1.1997 / 02:52:25 / cg" |
|
44 |
! |
|
45 |
||
46 |
defaultLabel |
|
47 |
^ 'Status Monitor' |
|
48 |
||
49 |
"Created: 23.1.1997 / 02:52:43 / cg" |
|
50 |
! ! |
|
51 |
||
52 |
!SystemStatusMonitor class methodsFor:'startup'! |
|
53 |
||
1823 | 54 |
isVisualStartable |
2844 | 55 |
"return true, if this application can be started via #open. |
56 |
(to allow start of a change browser via double-click in the browser)" |
|
57 |
||
1823 | 58 |
^ self ~~ SystemStatusMonitor |
59 |
||
60 |
"Created: / 10.8.1998 / 16:02:23 / cg" |
|
61 |
"Modified: / 10.8.1998 / 16:02:41 / cg" |
|
62 |
! |
|
63 |
||
981 | 64 |
open |
65 |
|top monitor| |
|
66 |
||
67 |
top := StandardSystemView new. |
|
68 |
monitor := self origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
69 |
top extent:monitor preferredExtent. |
|
70 |
top label:self defaultLabel. |
|
71 |
top icon:self defaultIcon. |
|
2410 | 72 |
top open. |
73 |
||
74 |
^ monitor |
|
981 | 75 |
|
76 |
" |
|
77 |
ProcessMonitor open |
|
78 |
" |
|
79 |
||
80 |
"Created: 23.1.1997 / 02:53:42 / cg" |
|
81 |
! ! |
|
82 |
||
83 |
!SystemStatusMonitor methodsFor:'destroying'! |
|
84 |
||
3825 | 85 |
release |
981 | 86 |
updateBlock notNil ifTrue:[ |
3825 | 87 |
Processor removeTimedBlock:updateBlock. |
88 |
updateBlock := nil. |
|
981 | 89 |
]. |
3825 | 90 |
listUpdateBlock notNil ifTrue:[ |
91 |
Processor removeTimedBlock:listUpdateBlock. |
|
92 |
listUpdateBlock := nil. |
|
93 |
]. |
|
94 |
updateProcess notNil ifTrue:[ |
|
95 |
updateProcess terminate. |
|
96 |
updateProcess := nil. |
|
97 |
]. |
|
98 |
super release |
|
981 | 99 |
|
100 |
"Created: 23.1.1997 / 02:26:50 / cg" |
|
101 |
! ! |
|
102 |
||
103 |
!SystemStatusMonitor methodsFor:'drawing'! |
|
104 |
||
6157 | 105 |
updateList |
106 |
self subclassResponsibility |
|
107 |
! |
|
108 |
||
109 |
updateStatus:arg |
|
110 |
self subclassResponsibility |
|
111 |
! |
|
112 |
||
981 | 113 |
updateView |
114 |
self updateList. |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
115 |
self updateStatus:nil |
981 | 116 |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
117 |
"Created: / 23.1.1997 / 02:27:05 / cg" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
118 |
"Modified: / 14.12.1999 / 20:47:37 / cg" |
981 | 119 |
! ! |
120 |
||
121 |
!SystemStatusMonitor methodsFor:'events'! |
|
122 |
||
123 |
canHandle:key |
|
124 |
^ key == #InspectIt |
|
125 |
||
126 |
"Created: 23.1.1997 / 02:27:15 / cg" |
|
127 |
! |
|
128 |
||
129 |
keyPress:key x:x y:y |
|
130 |
<resource: #keyboard ( #InspectIt ) > |
|
131 |
||
132 |
key == #InspectIt ifTrue:[ |
|
1897 | 133 |
^ self inspectSelection. |
981 | 134 |
]. |
135 |
^ super keyPress:key x:x y:y |
|
136 |
||
137 |
"Modified: 23.1.1997 / 02:27:27 / cg" |
|
138 |
"Created: 23.1.1997 / 02:27:45 / cg" |
|
139 |
! ! |
|
140 |
||
141 |
!SystemStatusMonitor methodsFor:'initialization'! |
|
142 |
||
143 |
initialize |
|
144 |
|v| |
|
145 |
||
146 |
super initialize. |
|
147 |
||
148 |
v := HVScrollableView for:SelectionInListView miniScrollerH:true in:self. |
|
149 |
v origin:0.0@0.0 corner:1.0@1.0. |
|
150 |
||
151 |
listView := v scrolledView. |
|
1273
3a8a91e6c5fa
give my listView a fixed font.
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
152 |
listView font:(EditTextView defaultFont). |
981 | 153 |
listView menuHolder:self; menuPerformer:self; menuMessage:#statusMenu. |
154 |
||
155 |
listView multipleSelectOk:true. |
|
1897 | 156 |
"/ listView toggleSelect:true. |
981 | 157 |
listView delegate:(KeyboardForwarder toView:self). |
158 |
listView doubleClickAction:[:line | self doubleClicked]. |
|
159 |
||
160 |
updateDelay := 0.5. |
|
161 |
listUpdateDelay := 5. |
|
162 |
||
163 |
"/ event mode is no longer used; |
|
164 |
"/ this event support may vanish |
|
165 |
Processor isPureEventDriven ifTrue:[ |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
166 |
updateBlock := [self updateStatus:nil]. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
167 |
listUpdateBlock := [self updateList]. |
981 | 168 |
]. |
169 |
||
170 |
" |
|
171 |
ProcessMonitor open |
|
172 |
" |
|
173 |
||
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
174 |
"Modified: / 14.12.1999 / 20:47:57 / cg" |
981 | 175 |
! |
176 |
||
177 |
mapped |
|
178 |
super mapped. |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
179 |
self updateStatus:nil. |
981 | 180 |
self updateList. |
181 |
||
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
182 |
"Created: / 23.1.1997 / 02:30:05 / cg" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
183 |
"Modified: / 14.12.1999 / 20:47:54 / cg" |
981 | 184 |
! |
185 |
||
186 |
realize |
|
187 |
super realize. |
|
188 |
||
189 |
self startUpdateProcess. |
|
190 |
||
191 |
"Created: 23.1.1997 / 02:30:28 / cg" |
|
192 |
! |
|
193 |
||
194 |
reinitialize |
|
195 |
updateProcess := nil. |
|
196 |
super reinitialize. |
|
197 |
self startUpdateProcess. |
|
198 |
||
199 |
"Modified: 22.12.1995 / 22:51:14 / cg" |
|
200 |
"Created: 23.1.1997 / 02:30:43 / cg" |
|
201 |
! |
|
202 |
||
203 |
startUpdateProcess |
|
204 |
updateBlock notNil ifTrue:[ |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
205 |
Processor addTimedBlock:updateBlock afterSeconds:updateDelay. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
206 |
Processor addTimedBlock:listUpdateBlock afterSeconds:listUpdateDelay. |
981 | 207 |
] ifFalse:[ |
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
208 |
updateProcess := [ |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
209 |
[ |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
210 |
|id cnt myDelay| |
992 | 211 |
|
3024 | 212 |
myDelay := Delay forSeconds:updateDelay. |
981 | 213 |
|
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
214 |
" |
3024 | 215 |
every updateDelay (0.5), we look which process runs; |
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
216 |
every half second, the status is updated. |
3024 | 217 |
every listUpdateDelay (5s), the list of processes is |
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
218 |
built up again |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
219 |
" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
220 |
[true] whileTrue:[ |
3024 | 221 |
((listUpdateDelay // updateDelay) max:2) - 1 timesRepeat:[ |
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
222 |
myDelay wait. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
223 |
self updateStatus:nil. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
224 |
]. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
225 |
myDelay wait. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
226 |
self updateList. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
227 |
] |
6156 | 228 |
] ifCurtailed:[ |
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
229 |
updateProcess := nil |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
230 |
] |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
231 |
] forkAt:(Processor userSchedulingPriority + 1). |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
232 |
updateProcess name:'monitor [' , |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
233 |
Processor activeProcess id printString , |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
234 |
'] update'. |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
235 |
" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
236 |
raise my own priority |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
237 |
" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
238 |
Processor activeProcess priority:(Processor userSchedulingPriority + 2) |
981 | 239 |
]. |
240 |
||
2488
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
241 |
"Created: / 23.1.1997 / 02:30:58 / cg" |
65689c6d5bd6
changes to avoid loosing the selection when the list is updated
Claus Gittinger <cg@exept.de>
parents:
2410
diff
changeset
|
242 |
"Modified: / 14.12.1999 / 20:47:50 / cg" |
981 | 243 |
! ! |
244 |
||
245 |
!SystemStatusMonitor methodsFor:'queries'! |
|
246 |
||
247 |
preferredExtent |
|
248 |
"return my preferred extent" |
|
249 |
||
2699 | 250 |
^ (font widthOf:self titleLine) + 40 @ 200 |
981 | 251 |
|
252 |
"Modified: 23.1.1997 / 02:35:01 / cg" |
|
253 |
"Created: 23.1.1997 / 02:51:24 / cg" |
|
254 |
! ! |
|
255 |
||
256 |
!SystemStatusMonitor class methodsFor:'documentation'! |
|
257 |
||
258 |
version |
|
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
259 |
^ '$Id: SystemStatusMonitor.st 7854 2012-01-30 17:49:41Z vranyj1 $' |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
260 |
! |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
261 |
|
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
262 |
version_SVN |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
263 |
^ '$Id: SystemStatusMonitor.st 7854 2012-01-30 17:49:41Z vranyj1 $' |
12125 | 264 |
! ! |