SystemChangeNotifier.st
author Jan Vrany <jan.vrany@labware.com>
Wed, 22 Mar 2023 13:57:18 +0000
branchjv
changeset 25445 1623217d2268
parent 21292 21faad473411
permissions -rw-r--r--
Cherry-picked OrderedCollection.st from 0b286fd51da7: * d4c86d7c0bfc: #TUNING by stefan, Stefan Vogel <sv@exept.de> * 692b6497a669: #DOCUMENTATION by stefan, Stefan Vogel <sv@exept.de> * d47bb2912953: #DOCUMENTATION by stefan, Stefan Vogel <sv@exept.de> * abb4316c6bff: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 3a8fce0e8d11: #TUNING by stefan, Stefan Vogel <sv@exept.de> * 03d29bf8c5bb: #REFACTORING by stefan, Stefan Vogel <sv@exept.de> * cccc6c4abcfc: #REFACTORING by stefan, Stefan Vogel <sv@exept.de> * 35d957c7a840: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 6b11890f5f2c: #OTHER by cg, Claus Gittinger <cg@exept.de> * abb6108fb06b: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 2c4768bb2e89: #FEATURE by cg, Claus Gittinger <cg@exept.de> * 4029e964d0f1: #FEATURE by cg, Claus Gittinger <cg@exept.de> * ddcab3a9c2df: #OTHER by cg, Claus Gittinger <cg@exept.de> * 2213eb56e0c7: #REFACTORING by exept, Claus Gittinger <cg@exept.de> * 09ca874a6160: #REFACTORING by exept, Claus Gittinger <cg@exept.de> * 30b332af1f33: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * 779764ba117b: #REFACTORING by cg, Claus Gittinger <cg@exept.de> * b3d232a613c9: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * c417f7edaec1: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * 904b6538f379: #FEATURE by exept, Claus Gittinger <cg@exept.de> * c5887f03e01f: #REFACTORING by stefan, Stefan Vogel <sv@exept.de> * 8912d03aff48: #BUGFIX by exept, Claus Gittinger <cg@exept.de> * de5cd1dab4c3: #DOCUMENTATION by exept, Claus Gittinger <cg@exept.de> * 9bbd26603378: #OTHER by exept, Claus Gittinger <cg@exept.de> * c2c9dc110f42: #FEATURE by stefan, Stefan Vogel <sv@exept.de> * 81d123c6703d: #DOCUMENTATION by stefan, Stefan Vogel <sv@exept.de> * 8aadbb21458a: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * f210dbb8b2f6: #TUNING by stefan, Stefan Vogel <sv@exept.de> * c2c774fc53c0: #FEATURE by exept, Claus Gittinger <cg@exept.de> * b6f462670875: #DOCUMENTATION by exept, Claus Gittinger <cg@exept.de> * 27ae4021d5d6: #FEATURE by stefan, Stefan Vogel <sv@exept.de> * 10d9e9d85594: #TUNING by exept, Claus Gittinger <cg@exept.de> * 2653d855dcc7: #DOCUMENTATION by exept, Claus Gittinger <cg@exept.de> * 6ea1698a1a34: #FEATURE by stefan, Stefan Vogel <sv@exept.de> * 28762315e664: #OTHER by exept, Claus Gittinger <cg@exept.de> * 7142ea786f3e: #TUNING by stefan, Stefan Vogel <sv@exept.de> * 7875acb42b53: #BUGFIX by stefan, Stefan Vogel <sv@exept.de> * 163a0eebc97e: #BUGFIX by Maren, matilk
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21274
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
     1
"
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
     2
 COPYRIGHT (c) 2009 by eXept Software AG
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
     3
              All Rights Reserved
20513
95bba45079d3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15422
diff changeset
     4
21274
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
     5
 This software is furnished under a license and may be used
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
     6
 only in accordance with the terms of that license and with the
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
     7
 inclusion of the above copyright notice. This software may not
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
     8
 be provided or otherwise made available to, or used by, any
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
     9
 other person. No title to or ownership of the software is
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    10
 hereby transferred.
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    11
"
12221
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libbasic' }"
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
20513
95bba45079d3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15422
diff changeset
    14
"{ NameSpace: Smalltalk }"
95bba45079d3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15422
diff changeset
    15
