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