author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 08 Jun 2011 22:53:07 +0100 | |
branch | jv |
changeset 17841 | 7abcc4aef871 |
parent 17834 | 04ff72c5039a |
child 17845 | 7e0cfaac936d |
permissions | -rw-r--r-- |
17761
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
1 |
" |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
3 |
All Rights Reserved |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
4 |
|
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
5 |
This software is furnished under a license and may be used |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
10 |
hereby transferred. |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
11 |
" |
17732 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
14 |
Object subclass:#SystemChangeNotifier |
|
15 |
instanceVariableNames:'silenceLevel' |
|
16 |
classVariableNames:'UniqueInstance' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Kernel-Classes' |
|
19 |
! |
|
20 |
||
21 |
!SystemChangeNotifier class methodsFor:'documentation'! |
|
22 |
||
17761
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
23 |
copyright |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
24 |
" |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
25 |
COPYRIGHT (c) 2006 by eXept Software AG |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
26 |
All Rights Reserved |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
27 |
|
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
28 |
This software is furnished under a license and may be used |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
29 |
only in accordance with the terms of that license and with the |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
30 |
inclusion of the above copyright notice. This software may not |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
31 |
be provided or otherwise made available to, or used by, any |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
32 |
other person. No title to or ownership of the software is |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
33 |
hereby transferred. |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
34 |
" |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
35 |
! |
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
36 |
|
17732 | 37 |
documentation |
38 |
" |
|
39 |
For now, this implementation is mostly for squeak compatibility. |
|
40 |
However, over time, we will move the change notification code from ClassDescription to here, |
|
41 |
to make things easier to understand, and classDescription a little bit more lightweight. |
|
42 |
" |
|
43 |
! ! |
|
44 |
||
17763 | 45 |
!SystemChangeNotifier class methodsFor:'instance creation'! |
17732 | 46 |
|
47 |
uniqueInstance |
|
48 |
"I am a singleton" |
|
49 |
||
50 |
UniqueInstance isNil ifTrue: [UniqueInstance := self basicNew initialize]. |
|
51 |
^ UniqueInstance |
|
52 |
||
53 |
" |
|
54 |
UniqueInstance releaseAll. |
|
55 |
UniqueInstance := nil |
|
56 |
" |
|
57 |
! ! |
|
58 |
||
59 |
!SystemChangeNotifier methodsFor:'change notifications'! |
|
60 |
||
61 |
class: trait recategorizedFrom: oldCategory to:newCategory |
|
62 |
"dummy for now - will write a change record eventually" |
|
63 |
! |
|
64 |
||
65 |
classAdded:aClass inCategory:aCategoryString |
|
66 |
"dummy for now - will write a change record eventually" |
|
67 |
! |
|
68 |
||
69 |
traitDefinitionChangedFrom:oldTrait to:newTrait |
|
70 |
"dummy for now - will write a change record eventually" |
|
71 |
! ! |
|
72 |
||
73 |
!SystemChangeNotifier methodsFor:'initialization'! |
|
74 |
||
75 |
initialize |
|
76 |
"/ eventSource := SystemEventManager new. |
|
77 |
silenceLevel := 0. |
|
78 |
! ! |
|
79 |
||
80 |
!SystemChangeNotifier methodsFor:'public'! |
|
81 |
||
82 |
doSilently: aBlock |
|
83 |
"Perform the block, and ensure that no system notification are broadcasted while doing so." |
|
84 |
||
85 |
|result| |
|
86 |
||
87 |
silenceLevel := silenceLevel + 1. |
|
88 |
[ |
|
89 |
"/ temporary hack: |
|
90 |
Class withoutUpdatingChangesDo:[ |
|
91 |
result := aBlock value |
|
92 |
] |
|
93 |
] ensure: [ |
|
94 |
silenceLevel > 0 ifTrue: [ |
|
95 |
silenceLevel := silenceLevel - 1 |
|
96 |
] |
|
97 |
]. |
|
98 |
^ result. |
|
99 |
! |
|
100 |
||
101 |
isBroadcasting |
|
102 |
^ silenceLevel = 0 |
|
17734
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17732
diff
changeset
|
103 |
! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17732
diff
changeset
|
104 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17732
diff
changeset
|
105 |
noMoreNotificationsFor: aStakeHolder |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17732
diff
changeset
|
106 |
"dummy for now " |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17732
diff
changeset
|
107 |
! |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17732
diff
changeset
|
108 |
|
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17732
diff
changeset
|
109 |
notify:aStakeHolder ofSystemChangesOfItem:anItemSymbol change: changeTypeSymbol using: changeMessage |
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17732
diff
changeset
|
110 |
"dummy for now " |
17732 | 111 |
! ! |
112 |
||
113 |
!SystemChangeNotifier class methodsFor:'documentation'! |
|
114 |
||
115 |
version_CVS |
|
17841 | 116 |
^ 'Header: /cvs/stx/stx/libbasic/SystemChangeNotifier.st,v 1.4 2010/04/14 16:13:57 cg Exp ' |
17761
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
117 |
! |
17734
406b1590afe8
Merged with trunk r10476
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17732
diff
changeset
|
118 |
|
17761
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
119 |
version_SVN |
17841 | 120 |
^ '$Id: SystemChangeNotifier.st 10643 2011-06-08 21:53:07Z vranyj1 $' |
17761
b0e5971141bc
Added Lookup and BuiltinLookup classes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17735
diff
changeset
|
121 |
! ! |
17763 | 122 |
|
17767 | 123 |
|
17772
6e0b3c06c364
Method reverted to r10532
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
17767
diff
changeset
|
124 |
|
17780 | 125 |
|
17807 | 126 |
|
17814 | 127 |
|
17834 | 128 |
|
17841 | 129 |