DebugView.st
branchjv
changeset 12229 5c129972b1fd
parent 12205 f210b6224ef0
child 12262 d25ef6bb0ef3
--- a/DebugView.st	Wed Apr 11 17:14:22 2012 +0100
+++ b/DebugView.st	Fri Apr 13 14:15:47 2012 +0100
@@ -743,6 +743,16 @@
                   label: '-'
                 )
                (MenuItem
+                  enabled: canCloseAllDebuggers
+                  label: 'Close all Debuggers...'
+                  itemValue: closeAllDebuggers
+                  translateLabel: true
+                  isVisible: isNotInspecting
+                )
+               (MenuItem
+                  label: '-'
+                )
+               (MenuItem
                   label: 'Exit'
                   itemValue: closeRequest
                   translateLabel: true
@@ -1175,7 +1185,7 @@
         nil
       )
 
-    "Modified: / 19-03-2012 / 16:37:36 / cg"
+    "Modified: / 23-03-2012 / 12:52:50 / cg"
 ! !
 
 !DebugView class methodsFor:'misc'!
@@ -2382,12 +2392,23 @@
 destroy
     "closing the debugger implies an abort or continue"
 
+    self destroyWithConfirmation:true
+
+    "Modified: / 10-07-1997 / 17:15:41 / stefan"
+    "Modified: / 23-03-2012 / 12:50:01 / cg"
+!
+
+destroyWithConfirmation:withConfirmation
+    "closing the debugger implies an abort or continue"
+
     |m|
 
-    self checkIfCodeIsReallyModified ifTrue:[
-        (self confirm:('Code modified - exit anyway ?'))
-        ifFalse:[
-            ^ self
+    withConfirmation ifTrue:[
+        self checkIfCodeIsReallyModified ifTrue:[
+            (self confirm:('Code modified - exit anyway ?'))
+            ifFalse:[
+                ^ self
+            ]
         ]
     ].
 
@@ -2422,8 +2443,6 @@
         ].
         "/ We don't reach this point normally
         'DebugView [info]: OOPS - non regular debugView closing(2)' infoPrintCR.
-        Debugger newDebugger.
-        self uncacheMyself.
     ].
 
     Debugger newDebugger.
@@ -2431,8 +2450,8 @@
     self uncacheMyself.
     super destroy.
 
-    "Modified: / 10.7.1997 / 17:15:41 / stefan"
-    "Modified: / 16.11.2001 / 17:38:15 / cg"
+    "Modified: / 10-07-1997 / 17:15:41 / stefan"
+    "Created: / 23-03-2012 / 12:49:50 / cg"
 !
 
 initialize
@@ -3844,6 +3863,24 @@
     "Created: / 08-03-2012 / 01:29:46 / cg"
 !
 
+closeAllDebuggers
+    (Dialog confirm:'Close all Debuggers (without confirmation if code was changed)?')
+    ifFalse:[
+        ^ self
+    ].
+
+    self class allInstancesDo:[:debugger | 
+        debugger ~~ self ifTrue:[
+            debugger busy ifTrue:[
+                debugger destroyWithConfirmation:true.
+            ].
+        ].
+    ].
+    self closeRequest.
+
+    "Created: / 23-03-2012 / 12:40:22 / cg"
+!
+
 configureX:x y:y width:newWidth height:newHeight
     super configureX:x y:y width:newWidth height:newHeight.
     LastExtent := self extent.
@@ -4051,7 +4088,7 @@
 
 doDefine
     |selectionIndex selector argNames receiversClass proto haltStmtDef haltStmtFix code cat
-     bagOfClassNames bagOfUsedClassNames implClass idx callee restart|
+     bagOfClassNames bagOfUsedClassNames implClass idx callee restart varName argName|
 
     selectionIndex := contextView selection.
     restart := true.
@@ -4104,18 +4141,36 @@
 
     receiversClass := actualContext receiver class.
 
+    "/ code for a getter
     (receiversClass instVarNames includes:selector) ifTrue:[
         code := '%1\' , haltStmtFix , '\    ^ %2'.
         cat := 'accessing'.
     ].
