author | Stefan Vogel <sv@exept.de> |
Wed, 11 Jan 2017 11:23:12 +0100 | |
changeset 21225 | 3d24c11b1f9b |
parent 20513 | 95bba45079d3 |
child 20579 | 9add81aadb7a |
child 21274 | d8206abd0aea |
permissions | -rw-r--r-- |
20513 | 1 |
"{ Encoding: utf8 }" |
2 |
||
12221 | 3 |
"{ Package: 'stx:libbasic' }" |
4 |
||
20513 | 5 |
"{ NameSpace: Smalltalk }" |
6 |
||
12221 | 7 |
Object subclass:#SystemChangeNotifier |
8 |
instanceVariableNames:'silenceLevel' |
|
9 |
classVariableNames:'UniqueInstance' |
|
10 |
poolDictionaries:'' |
|
15422
11e0080d4ef9
class: SystemChangeNotifier
Claus Gittinger <cg@exept.de>
parents:
14862
diff
changeset
|
11 |
category:'Kernel-Classes-Support' |
12221 | 12 |
! |
13 |
||
14 |
!SystemChangeNotifier class methodsFor:'documentation'! |
|
15 |
||
16 |
documentation |
|
17 |
" |
|
18 |
For now, this implementation is mostly for squeak compatibility. |
|
14862
beeba0f8b676
class: SystemChangeNotifier
Claus Gittinger <cg@exept.de>
parents:
12880
diff
changeset
|
19 |
However, in the future, we may move the change notification code from ClassDescription to here, |
12221 | 20 |
to make things easier to understand, and classDescription a little bit more lightweight. |
21 |
" |
|
22 |
! ! |
|
23 |
||
12880
48e15de4c9ab
category of: #uniqueInstance
Claus Gittinger <cg@exept.de>
parents:
12367
diff
changeset
|
24 |
!SystemChangeNotifier class methodsFor:'instance creation'! |
12221 | 25 |
|
26 |
uniqueInstance |
|
27 |
"I am a singleton" |
|
28 |
||
29 |
UniqueInstance isNil ifTrue: [UniqueInstance := self basicNew initialize]. |
|
30 |
^ UniqueInstance |
|
31 |
||
32 |
" |
|
33 |
UniqueInstance releaseAll. |
|
34 |
UniqueInstance := nil |
|
35 |
" |
|
36 |
! ! |
|
37 |
||
12248 | 38 |
!SystemChangeNotifier methodsFor:'change notifications'! |
39 |
||
40 |
class: trait recategorizedFrom: oldCategory to:newCategory |
|
41 |
"dummy for now - will write a change record eventually" |
|
42 |
! |
|
43 |
||
44 |
classAdded:aClass inCategory:aCategoryString |
|
45 |
"dummy for now - will write a change record eventually" |
|
46 |
! |
|
47 |
||
48 |
traitDefinitionChangedFrom:oldTrait to:newTrait |
|
49 |
"dummy for now - will write a change record eventually" |
|
50 |
! ! |
|
51 |
||
12221 | 52 |
!SystemChangeNotifier methodsFor:'initialization'! |
53 |
||
54 |
initialize |
|
55 |
"/ eventSource := SystemEventManager new. |
|
56 |
silenceLevel := 0. |
|
57 |
! ! |
|
58 |
||
59 |
!SystemChangeNotifier methodsFor:'public'! |
|
60 |
||
61 |
doSilently: aBlock |
|
62 |
"Perform the block, and ensure that no system notification are broadcasted while doing so." |
|
63 |
||
64 |
|result| |
|
65 |
||
66 |
silenceLevel := silenceLevel + 1. |
|
67 |
[ |
|
68 |
"/ temporary hack: |
|
69 |
Class withoutUpdatingChangesDo:[ |
|
70 |
result := aBlock value |
|
71 |
] |
|
72 |
] ensure: [ |
|
73 |
silenceLevel > 0 ifTrue: [ |
|
74 |
silenceLevel := silenceLevel - 1 |
|
75 |
] |
|
76 |
]. |
|
77 |
^ result. |
|
78 |
! |
|
79 |
||
80 |
isBroadcasting |
|
81 |
^ silenceLevel = 0 |
|
12367 | 82 |
! |
83 |
||
84 |
noMoreNotificationsFor: aStakeHolder |
|
85 |
"dummy for now " |
|
86 |
! |
|
87 |
||
20513 | 88 |
notify:aStakeHolder ofAllSystemChangesUsing:changeMessage |
89 |
"dummy for now " |
|
90 |
! |
|
91 |
||
12367 | 92 |
notify:aStakeHolder ofSystemChangesOfItem:anItemSymbol change: changeTypeSymbol using: changeMessage |
93 |
"dummy for now " |
|
12221 | 94 |
! ! |
95 |
||
96 |
!SystemChangeNotifier class methodsFor:'documentation'! |
|
97 |
||
98 |
version_CVS |
|
20513 | 99 |
^ '$Header$' |
12221 | 100 |
! ! |
14862
beeba0f8b676
class: SystemChangeNotifier
Claus Gittinger <cg@exept.de>
parents:
12880
diff
changeset
|
101 |