12221
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
Object subclass:#SystemChangeNotifier
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:'silenceLevel'
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:'UniqueInstance'
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
15422
11e0080d4ef9 class: SystemChangeNotifier
Claus Gittinger <cg@exept.de>
parents: 14862
diff changeset
    20
	category:'Kernel-Classes-Support'
12221
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!SystemChangeNotifier class methodsFor:'documentation'!
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
21274
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    25
copyright
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    26
"
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    27
 COPYRIGHT (c) 2009 by eXept Software AG
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    28
              All Rights Reserved
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    29
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    30
 This software is furnished under a license and may be used
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    31
 only in accordance with the terms of that license and with the
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    32
 inclusion of the above copyright notice. This software may not
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    33
 be provided or otherwise made available to, or used by, any
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    34
 other person. No title to or ownership of the software is
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    35
 hereby transferred.
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    36
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    37
"
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    38
!
d8206abd0aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20513
diff changeset
    39
12221
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
documentation
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
"
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    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
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    to make things easier to understand, and classDescription a little bit more lightweight.
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
"
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
! !
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
12880
48e15de4c9ab category of: #uniqueInstance
Claus Gittinger <cg@exept.de>
parents: 12367
diff changeset
    48
!SystemChangeNotifier class methodsFor:'instance creation'!
12221
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
uniqueInstance
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    "I am a singleton"
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    UniqueInstance isNil ifTrue: [UniqueInstance := self basicNew initialize].
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    ^ UniqueInstance
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    "
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
     UniqueInstance releaseAll.
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
     UniqueInstance := nil
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    "
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
! !
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
12248
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    62
!SystemChangeNotifier methodsFor:'change notifications'!
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    63
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    64
class: trait recategorizedFrom: oldCategory to:newCategory    
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    65
    "dummy for now - will write a change record eventually"
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    66
!
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    67
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    68
classAdded:aClass inCategory:aCategoryString
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    69
    "dummy for now - will write a change record eventually"
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    70
!
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    71
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    72
traitDefinitionChangedFrom:oldTrait to:newTrait
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    73
    "dummy for now - will write a change record eventually"
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    74
! !
Claus Gittinger <cg@exept.de>
parents: 12221
diff changeset
    75
12221
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
!SystemChangeNotifier methodsFor:'initialization'!
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
initialize
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    "/ eventSource := SystemEventManager new.
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    silenceLevel := 0.
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
! !
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
!SystemChangeNotifier methodsFor:'public'!
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
doSilently: aBlock
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    "Perform the block, and ensure that no system notification are broadcasted while doing so."
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    |result|
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    silenceLevel := silenceLevel + 1.
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    [
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
        "/ temporary hack:
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
        Class withoutUpdatingChangesDo:[
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
            result := aBlock value
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
        ]
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    ] ensure: [
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
        silenceLevel > 0 ifTrue: [
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
            silenceLevel := silenceLevel - 1
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
        ]
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    ].
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    ^ result.
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
!
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
isBroadcasting
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
    ^ silenceLevel = 0
12367
7edee6da9095 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12248
diff changeset
   106
!
7edee6da9095 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12248
diff changeset
   107
7edee6da9095 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12248
diff changeset
   108
noMoreNotificationsFor: aStakeHolder
7edee6da9095 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12248
diff changeset
   109
    "dummy for now "
7edee6da9095 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12248
diff changeset
   110
!
7edee6da9095 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12248
diff changeset
   111
20513
95bba45079d3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15422
diff changeset
   112
notify:aStakeHolder ofAllSystemChangesUsing:changeMessage
95bba45079d3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15422
diff changeset
   113
    "dummy for now "
95bba45079d3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15422
diff changeset
   114
!
95bba45079d3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15422
diff changeset
   115
12367
7edee6da9095 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12248
diff changeset
   116
notify:aStakeHolder ofSystemChangesOfItem:anItemSymbol change: changeTypeSymbol using: changeMessage
7edee6da9095 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12248
diff changeset
   117
    "dummy for now "
12221
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
! !
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
!SystemChangeNotifier class methodsFor:'documentation'!
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
version_CVS
20513
95bba45079d3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 15422
diff changeset
   123
    ^ '$Header$'
12221
5f71ad715ef8 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
! !
14862
beeba0f8b676 class: SystemChangeNotifier
Claus Gittinger <cg@exept.de>
parents: 12880
diff changeset
   125