+
+    "/ code for a setter
     (selector numArgs == 1
     and:[(selector endsWith:':')
     and:[receiversClass instVarNames includes:(selector copyWithoutLast:1)]])
     ifTrue:[
-        code := '%1\' , haltStmtFix , '\    %2 := arg.'.
+        varName := selector copyWithoutLast:1.
+        argName := argNames first.
+        code := '%1\' , haltStmtFix , '\    %3 := %4.'.
         cat := 'accessing'.
     ].
 
+    "/ code for a tester
+    (selector numArgs == 0
+    and:[(selector startsWith:'is')
+    and:[(Smalltalk classNamed:(selector copyFrom:3)) notNil ]])
+    ifTrue:[
+        (receiversClass nameWithoutPrefix = (selector copyFrom:3)) ifTrue:[
+            code := '%1\' , haltStmtFix , '\    ^ true.'.
+        ] ifFalse:[
+            code := '%1\' , haltStmtFix , '\    ^ false.'.
+        ].
+        cat := 'testing'.
+    ].
+
 "/    actualContext receiver isClass ifTrue:[
 "/        selector == #new ifTrue:[
 "/            code := '%1\' , haltStmt , '\    ^ self basicNew initialize'
@@ -4129,7 +4184,7 @@
     ].
 
     self
-        codeAccept:(code bindWith:proto with:selector) withCRs
+        codeAccept:(code bindWith:proto with:selector with:varName with:argName) withCRs
         inClass:receiversClass
         unwind:false
         category:cat
@@ -4140,7 +4195,7 @@
         self doRestart
     ]
 
-    "Modified: / 17-11-2001 / 23:43:54 / cg"
+    "Modified: / 23-03-2012 / 09:49:31 / cg"
     "Modified: / 31-01-2012 / 13:41:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
@@ -5589,6 +5644,17 @@
     ^ m notNil and:[m isEnabled:#browseReceiversClass]
 !
 
+canCloseAllDebuggers
+    self class allInstancesDo:[:debugger | 
+        debugger ~~ self ifTrue:[
+            debugger busy ifTrue:[^ true].
+        ]
+    ].
+    ^ false
+
+    "Created: / 23-03-2012 / 12:40:18 / cg"
+!
+
 canDefineMethod
     ^ defineButton isVisible
 !
@@ -7528,12 +7594,6 @@
 
 !DebugView::IgnoredHalt methodsFor:'accessing'!
 
-
-
-
-
-
-
 method
     |m|
 
@@ -7567,10 +7627,6 @@
     "Modified: / 08-05-2011 / 10:28:41 / cg"
 ! !
 
-!DebugView::IgnoredHalt methodsFor:'misc'!
-
- !
-
 !DebugView::IgnoredHalt methodsFor:'printing'!
 
 printOn:aStream
@@ -7590,8 +7646,6 @@
 
 !DebugView::IgnoredHalt methodsFor:'queries'!
 
-
-
 isActive
     "true if this ignore-entry is still active"
 
@@ -7610,8 +7664,6 @@
     "Modified: / 08-05-2011 / 10:27:31 / cg"
 !
 
-
-
 isHaltIgnoredInMethod:aMethod line:line
     "/ Transcript show:'?same as ign '; show:(weakMethodHolder at:1); show:' at '; showCR:lineNumber.
 
@@ -7657,15 +7709,15 @@
 !DebugView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.538 2012/03/19 16:41:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/DebugView.st,v 1.539 2012/03/23 11:54:22 cg Exp $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libtool/DebugView.st,v 1.538 2012/03/19 16:41:24 cg Exp §'
+    ^ '§Header: /cvs/stx/stx/libtool/DebugView.st,v 1.539 2012/03/23 11:54:22 cg Exp §'
 !
 
 version_SVN
-    ^ '$Id: DebugView.st 7952 2012-03-21 17:50:14Z vranyj1 $'
+    ^ '$Id: DebugView.st 7978 2012-04-13 13:15:47Z vranyj1 $'
 ! !
 
 DebugView initialize!