class: Tools::ViewTreeInspectorApplication
authorClaus Gittinger <cg@exept.de>
Mon, 01 Dec 2014 17:43:38 +0100
changeset 3168 894c517d8696
parent 3167 95025cd0fbce
child 3169 54d9e27b384d
class: Tools::ViewTreeInspectorApplication added: #doSelectNextElementStartingIn:forWhich: changed: #doSelectNextOfApplicationClass:startingIn: #doSelectNextOfClass:startingIn: eliminated duplicate code
Tools__ViewTreeApplication.st
--- a/Tools__ViewTreeApplication.st	Fri Nov 28 12:30:07 2014 +0100
+++ b/Tools__ViewTreeApplication.st	Mon Dec 01 17:43:38 2014 +0100
@@ -2051,7 +2051,7 @@
     ]
 !
 
-doSelectNextOfApplicationClass:aClass startingIn:anItem
+doSelectNextElementStartingIn:anItem forWhich:aBlock
     |startItem firstFound searchNext|
 
     startItem  := model last.
@@ -2062,7 +2062,7 @@
         el == startItem ifTrue:[
             searchNext := false
         ] ifFalse:[
-            (self resolveApplicationClassFor:el) == aClass ifTrue:[
+            (aBlock value:el) ifTrue:[
                 searchNext ifFalse:[^ model selectItem:el].
 
                 firstFound isNil ifTrue:[
@@ -2077,30 +2077,12 @@
     ].
 !
 
+doSelectNextOfApplicationClass:aClass startingIn:anItem
+    self doSelectNextElementStartingIn:anItem forWhich:[:el | (self resolveApplicationClassFor:el) == aClass].
+!
+
 doSelectNextOfClass:aClass startingIn:anItem
-    |startItem firstFound searchNext|
-
-    startItem  := model last.
-    searchNext := startItem notNil.        
-    firstFound := nil.
-
-    anItem recursiveDo:[:el|
-        el == startItem ifTrue:[
-            searchNext := false
-        ] ifFalse:[
-            el widget class == aClass ifTrue:[
-                searchNext ifFalse:[^ model selectItem:el].
-
-                firstFound isNil ifTrue:[
-                    firstFound := el
-                ]
-            ]
-        ]
-    ].
-    firstFound notNil ifTrue:[
-        self window beep.
-        model selectItem:firstFound
-    ].
+    self doSelectNextElementStartingIn:anItem forWhich:[:el | el widget class == aClass].
 !
 
 doUncatchEvents