SmallSense__ImplementorSearchProcessor.st
changeset 377 c686ea588575
parent 370 b02030d796d8
--- a/SmallSense__ImplementorSearchProcessor.st	Fri Jan 23 19:19:02 2015 +0100
+++ b/SmallSense__ImplementorSearchProcessor.st	Sat Jan 24 01:58:51 2015 +0000
@@ -50,6 +50,50 @@
 "
 ! !
 
+!ImplementorSearchProcessor methodsFor:'accessing'!
+
+canDoNextStepFor: aPO
+    "Return true if navigation can take a next step for given PO
+     (i.e., if user can 'dive in'), false otherwise.
+     To be overriden by subclasses to avoid excessive processor creation."
+
+    self assert: aPO class == MethodPO.
+    ^ aPO classes size > 1
+
+    "Created: / 23-01-2015 / 22:17:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+processorForNextStepFor: aPO
+    "Return a processor for next navigation step for given PO.
+     If nil is returned, then there's no next step (i.e.,
+     a user connot 'dive in')"
+
+    | selector |
+
+    self assert: aPO class == MethodPO.
+    aPO classes size == 1 ifTrue:[ ^ nil ].
+    selector := aPO selector.
+    ^ PluggableSearchProcessor 
+            search:
+                [ :pattern :filter :env :level | 
+
+                    ((aPO classes 
+                        select:[:cls | pattern isNil or:[ pattern match: cls nameWithoutNameSpacePrefix relax: level ] ])  
+                        asArray sort:[ :a :b | a nameWithoutNameSpacePrefix < b nameWithoutNameSpacePrefix ])
+                        collect:[ :cls | cls compiledMethodAt: selector ]
+
+                ]
+            presentation:             
+                [ :method | 
+                    PluggablePO new
+                        label: (method mclass nameWithoutNameSpacePrefix) , ((' >> ', selector) asText colorizeAllWith: Color gray darker);
+                        subject: method.                        
+                ].
+
+    "Created: / 23-01-2015 / 22:06:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-01-2015 / 00:44:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ImplementorSearchProcessor methodsFor:'accessing - presentation'!
 
 label