12221
|
1 |
"{ Package: 'stx:libbasic' }"
|
|
2 |
|
|
3 |
Object subclass:#SystemChangeNotifier
|
|
4 |
instanceVariableNames:'silenceLevel'
|
|
5 |
classVariableNames:'UniqueInstance'
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Kernel-Classes'
|
|
8 |
!
|
|
9 |
|
|
10 |
!SystemChangeNotifier class methodsFor:'documentation'!
|
|
11 |
|
|
12 |
documentation
|
|
13 |
"
|
|
14 |
For now, this implementation is mostly for squeak compatibility.
|
|
15 |
However, over time, we will move the change notification code from ClassDescription to here,
|
|
16 |
to make things easier to understand, and classDescription a little bit more lightweight.
|
|
17 |
"
|
|
18 |
! !
|
|
19 |
|
|
20 |
!SystemChangeNotifier class methodsFor:'instance creaton'!
|
|
21 |
|
|
22 |
uniqueInstance
|
|
23 |
"I am a singleton"
|
|
24 |
|
|
25 |
UniqueInstance isNil ifTrue: [UniqueInstance := self basicNew initialize].
|
|
26 |
^ UniqueInstance
|
|
27 |
|
|
28 |
"
|
|
29 |
UniqueInstance releaseAll.
|
|
30 |
UniqueInstance := nil
|
|
31 |
"
|
|
32 |
! !
|
|
33 |
|
12248
|
34 |
!SystemChangeNotifier methodsFor:'change notifications'!
|
|
35 |
|
|
36 |
class: trait recategorizedFrom: oldCategory to:newCategory
|
|
37 |
"dummy for now - will write a change record eventually"
|
|
38 |
!
|
|
39 |
|
|
40 |
classAdded:aClass inCategory:aCategoryString
|
|
41 |
"dummy for now - will write a change record eventually"
|
|
42 |
!
|
|
43 |
|
|
44 |
traitDefinitionChangedFrom:oldTrait to:newTrait
|
|
45 |
"dummy for now - will write a change record eventually"
|
|
46 |
! !
|
|
47 |
|
12221
|
48 |
!SystemChangeNotifier methodsFor:'initialization'!
|
|
49 |
|
|
50 |
initialize
|
|
51 |
"/ eventSource := SystemEventManager new.
|
|
52 |
silenceLevel := 0.
|
|
53 |
! !
|
|
54 |
|
|
55 |
!SystemChangeNotifier methodsFor:'public'!
|
|
56 |
|
|
57 |
doSilently: aBlock
|
|
58 |
"Perform the block, and ensure that no system notification are broadcasted while doing so."
|
|
59 |
|
|
60 |
|result|
|
|
61 |
|
|
62 |
silenceLevel := silenceLevel + 1.
|
|
63 |
[
|
|
64 |
"/ temporary hack:
|
|
65 |
Class withoutUpdatingChangesDo:[
|
|
66 |
result := aBlock value
|
|
67 |
]
|
|
68 |
] ensure: [
|
|
69 |
silenceLevel > 0 ifTrue: [
|
|
70 |
silenceLevel := silenceLevel - 1
|
|
71 |
]
|
|
72 |
].
|
|
73 |
^ result.
|
|
74 |
!
|
|
75 |
|
|
76 |
isBroadcasting
|
|
77 |
^ silenceLevel = 0
|
12367
|
78 |
!
|
|
79 |
|
|
80 |
noMoreNotificationsFor: aStakeHolder
|
|
81 |
"dummy for now "
|
|
82 |
!
|
|
83 |
|
|
84 |
notify:aStakeHolder ofSystemChangesOfItem:anItemSymbol change: changeTypeSymbol using: changeMessage
|
|
85 |
"dummy for now "
|
12221
|
86 |
! !
|
|
87 |
|
|
88 |
!SystemChangeNotifier class methodsFor:'documentation'!
|
|
89 |
|
|
90 |
version_CVS
|
12367
|
91 |
^ '$Header: /cvs/stx/stx/libbasic/SystemChangeNotifier.st,v 1.3 2009-10-26 17:31:00 cg Exp $'
|
12221
|
92 |
! !
|