Tools__NewSystemBrowser.st
branchjv
changeset 12194 4639848e5517
parent 12178 185adeb21886
child 12205 f210b6224ef0
--- a/Tools__NewSystemBrowser.st	Sat Mar 17 13:13:35 2012 +0000
+++ b/Tools__NewSystemBrowser.st	Sat Mar 17 20:05:16 2012 +0000
@@ -48081,16 +48081,8 @@
 !
 
 showMethodsCode:mthd scrollToTop:doScrollToTop
-    |code codeView doAutoFormat doSyntaxColoring|
-
-    "/Do no coloring here if CodeView2 is used,
-    "/since CodeView2 itself cares about the coloring!!
-    "/Not working correctly -> do the coloring until fixed in CodeView2
-    "(UserPreferences current useCodeView2In: #Browser)"false ifTrue:[
-        doSyntaxColoring := false
-    ] ifFalse:[
-        doSyntaxColoring := self doSyntaxColoring value == true.
-    ].
+    |code codeView doAutoFormat doSyntaxColoring doUpdateCode prevMthd |
+
     doAutoFormat := self doAutoFormat value and:[RBFormatter notNil].
 
     codeView := self codeView.
@@ -48099,7 +48091,22 @@
     code := self sourceOfMethod:mthd.
     code isText ifTrue:[
         doSyntaxColoring := false.
-    ].
+    ] ifFalse:[
+        "/Do no coloring here if CodeView2 is used,
+        "/since CodeView2 itself cares about the coloring!!
+        "/Not working correctly -> do the coloring until fixed in CodeView2
+        "JV: Enable is, otherwise I won't notice that it does not work
+         correctly!!"
+        (UserPreferences current useCodeView2In: #Browser) ifTrue:[
+            doSyntaxColoring := code size < 2000
+        ] ifFalse:[
+            doSyntaxColoring := self doSyntaxColoring value == true.
+        ].
+    ].
+
+
+
+
 
     doAutoFormat ifTrue:[
         Error catch:[
@@ -48107,29 +48114,44 @@
         ].
     ].
 
-    doSyntaxColoring ifTrue:[
-        "/ immediate coloring, if code is not too large;
-        "/ otherwise, do it in the background.
-        code size < 2000 " 10000 " ifTrue:[
-            Error handle:[:ex |
-                Transcript showCR:'error in syntaxHighlighter: ',ex description.
-            ] do:[
-                code := self syntaxHighlightedCodeFor:code method:mthd.
-            ].
-        ] ifFalse:[
-            self enqueueDelayedStartSyntaxHighlightProcess.
-        ].
-
-        [
-            codeView modifiedChannel removeDependent:self.
-            codeView modified:false.
+    "Hack for Java methods: 'As whole class source coce is shown,
+     there is no need to set codeview's content if previous method
+     belonged to the same class. Code is already shown, we need only
+     to scrool to it..."
+    "hmm...hmm...how implement it in a better, more generic way?"
+    doUpdateCode := true.
+    mthd isJavaMethod ifTrue:[
+        prevMthd := navigationState lastMethodShownInCodeView.
+        (prevMthd notNil and:[prevMthd isJavaMethod]) ifTrue:[
+            doUpdateCode := mthd javaClass ~~ prevMthd javaClass
+        ].
+    ].
+    doUpdateCode ifTrue:[
+        doSyntaxColoring ifTrue:[
+            "/ immediate coloring, if code is not too large;
+            "/ otherwise, do it in the background.
+            code size < 2000 " 10000 " ifTrue:[
+                Error handle:[:ex |
+                    Transcript showCR:'error in syntaxHighlighter: ',ex description.
+                ] do:[
+                    code := self syntaxHighlightedCodeFor:code method:mthd.
+                ].
+            ] ifFalse:[
+                self enqueueDelayedStartSyntaxHighlightProcess.
+            ].
+
+            [
+                codeView modifiedChannel removeDependent:self.
+                codeView modified:false.
+                self showCode:code scrollToTop:doScrollToTop.
+            ] ensure:[
+                codeView modifiedChannel addDependent:self.
+            ]
+        ] ifFalse:[
             self showCode:code scrollToTop:doScrollToTop.
-        ] ensure:[
-            codeView modifiedChannel addDependent:self.
-        ]
-    ] ifFalse:[
-        self showCode:code scrollToTop:doScrollToTop.
-    ].
+        ].
+    ].
+    navigationState lastMethodShownInCodeView: mthd.
 
     "/ scroll, for file-based classes (java, ruby, etc.)
     mthd sourceLineNumber ~~ 1 ifTrue:[
@@ -48142,8 +48164,8 @@
     self updatePackageInfoForMethod:mthd.
 
     "Created: / 01-03-2000 / 11:38:57 / cg"
-    "Modified (format): / 29-07-2011 / 11:45:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 21-08-2011 / 08:54:33 / cg"
+    "Modified: / 17-03-2012 / 16:15:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 showNothing
@@ -55891,7 +55913,7 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Id: Tools__NewSystemBrowser.st 7923 2012-03-09 23:06:58Z vranyj1 $'
+    ^ '$Id: Tools__NewSystemBrowser.st 7940 2012-03-17 20:05:16Z vranyj1 $'
 !
 
 version_CVS
@@ -55899,7 +55921,7 @@
 !
 
 version_SVN
-    ^ '$Id: Tools__NewSystemBrowser.st 7923 2012-03-09 23:06:58Z vranyj1 $'
+    ^ '$Id: Tools__NewSystemBrowser.st 7940 2012-03-17 20:05:16Z vranyj1 $'
 ! !
 
 NewSystemBrowser initialize!