changed: #allWindowsMenu
authorClaus Gittinger <cg@exept.de>
Fri, 25 May 2012 14:49:31 +0200
changeset 11525 b70be5bf20d6
parent 11524 7abc3f3c2530
child 11526 46904b48f3a7
changed: #allWindowsMenu added close all like this function
NewLauncher.st
--- a/NewLauncher.st	Thu May 24 16:17:43 2012 +0200
+++ b/NewLauncher.st	Fri May 25 14:49:31 2012 +0200
@@ -4173,11 +4173,12 @@
 allWindowsMenu
     "returns a subMenu with one oeprations-submenu entry per open window"
 
-    |menu|
+    |menu allViewsAndLabels|
 
     menu := Menu new receiver: self.
-    (self allTopViewsAndLabelsSortedFilteringWindowGroups:nil) do:[:assoc |
-        |view label submenu|
+    allViewsAndLabels := self allTopViewsAndLabelsSortedFilteringWindowGroups:nil.
+    allViewsAndLabels do:[:assoc |
+        |view label submenu likeThis info|
 
         view := assoc value.
         label := assoc key.
@@ -4232,6 +4233,32 @@
                             value: [view destroy]; 
                             translateLabel: true).
 
+        likeThis :=
+            allViewsAndLabels 
+                select:[:assoc |
+                    |otherView|
+
+                    otherView := assoc value.
+                    otherView class == view class
+                        and:[ otherView application class == view application class]
+                ]
+                thenCollect:[:assoc | assoc value ].
+
+        likeThis size > 1 ifTrue:[
+            info := view application notNil 
+                        ifTrue:[ view application class name ]
+                        ifFalse:[ view class name ].
+            info := ' ("',info,'")'.
+        ] ifFalse:[
+            info := ''
+        ].
+
+        submenu addItem:(MenuItem new
+                            label: ('Close all like This%1' bindWith:info); 
+                            value: [likeThis do:[:eachView | eachView destroy]]; 
+                            translateLabel: true;
+                            enabled:(likeThis size > 1)).
+
         menu addItem:(MenuItem new
                             label: label;                
                             submenu: submenu; 
@@ -4967,11 +4994,11 @@
 !NewLauncher class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.433 2012-05-02 12:29:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.434 2012-05-25 12:49:31 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.433 2012-05-02 12:29:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.434 2012-05-25 12:49:31 cg Exp $'
 !
 
 version_SVN