InspectorView.st
branchjv
changeset 13250 0decde6c459d
parent 13180 64a4186ddfce
parent 13185 a682a29bb651
child 13289 cc75e3cd0362
--- a/InspectorView.st	Tue Jul 23 20:55:42 2013 +0100
+++ b/InspectorView.st	Wed Jul 24 11:15:26 2013 +0100
@@ -1323,6 +1323,7 @@
                        ('Full Protocol'                #protocolMenu           )
                        ('-')
                        ('Trap Message...'              #doTrap                 )
+                       ('Trap Update Messages...'      #doTrapUpdates          )
                        ('Trap all Messages'            #doTrapAll              )
                        ('Trace all Messages'           #doTraceAll             )
                        ('Untrace/Untrap'               #doUntrace              )
@@ -1413,7 +1414,7 @@
 
     ^ m
 
-    "Modified: / 20-07-2012 / 10:50:45 / cg"
+    "Modified: / 16-07-2013 / 19:56:54 / cg"
 !
 
 localProtocolMenu
@@ -1902,6 +1903,59 @@
     ]
 !
 
+doTrapUpdates
+    "place a trap on all update and XXXChanged messages sent to the inspected object"
+
+    |selectors|
+
+    selectors := IdentitySet new.
+
+    "/ find all dependencies which lead to a message to this object
+    "/ (also look for onChangeSend: and onChangeEvaluate: dependencies)
+    InterestConverter allInstances do:[:i |
+        |dest mthd messages|
+
+        dest := i destination.
+        (dest == object) ifTrue:[
+            selectors add:(i selector)
+        ] ifFalse:[
+            (dest isBlock 
+            and:[ (dest methodHome receiver == object)
+            and:[ (mthd := dest methodHome method) notNil ]]) ifTrue:[   
+                "/ vague
+                messages := mthd messagesSent.
+                messages := messages select:[:sel | object class implements:sel].
+                selectors addAll:messages.
+            ].
+        ]
+    ].
+    #(update:
+      update:with:
+      update:with:from:)
+    do:[:each |
+        (object class implements:each) ifTrue:[
+            selectors add:each.
+        ]
+    ].
+
+    InterestConverter allInstances 
+        select:[:i | i destination isMessage
+                     and:[i class == MessageSend
+                     and:[i selector == #value
+                     and:[i receiver == object ]]]]
+        thenDo:[:i | selectors add:(i selector)].
+
+    (Dialog 
+        confirm:('About to place an instance trap on the following selectors:\\' withCRs
+                    , (selectors asOrderedCollection sort asStringWith:'\' withCRs)))
+        ifFalse:[ ^ self].
+
+    self topView withWaitCursorDo:[MessageTracer trap:object 
+                                                 selectors:selectors]
+
+    "Created: / 16-07-2013 / 19:56:08 / cg"
+!
+
 doUncatchChanges
     |sel|
 
@@ -3531,11 +3585,11 @@
 !InspectorView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/InspectorView.st,v 1.318 2013-07-08 09:51:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/InspectorView.st,v 1.319 2013-07-16 18:01:20 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/InspectorView.st,v 1.318 2013-07-08 09:51:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/InspectorView.st,v 1.319 2013-07-16 18:01:20 cg Exp $'
 !
 
 version_HG