'From Cuis 1.0 of 4 September 2009 [latest update: #290] on 28 September 2009 at 9:57:53 am'!
!classDefinition: #ActiveModel category: #'Kernel-Objects'!
Object subclass: #ActiveModel
	instanceVariableNames: 'actionMap'
	classVariableNames: 'ActionMaps'
	poolDictionaries: ''
	category: 'Kernel-Objects'!
!classDefinition: #SystemChangeNotifier category: #'System-Change Notification'!
ActiveModel subclass: #SystemChangeNotifier
	instanceVariableNames: 'eventSource silenceLevel '
	classVariableNames: 'UniqueInstance '
	poolDictionaries: ''
	category: 'System-Change Notification'!

!ChangeSet class methodsFor: 'current changeset' stamp: 'jmv 9/28/2009 09:55'!
newChanges: aChangeSet
	"Set the system ChangeSet to be the argument, aChangeSet.  Tell the current project that aChangeSet is now its change set.  When called from Project enter:, the setChangeSet: call is redundant but harmless; when called from code that changes the current-change-set from within a project, it's vital"

	SystemChangeNotifier uniqueInstance removeActionsWithReceiver: current.
	current isolationSet: nil.
	current _ aChangeSet.
	SystemChangeNotifier uniqueInstance notify: aChangeSet ofAllSystemChangesUsing: #event:! !


!SystemChangeNotifier methodsFor: 'initialize' stamp: 'jmv 9/28/2009 09:52'!
initialize

	silenceLevel _ 0! !

!SystemChangeNotifier methodsFor: 'private' stamp: 'jmv 9/28/2009 09:52'!
notify: anObject ofEvents: eventsCollection using: oneArgumentSelector
	"Notifies an object of any events in the eventsCollection. Send it back a message #oneArgumentSelector, with as argument the particular system event instance."

	eventsCollection do: [ :eachEvent |
		self when: eachEvent send: oneArgumentSelector to: anObject]! !

!SystemChangeNotifier methodsFor: 'private' stamp: 'jmv 9/28/2009 09:52'!
trigger: event

	self isBroadcasting ifTrue: [ event trigger: self ]

"	| caughtExceptions |
	caughtExceptions := OrderedCollection new.
	self isBroadcasting ifTrue: [
		[(eventSource actionForEvent: event eventSelector) valueWithArguments: (Array with: event)] on: Exception do: [:exc | caughtExceptions add: exc]].
	caughtExceptions do: [:exc | exc resignalAs: exc class new]"! !

!SystemChangeNotifier methodsFor: 'events-accessing' stamp: 'jmv 9/28/2009 09:49'!
actionSequenceForEvent: anEventSelector

	^self actionMap
		ifNotNil: [ :map |
			(map
				at: anEventSelector asSymbol
				ifAbsent: [ WeakActionSequenceTrappingErrors new ])
					asActionSequenceTrappingErrors ]
		ifNil: [ WeakActionSequenceTrappingErrors new ]! !


!SystemChangeNotifier class methodsFor: 'private' stamp: 'jmv 9/28/2009 10:32'!
resetUniqueInstance
	"
	SystemChangeNotifier resetUniqueInstance
	"

	UniqueInstance
		ifNotNil: [ :u | 
			UniqueInstance releaseActionMap.
			UniqueInstance _ nil].

	self uniqueInstance notify: Smalltalk ofAllSystemChangesUsing: #event:.
	self uniqueInstance notify: Utilities ofAllSystemChangesUsing: #event:.
	self uniqueInstance notify: ChangeSet current ofAllSystemChangesUsing: #event:! !

SystemChangeNotifier removeSelector: #releaseAll!
SystemChangeNotifier removeSelector: #noMoreNotificationsFor:!
!classDefinition: #SystemChangeNotifier category: #'System-Change Notification'!
ActiveModel subclass: #SystemChangeNotifier
	instanceVariableNames: 'silenceLevel'
	classVariableNames: 'UniqueInstance'
	poolDictionaries: ''
	category: 'System-Change Notification'!

!SystemChangeNotifier reorganize!
('initialize' initialize)
('private' notify:ofEvents:using: releaseAll setBroadcasting trigger:)
('private-event lists' allSystemEvents systemEventsForChange: systemEventsForItem: systemEventsForItem:change:)
('system triggers' class:recategorizedFrom:to: classAdded:inCategory: classCommented: classCommented:inCategory: classDefinitionChangedFrom:to: classRemoved:fromCategory: classRenamed:from:to:inCategory: classReorganized: evaluated: evaluated:context: methodAdded:selector:inClass: methodAdded:selector:inClass:requestor: methodAdded:selector:inProtocol:class: methodAdded:selector:inProtocol:class:requestor: methodChangedFrom:to:selector:inClass: methodChangedFrom:to:selector:inClass:requestor: methodRemoved:selector:class: methodRemoved:selector:inProtocol:class: selector:recategorizedFrom:to:inClass:)
('public' doSilently: isBroadcasting notify:ofAllSystemChangesUsing: notify:ofSystemChangesOfChange:using: notify:ofSystemChangesOfItem:change:using: notify:ofSystemChangesOfItem:using:)
('events-accessing' actionSequenceForEvent:)
!

Smalltalk removeClassNamed: #SystemEventManager!
"Postscript:
Leave the line above, and replace the rest of this comment by a useful one.
Executable statements should follow this comment, and should
be separated by periods, with no exclamation points (!!).
Be sure to put any further comments in double-quotes, like this one."
SystemChangeNotifier resetUniqueInstance!

