DebugView.st
changeset 18282 c9d7d76d5a75
parent 18277 399f3e795ddb
child 18300 5bfb159a26fa
--- a/DebugView.st	Mon Jul 23 14:06:01 2018 +0200
+++ b/DebugView.st	Tue Jul 24 23:15:35 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
@@ -1185,6 +1187,11 @@
             itemValue: findHandlerFor
           )
          (MenuItem
+            enabled: hasContextSelected
+            label: 'Find Active Handler...'
+            itemValue: findActiveHandler
+          )
+         (MenuItem
             label: 'Find Dialog Opener...'
             itemValue: doGotoDialogOpener
           )
@@ -1209,6 +1216,7 @@
       )
 
     "Modified: / 15-03-2017 / 14:21:07 / cg"
+    "Modified: / 24-07-2018 / 22:37:59 / Claus Gittinger"
 !
 
 fileMenuSpec
@@ -5926,6 +5934,44 @@
     OperatingSystem exit:10
 !
 
+findActiveHandler
+    "find out active handlers, let user choose one of them,
+     and select the context"
+     
+    |con handledExceptionsAndContexts|
+
+    handledExceptionsAndContexts := OrderedDictionary new.
+    (con := self selectedContext) isNil ifTrue:[
+        con := contextArray at:1
+    ].
+    [con notNil] whileTrue:[
+        con isHandleContext ifTrue:[
+            (con selector startsWith:'on:') ifTrue:[
+                handledExceptionsAndContexts at:(con argAt:1) ifAbsentPut:con
+            ].    
+            (con selector = 'handle:do:') ifTrue:[
+                handledExceptionsAndContexts at:(con receiver) ifAbsentPut:con
+            ].    
+        ].
+        con := con sender.
+    ].    
+        
+    con := Dialog
+                choose:'Exceptions handled in call chain:'
+                fromList:(handledExceptionsAndContexts 
+                            keysAndValuesCollect:[:ex :con | ex printString])
+                values:(handledExceptionsAndContexts           
+                            keysAndValuesCollect:[:ex :con | con])
+                lines:25
+                title:'Choose handled Exception class'.
+    handledExceptionsAndContexts := nil.
+    con isNil ifTrue:[^ self].
+
+    self selectContext:con.
+
+    "Created: / 24-07-2018 / 23:00:24 / Claus Gittinger"
+!
+
 findContextForWhich:aBlock thenDo:additionalAction
     |con|
 
@@ -5977,6 +6023,9 @@
 !
 
 findHandlerFor
+    "let user choose an exception class;
+     find and select the handling context for it"
+     
     |exClass con|
 
     (con := self selectedContext) isNil ifTrue:[
@@ -6002,6 +6051,8 @@
         thenDo:[:con |
             self selectContext:con sender.
         ]
+
+    "Modified (comment): / 24-07-2018 / 22:39:12 / Claus Gittinger"
 !
 
 findHomeContext
@@ -7774,7 +7825,7 @@
                 ]
             ].
 
-            s := Text streamContents:[:s | aContext printWithSeparator:' » ' on:s ].
+            s := Text streamContents:[:s | aContext printWithSeparator:' » ' on:s ].
             "/ s infoPrintCR.
             RememberedCallChain notNil ifTrue:[
                 (RememberedCallChain includesIdentical:aContext) ifTrue:[
@@ -9962,7 +10013,7 @@
 
 printConditionOn:aStream
     ignoredSendingClassAndSelectors notEmptyOrNil ifTrue:[
-        aStream nextPutAll:(' if called from %1 » %2'
+        aStream nextPutAll:(' if called from %1 » %2'
                                 bindWith:ignoredSendingClassAndSelectors first first
                                 with:ignoredSendingClassAndSelectors first second).
         ^ self.