Tools__ClassList.st
branchjv
changeset 17132 17d361c666c2
parent 16869 2ecababdd4c0
parent 16885 6d217122d9dd
child 17136 cb908d2ba02e
--- a/Tools__ClassList.st	Wed Sep 28 07:09:57 2016 +0200
+++ b/Tools__ClassList.st	Mon Oct 03 15:15:56 2016 +0100
@@ -1329,7 +1329,7 @@
     privateClassesPerClass notEmpty ifTrue:[
         |stream action|
 
-        stream := WriteStream on:(Array new).
+        stream := WriteStream on:#().
 
         action := 
             [:eachClass |
@@ -1455,7 +1455,7 @@
     privateClassesPerClass notEmpty ifTrue:[
         |stream action|
 
-        stream := WriteStream on:(Array new).
+        stream := WriteStream on:#().
 
         action := [:eachClass |
                 |bucket|
@@ -1499,91 +1499,84 @@
 nameListForClasses:aClassList
     |orgMode namespaces showNamespaces fullNameList nameList
      filteredPackages filteredNameSpaces classesInRemoteChangeSet
-     classNamesInChangeSet classNamesInRemoteChangeSet javaClassCountsByBame  |
+     classNamesInChangeSet classNamesInRemoteChangeSet javaClassCountsByBname|
 
     showNamespaces := false.
+    filteredNameSpaces := nameSpaceFilter value.
+    orgMode := organizerMode value.
 
-    filteredNameSpaces := nameSpaceFilter value.
     (filteredNameSpaces isNil 
-    and:[self organizerMode value ~~ OrganizerCanvas organizerModeNamespace]) ifTrue:[
+     and:[orgMode ~~ OrganizerCanvas organizerModeNamespace]) ifTrue:[
         showNamespaces := true.       "/ if no filter, always show the namespace.
     ] ifFalse:[
-        (filteredNameSpaces size > 1 
-        or:[(filteredNameSpaces size > 0)
-            and:[filteredNameSpaces includes:(self class nameListEntryForALL)]]) ifTrue:[
+        (filteredNameSpaces size ~~ 0 
+         and:[(filteredNameSpaces size > 1)
+              or:[filteredNameSpaces includes:(self class nameListEntryForALL)]]) ifTrue:[
             showNamespaces := true
         ] ifFalse:[
             "/ if there are classes from multiple namespaces,
             "/ show the full name
-
             namespaces := IdentitySet new.
             fullNameList := OrderedCollection new.
 
-            aClassList
-                do:[:cls | |nm|
-                    nm := cls nameInBrowser.
-                    fullNameList add:nm.
-                    namespaces add:cls topNameSpace.
-                ].
-            showNamespaces := namespaces size > 1
+            aClassList do:[:eachClass | 
+                namespaces add:eachClass topNameSpace.
+                fullNameList add:eachClass nameInBrowser.
+            ].
+            showNamespaces := namespaces size > 1.
         ].
     ].
 
-    orgMode := organizerMode value.
     filteredPackages := packageFilter value value.
 
     classNamesInChangeSet := ChangeSet current changedClasses
                                 collect:[:each | each theNonMetaclass name].
-
     classesInRemoteChangeSet := SmallTeam isNil ifTrue:[#()] ifFalse:[ SmallTeam changedClasses ].
     classNamesInRemoteChangeSet := classesInRemoteChangeSet collect:[:each | each theNonMetaclass name].
 
-    javaClassCountsByBame := Dictionary new.
-    aClassList do:[:cls |
-        cls isJavaClass ifTrue:[
-            javaClassCountsByBame 
-                at: cls binaryName 
-                put: (javaClassCountsByBame at: cls ifAbsent:[0]) + 1
+    javaClassCountsByBname := Dictionary new.
+    aClassList do:[:eachClass |
+        eachClass isJavaClass ifTrue:[
+            javaClassCountsByBname
+                at:eachClass binaryName 
+                put:(javaClassCountsByBname at:eachClass ifAbsent:[0]) + 1
         ]
     ].
 
     nameList := aClassList 
-                    collect:[:cls | 
+                    collect:[:eachClass | 
+                            |className nm pkg emPkg hasExtensions 
+                             isInChangeSet isInRemoteChangeSet icon clr|
 
-                            |className nm pkg emPkg hasExtensions isInChangeSet isInRemoteChangeSet icon
-                             clr|
-
-                            className := cls theNonMetaclass name.
+                            className := eachClass theNonMetaclass name.
                             isInChangeSet := classNamesInChangeSet includes:className.
-                            "/ Java classes are never in changeset, so check their sourceString (if not nil, they has
-                            "/ been modified/edited. Kludgy...
-                            cls isJavaClass ifTrue:[ 
-                                isInChangeSet := cls sourceString notNil.
-                            ].
-
                             isInRemoteChangeSet := classNamesInRemoteChangeSet includes:className.
 
-                            nm := self nameListEntryFor:cls withNameSpace:showNamespaces.
-                            cls isJavaClass ifTrue:[
-                                (javaClassCountsByBame at: cls binaryName) > 1 ifTrue:[
+                            nm := self nameListEntryFor:eachClass withNameSpace:showNamespaces.
+
+                            eachClass isJavaClass ifTrue:[
+                                 "/ Java classes are never in changeset, so check their sourceString 
+                                 "/ (if not nil, they have been modified/edited. Kludgy...
+                                 isInChangeSet := eachClass sourceString notNil.
+                        
+                                 (javaClassCountsByBname at:eachClass binaryName) > 1 ifTrue:[
                                     | cl clstring |
 
-                                    cl := cls classLoader.
+                                    cl := eachClass classLoader.
                                     "/ Do not mark classes loaded by primordial, ext or system class loader...
                                     (cl notNil 
-                                        and:[JavaVM systemClassLoader isNil 
-                                                or:[cl ~~ JavaVM systemClassLoader 
-                                                        and:[cl ~~ (JavaVM systemClassLoader instVarNamed:#parent)]]]) 
-                                            ifTrue:[
-                                            clstring := ' [', cl displayString , ']'.
-                                            nm := nm , (clstring withColor: Color gray)
-                                    ]
-                                ]
+                                     and:[JavaVM systemClassLoader isNil 
+                                          or:[cl ~~ JavaVM systemClassLoader 
+                                              and:[cl ~~ (JavaVM systemClassLoader instVarNamed:#parent)]]]
+                                    ) ifTrue:[
+                                        clstring := ' [', cl displayString , ']'.
+                                        nm := nm , (clstring withColor:Color gray).
+                                    ].
+                                ].
                             ].
 
-
                             self showCoverageInformation value ifTrue:[
-                                clr := self colorForCoverageInformationOfClass:cls.
+                                clr := self colorForCoverageInformationOfClass:eachClass.
                                 clr notNil ifTrue:[
                                     nm := self colorize:nm with:#color -> clr
                                 ].
@@ -1596,16 +1589,21 @@
                                     nm := (self colorizeForChangedCodeInSmallTeam:'!! '),nm
                                 ].
                             ].
+                            nm isText ifTrue:[
+                                "in some fonts, bold spaces are larger than normal spaces.
+                                 remove emphasis from leading spaces"
+                                nm emphasisFrom:1 to:(nm leftIndent) remove:#bold.
+                            ].
 
-                            pkg := cls package ? '-'.
-                            hasExtensions := cls hasExtensions.
+                            pkg := eachClass package ? '-'.
+                            hasExtensions := eachClass hasExtensions.
                             hasExtensions ifTrue:[
                                 emPkg := self emphasizeForDifferentPackage:'+'. "/ self emphasizeForDifferentPackage:pkg.
                             ].
 
                             orgMode == OrganizerCanvas organizerModeProject ifTrue:[
                                 (filteredPackages notNil
-                                and:[(filteredPackages includes:cls package) not]) ifTrue:[
+                                and:[(filteredPackages includes:eachClass package) not]) ifTrue:[
                                     "/ class is in another packae;
                                     "/ however, class is listed due to methods
                                     "/ in the filtered package
@@ -1644,18 +1642,17 @@
                             isInChangeSet ifTrue:[
                                 nm := nm , self class markForBeingInChangeList
                             ].
-"/                                        cls isVisualStartable ifTrue:[
-"/                                            nm := LabelAndIcon icon:((SystemBrowser visualStartableClassIcon)
-"/                                                                    onDevice:self window device)
-"/                                                               string:nm
-"/                                        ].
-                            markApplicationsHolder value== true ifTrue:[
-                                icon := self iconForClass:cls theNonMetaclass.
+"/                          eachClass isVisualStartable ifTrue:[
+"/                              nm := LabelAndIcon icon:((SystemBrowser visualStartableClassIcon)
+"/                                                      onDevice:self window device)
+"/                                                 string:nm
+"/                          ].
+                            markApplicationsHolder value == true ifTrue:[
+                                icon := self iconForClass:eachClass theNonMetaclass.
                                 icon isNil ifTrue:[
                                     icon := SystemBrowser emptyIcon
                                 ].
                                 nm := LabelAndIcon icon:icon string:nm
-
                             ].
                             nm
                        ].   
@@ -1996,10 +1993,6 @@
         unloadedClassesColor notNil ifTrue:[
             nm := nm withColor:unloadedClassesColor
         ]
-    ].
-
-    aClass isLoaded ifFalse:[
-        "/ nm := nm,(' (?) ' colorizeAllWith:Color grey).
     ] ifTrue:[
         | instMethodCount classMethodCount |   
 
@@ -2008,7 +2001,7 @@
         classMethodCount := aClass class methodsCount.
 
         (instMethodCount notNil or:[ classMethodCount notNil ]) ifTrue:[ 
-            nm := nm,((' (%1+%2) ' bindWith:(instMethodCount ? '?') with:(classMethodCount ? '?')) 
+            nm := nm, ((' (%1+%2) ' bindWith:(instMethodCount ? '?') with:(classMethodCount ? '?')) 
                         withColor:self class pseudoEntryForegroundColor).
         ]
     ].
@@ -2054,8 +2047,7 @@
     "/ full name required if owner is not in the list
     owner := aClass owningClass.
     (owner isNil
-    or:[(self classList value includesIdentical:owner) not]) ifFalse:[
-
+     or:[(self classList value includesIdentical:owner) not]) ifFalse:[
         "/ namespace
         indent := (nm count:[:char | char == $:]) // 2.
         indent > 0 ifTrue:[
@@ -2076,33 +2068,30 @@
     "Modified: / 27-03-2015 / 16:23:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-nameListIndentStringFor:aClass withNameSpace:useFullName
-    | indent indentString cls |
+nameListIndentStringFor:aClass withNameSpace:useFullName 
+    |indent indentString cls|
 
     indent := 0.
     indentString := ''.
     cls := aClass superclass.
-    [self classList value includesIdentical:cls] 
-        whileTrue:
-            [indent := indent + 1.
-            cls := cls superclass].
-
+    [self classList value includesIdentical:cls] whileTrue:[
+        indent := indent + 1.
+        cls := cls superclass
+    ].
     indent == 0 ifFalse:[
         indent <= 5 ifTrue:[
-            indentString := #(
-                         ''
-                         '  '
-                         '    '
-                         '      '
-                         '        '
-                         '          '
-                       ) at:indent+1.
+            indentString := #( 
+                 ''
+                 '  '
+                 '    '
+                 '      '
+                 '        '
+                 '          ' ) at:indent + 1.
         ] ifFalse:[
-            indentString := String new:indent*2 withAll:Character space.
+            indentString := String new:indent * 2 withAll:Character space.
         ].
-
     ].
-    ^indentString
+    ^ indentString
 
     "Modified: / 24-02-2000 / 17:52:28 / cg"
     "Created: / 21-01-2008 / 19:02:07 / janfrog"