class: Tools::ViewTreeInspectorApplication
authorClaus Gittinger <cg@exept.de>
Mon, 01 Dec 2014 17:43:38 +0100
changeset 3168894c517d8696
parent 3167 95025cd0fbce
child 3169 54d9e27b384d
class: Tools::ViewTreeInspectorApplication
added: #doSelectNextElementStartingIn:forWhich:
changed:
#doSelectNextOfApplicationClass:startingIn:
#doSelectNextOfClass:startingIn:

eliminated duplicate code
Tools__ViewTreeApplication.st
     1.1 --- a/Tools__ViewTreeApplication.st	Fri Nov 28 12:30:07 2014 +0100
     1.2 +++ b/Tools__ViewTreeApplication.st	Mon Dec 01 17:43:38 2014 +0100
     1.3 @@ -2051,7 +2051,7 @@
     1.4      ]
     1.5  !
     1.6  
     1.7 -doSelectNextOfApplicationClass:aClass startingIn:anItem
     1.8 +doSelectNextElementStartingIn:anItem forWhich:aBlock
     1.9      |startItem firstFound searchNext|
    1.10  
    1.11      startItem  := model last.
    1.12 @@ -2062,7 +2062,7 @@
    1.13          el == startItem ifTrue:[
    1.14              searchNext := false
    1.15          ] ifFalse:[
    1.16 -            (self resolveApplicationClassFor:el) == aClass ifTrue:[
    1.17 +            (aBlock value:el) ifTrue:[
    1.18                  searchNext ifFalse:[^ model selectItem:el].
    1.19  
    1.20                  firstFound isNil ifTrue:[
    1.21 @@ -2077,30 +2077,12 @@
    1.22      ].
    1.23  !
    1.24  
    1.25 +doSelectNextOfApplicationClass:aClass startingIn:anItem
    1.26 +    self doSelectNextElementStartingIn:anItem forWhich:[:el | (self resolveApplicationClassFor:el) == aClass].
    1.27 +!
    1.28 +
    1.29  doSelectNextOfClass:aClass startingIn:anItem
    1.30 -    |startItem firstFound searchNext|
    1.31 -
    1.32 -    startItem  := model last.
    1.33 -    searchNext := startItem notNil.        
    1.34 -    firstFound := nil.
    1.35 -
    1.36 -    anItem recursiveDo:[:el|
    1.37 -        el == startItem ifTrue:[
    1.38 -            searchNext := false
    1.39 -        ] ifFalse:[
    1.40 -            el widget class == aClass ifTrue:[
    1.41 -                searchNext ifFalse:[^ model selectItem:el].
    1.42 -
    1.43 -                firstFound isNil ifTrue:[
    1.44 -                    firstFound := el
    1.45 -                ]
    1.46 -            ]
    1.47 -        ]
    1.48 -    ].
    1.49 -    firstFound notNil ifTrue:[
    1.50 -        self window beep.
    1.51 -        model selectItem:firstFound
    1.52 -    ].
    1.53 +    self doSelectNextElementStartingIn:anItem forWhich:[:el | el widget class == aClass].
    1.54  !
    1.55  
    1.56  doUncatchEvents