author | Claus Gittinger <cg@exept.de> |
Mon, 15 Jul 2019 15:32:22 +0200 | |
changeset 24425 | 3733fe6e6258 |
parent 21274 | d8206abd0aea |
child 21292 | 21faad473411 |
permissions | -rw-r--r-- |
21274 | 1 |
" |
2 |
COPYRIGHT (c) 2009 by eXept Software AG |
|
3 |
All Rights Reserved |
|
20513 | 4 |
|
21274 | 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 |
" |
|
12221 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
20513 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
12221 | 16 |
Object subclass:#SystemChangeNotifier |
17 |
instanceVariableNames:'silenceLevel' |
|
18 |
classVariableNames:'UniqueInstance' |
|
19 |
poolDictionaries:'' |
|
15422
11e0080d4ef9
class: SystemChangeNotifier
Claus Gittinger <cg@exept.de>
parents:
14862
diff
changeset
|
20 |
category:'Kernel-Classes-Support' |
12221 | 21 |
! |
22 |
||
23 |
!SystemChangeNotifier class methodsFor:'documentation'! |
|
24 |
||
21274 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 2009 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
||
37 |
" |
|
38 |
! |
|
39 |
||
12221 | 40 |
documentation |
41 |
" |
|
42 |
For now, this implementation is mostly for squeak compatibility. |
|
14862
beeba0f8b676
class: SystemChangeNotifier
Claus Gittinger <cg@exept.de>
parents:
12880
diff
changeset
|
43 |
However, in the future, we may move the change notification code from ClassDescription to here, |
12221 | 44 |
to make things easier to understand, and classDescription a little bit more lightweight. |
45 |
" |
|
46 |
! ! |
|
47 |
||
12880
48e15de4c9ab
category of: #uniqueInstance
Claus Gittinger <cg@exept.de>
parents:
12367
diff
changeset
|
48 |
!SystemChangeNotifier class methodsFor:'instance creation'! |
12221 | 49 |
|
50 |
uniqueInstance |
|
51 |
"I am a singleton" |
|
52 |
||
53 |
UniqueInstance isNil ifTrue: [UniqueInstance := self basicNew initialize]. |
|
54 |
^ UniqueInstance |
|
55 |
||
56 |
" |
|
57 |
UniqueInstance releaseAll. |
|
58 |
UniqueInstance := nil |
|
59 |
" |
|
60 |
! ! |
|
61 |
||
12248 | 62 |
!SystemChangeNotifier methodsFor:'change notifications'! |
63 |
||
64 |
class: trait recategorizedFrom: oldCategory to:newCategory |
|
65 |
"dummy for now - will write a change record eventually" |
|
66 |
! |
|
67 |
||
68 |
classAdded:aClass inCategory:aCategoryString |
|
69 |
"dummy for now - will write a change record eventually" |
|
70 |
! |
|
71 |
||
72 |
traitDefinitionChangedFrom:oldTrait to:newTrait |
|
73 |
"dummy for now - will write a change record eventually" |
|
74 |
! ! |
|
75 |
||
12221 | 76 |
!SystemChangeNotifier methodsFor:'initialization'! |
77 |
||
78 |
initialize |
|
79 |
"/ eventSource := SystemEventManager new. |
|
80 |
silenceLevel := 0. |
|
81 |
! ! |
|
82 |
||
83 |
!SystemChangeNotifier methodsFor:'public'! |
|
84 |
||
85 |
doSilently: aBlock |
|
86 |
"Perform the block, and ensure that no system notification are broadcasted while doing so." |
|
87 |
||
88 |
|result| |
|
89 |
||
90 |
silenceLevel := silenceLevel + 1. |
|
91 |
[ |
|
92 |
"/ temporary hack: |
|
93 |
Class withoutUpdatingChangesDo:[ |
|
94 |
result := aBlock value |
|
95 |
] |
|
96 |
] ensure: [ |
|
97 |
silenceLevel > 0 ifTrue: [ |
|
98 |
silenceLevel := silenceLevel - 1 |
|
99 |
] |
|
100 |
]. |
|
101 |
^ result. |
|
102 |
! |
|
103 |
||
104 |
isBroadcasting |
|
105 |
^ silenceLevel = 0 |
|
12367 | 106 |
! |
107 |
||
108 |
noMoreNotificationsFor: aStakeHolder |
|
109 |
"dummy for now " |
|
110 |
! |
|
111 |
||
20513 | 112 |
notify:aStakeHolder ofAllSystemChangesUsing:changeMessage |
113 |
"dummy for now " |
|
114 |
! |
|
115 |
||
12367 | 116 |
notify:aStakeHolder ofSystemChangesOfItem:anItemSymbol change: changeTypeSymbol using: changeMessage |
117 |
"dummy for now " |
|
12221 | 118 |
! ! |
119 |
||
120 |
!SystemChangeNotifier class methodsFor:'documentation'! |
|
121 |
||
122 |
version_CVS |
|
20513 | 123 |
^ '$Header$' |
12221 | 124 |
! ! |
14862
beeba0f8b676
class: SystemChangeNotifier
Claus Gittinger <cg@exept.de>
parents:
12880
diff
changeset
|
125 |