Fix in code navigation for Java: correctly handle fully qualified name references in the code.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 07 Aug 2014 01:44:51 +0100
changeset 265 e3a961d1825a
parent 264 c9e4dc3cf39c
child 266 548a8c5063e2
Fix in code navigation for Java: correctly handle fully qualified name references in the code.
SmallSense__CodeNavigationService.st
--- a/SmallSense__CodeNavigationService.st	Thu Aug 07 01:44:06 2014 +0100
+++ b/SmallSense__CodeNavigationService.st	Thu Aug 07 01:44:51 2014 +0100
@@ -261,14 +261,22 @@
     classType notNil ifTrue:[
         className := node resolvedType leafComponentType compoundName asStringWith: $/.
     ] ifFalse:[ 
-        | unit |
+        | unit typeName |
 
         unit := service codeView syntaxElements tree.
-        "/ Search imports...
-        unit imports do:[:import | 
-            import tokens last = node token ifTrue:[ 
-                className := import tokens asStringWith:$/.
+        typeName := node getTypeName. "/ returns char[][]
+        typeName size == 1 ifTrue:[
+            "/ Search imports...
+            unit imports do:[:import | 
+                | importedName typeName |
+
+                importedName := import getImportName. "/ returns char[][].                                
+                importedName last = typeName last ifTrue:[ 
+                    className := import tokens asStringWith:$/.
+                ].
             ].
+        ] ifFalse:[ 
+            className := typeName asStringWith: $/.
         ].
         "/ If not imported, Try compilation unit's package...
         className isNil ifTrue:[ 
@@ -291,7 +299,7 @@
     self halt: 'Not yet supported'.
 
     "Created: / 24-09-2013 / 10:16:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 15-02-2014 / 23:27:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 06-08-2014 / 15:17:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !CodeNavigationService::Navigator methodsFor:'navigation - Smalltalk'!