GDBEventSubscription.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 25 Feb 2019 17:55:20 +0000
changeset 177 e7bd05df3d6b
parent 176 e734c17e7c37
child 244 f0e4ddb50242
permissions -rw-r--r--
Introduce new internal API `GDBDebuggerObject >> updateFrom:` to update one ("old") object with another one ("new"). This is used in cases when we want to preserve an identity of API objects.

"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
"
"{ Package: 'jv:libgdbs' }"

"{ NameSpace: Smalltalk }"

StrongSubscription subclass:#GDBEventSubscription
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'GDB-Private'
!

!GDBEventSubscription class methodsFor:'documentation'!

copyright
"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
"
! !

!GDBEventSubscription class methodsFor:'private'!

blockFor: anObject withSelector: aSelector

    | args |
    args := aSelector numArgs.      

    anObject isView ifTrue:[ 
        args = 0 ifTrue: [ ^[ anObject pushEvent: aSelector ] ].
        args = 1 ifTrue: [ ^[ :anAnnouncement | anObject pushEvent: aSelector with: anAnnouncement ] ].
        args = 2 ifTrue: [ ^[ :anAnnouncement :anAnnouncer | anObject pushEvent: aSelector with: anAnnouncement with: anAnnouncer ] ].
        self error: 'Couldn''t create block'.        
    ].

    "/ If the observer (receiver of events) is an application,
    "/ then push the event processing to application's event
    "/ queue. This avoids blocking of event dispatcher and ensures
    "/ that UI is synchronized.
    "/
    "/ However, we must be carefull since application windows may 
    "/ not yet be opened or fully initialized so we have to check
    "/ for existence of sensor. If application/window is not fully 
    "/ initialized, process the event as usual.
    (anObject isKindOf: ApplicationModel) ifTrue:[
        args = 0 ifTrue: [  ^[ anObject enqueueMessage: aSelector ] ].
        args = 1 ifTrue: [  ^[ :anAnnouncement | anObject enqueueMessage: aSelector with: anAnnouncement ] ].
        args = 1 ifTrue: [  ^[ :anAnnouncement :anAnnouncer | anObject enqueueMessage: aSelector arguments: (Array with: anAnnouncement with: anAnnouncer) ] ].
        self error: 'Couldn''t create block'.        
    ].
    ^ super blockFor: anObject withSelector: aSelector

    "Created: / 18-09-2014 / 00:10:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 01-10-2018 / 17:30:56 / jv"
    "Modified: / 18-02-2019 / 10:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GDBEventSubscription class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !