Tools_NamespaceList.st
changeset 8757 43e349ffe3ef
parent 8696 2947b40f0218
child 8764 e79f1730c32e
--- a/Tools_NamespaceList.st	Tue Sep 22 13:25:19 2009 +0200
+++ b/Tools_NamespaceList.st	Tue Sep 22 13:25:43 2009 +0200
@@ -334,7 +334,7 @@
 makeGenerator
     "return a generator which enumerates the classes from the selected namespace(s)."
 
-    |spaceNames hideUnloadedClasses showAllClasses|
+    |spaceNames hideUnloadedClasses showAllClasses showChangedClasses|
 
     spaceNames := self selectedNamespaces value.
     spaceNames size == 0 ifTrue:[
@@ -343,13 +343,14 @@
 
     hideUnloadedClasses := self hideUnloadedClasses value.
     showAllClasses := self showAllClassesInNameSpaceOrganisation value.
+    showChangedClasses := spaceNames includes:(self class nameListEntryForChanged).
 
     (showAllClasses or:[spaceNames includes:(self class nameListEntryForALL)]) ifTrue:[
         hideUnloadedClasses ifTrue:[
             ^ Iterator on:[:whatToDo |
                                Smalltalk allClassesDo:[:cls |
                                    cls isLoaded ifTrue:[
-                                       cls isNameSpace ifFalse:[
+                                       cls isRealNameSpace ifFalse:[
                                            whatToDo value:cls
                                        ]
                                    ]
@@ -363,8 +364,7 @@
 
     (spaceNames size == 1 
      and:[spaceNames first = 'Smalltalk']) ifTrue:[
-        "/ somewhat tuned - quick look if classes name
-        "/ includes colons ...
+        "/ somewhat tuned - quick look if classes name includes colons ...
         ^ Iterator on:[:whatToDo |
                        Smalltalk allClassesDo:[:cls |
                            |includeIt|
@@ -392,7 +392,7 @@
                                            ].
 
                            includeIt ifTrue:[
-                               cls isNameSpace ifFalse:[
+                               cls isRealNameSpace ifFalse:[
                                    whatToDo value:cls
                                ]
                            ]
@@ -401,24 +401,32 @@
     ].
 
     ^ Iterator on:[:whatToDo |
-                       Smalltalk allClassesDo:[:cls |
-                           |spaceOfClass spaceNameOfClass includeIt|
+                       |changedClasses|
+
+                        showChangedClasses ifTrue:[ changedClasses := ChangeSet current changedClasses collect:[:cls | cls theNonMetaclass]].
 
-                           spaceOfClass := cls isPrivate ifTrue:[cls topOwningClass nameSpace] ifFalse:[cls nameSpace].
-                           spaceNameOfClass := spaceOfClass name.
+                        Smalltalk allClassesDo:[:cls |
+                            |spaceOfClass spaceNameOfClass includeIt|
 
-                           includeIt := spaceNames contains:[:nm | nm = spaceNameOfClass
-                                                                   or:[spaceNameOfClass startsWith:(nm , '::')]].
+                            spaceOfClass := cls isPrivate ifTrue:[cls topOwningClass nameSpace] ifFalse:[cls nameSpace].
+                            spaceNameOfClass := spaceOfClass name.
 
-                           hideUnloadedClasses ifTrue:[
-                               includeIt := includeIt and:[cls isLoaded].
-                           ].
-                           includeIt ifTrue:[
-                               cls isNameSpace ifFalse:[
-                                   whatToDo value:cls
-                               ]
-                           ]
-                       ]
+                            includeIt := spaceNames contains:[:nm | nm = spaceNameOfClass
+                                                                    or:[spaceNameOfClass startsWith:(nm , '::')]].
+                            includeIt ifFalse:[
+                                (showChangedClasses and:[ (changedClasses includes:cls theNonMetaclass) ]) ifTrue:[
+                                    includeIt := true
+                                ].
+                            ].
+                            hideUnloadedClasses ifTrue:[
+                                includeIt := includeIt and:[cls isLoaded].
+                            ].
+                            includeIt ifTrue:[
+                                cls isRealNameSpace ifFalse:[
+                                    whatToDo value:cls
+                                ]
+                            ]
+                        ]
                   ]
 
     "Created: / 18-02-2000 / 01:01:58 / cg"
@@ -443,9 +451,11 @@
 !
 
 listOfNamespaces
-    |allNamespaces showAllNamespaces generator|
+    |allNamespaces showAllNamespaces generator numClassesInChangeSet|
 
-showAllNamespaces := false.
+    showAllNamespaces := false.    "/ only topLevel namespaces are shown
+    "/ showAllNamespaces := true.
+
     allNamespaces := IdentitySet new.
 
     inGeneratorHolder isNil ifTrue:[
@@ -477,6 +487,13 @@
     allNamespaces size == 1 ifTrue:[
         self nameSpaceLabelHolder value:(LabelAndIcon icon:(self class nameSpaceIcon) string:allNamespaces first).
     ].
+
+    numClassesInChangeSet := ChangeSet current changedClasses size.
+    numClassesInChangeSet > 0 ifTrue:[
+        "/ dont include count - makeGenerator compares against the un-expanded nameListEntry (sigh - need two lists)
+        allNamespaces addFirst:((self class nameListEntryForChanged "bindWith:numClassesInChangeSet") allItalic).
+    ].
+
     allNamespaces addFirst:(self class nameListEntryForALL asText allItalic).
     ^ allNamespaces
 
@@ -526,5 +543,5 @@
 !NamespaceList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_NamespaceList.st,v 1.12 2009-09-14 18:16:17 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_NamespaceList.st,v 1.13 2009-09-22 11:25:43 cg Exp $'
 ! !