class: Tools::VariableList
authorClaus Gittinger <cg@exept.de>
Tue, 27 Aug 2013 14:57:33 +0200
changeset 13382 0ade5325ad8c
parent 13381 1fd78da0cf17
child 13383 f51ed270aca2
class: Tools::VariableList changed: #listEntryForClass:name: #listEntryForClass:name:info: when sorting by name, it is a good idea to show the class
Tools__VariableList.st
--- a/Tools__VariableList.st	Tue Aug 27 14:21:57 2013 +0200
+++ b/Tools__VariableList.st	Tue Aug 27 14:57:33 2013 +0200
@@ -22,7 +22,7 @@
 !
 
 Object subclass:#VariableEntry
-	instanceVariableNames:'label application class name type icon'
+	instanceVariableNames:'label application class name type icon sortingByNameHolder'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:VariableList
@@ -505,7 +505,11 @@
                             hasSpecEntry := true]].
                 showWarningAboutMissingEntryInXmlSpec := hasSpecEntry not].    "
 
-    ^VariableEntry application: self class: cls name: name
+    |entry|
+
+    entry := VariableEntry application: self class: cls name: name.
+    entry sortingByNameHolder:sortVariablesByName.
+    ^ entry
 
     "Created: / 12-04-2011 / 15:41:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 12-04-2011 / 21:36:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -517,6 +521,7 @@
 
     nm := name.
     entry := Tools::VariableList::VariableEntry application: self class: cls name: nm.
+    entry sortingByNameHolder:sortVariablesByName.
     classInfo notNil ifTrue:[
         entry type: (classInfo infoForInstvarOrNil: name).
     ].
@@ -775,13 +780,23 @@
         label := name.
         type notNil ifTrue:[
             label := (label , ' ' ,  (type displayString colorizeAllWith: Color brown)) 
-        ]
+        ].
     ].
     ^label
 
     "Created: / 16-12-2011 / 00:54:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+labelWithClass
+    |l|
+
+    l := self label.
+    class notNil ifTrue:[
+        ^ label,' (' ,(class nameWithoutPrefix colorizeAllWith: Color grey),')' 
+    ].
+    ^label
+!
+
 name
     ^ name
 !
@@ -790,6 +805,10 @@
     name := aString.
 !
 
+sortingByNameHolder:something
+    sortingByNameHolder := something.
+!
+
 string
 
     ^name
@@ -816,13 +835,18 @@
 !VariableList::VariableEntry methodsFor:'displaying'!
 
 displayOn:aGC x:x y:y opaque: opaque
+    | icn shownLabel |
 
-    | icn |
     icn := self icon.
     icn ~~ #NOICON ifTrue:[
         icn displayOn:aGC x:x + 1 y:y - icn height.
     ].
-    ^self label displayOn:aGC x:x + 20 y:y opaque: opaque
+
+    shownLabel := sortingByNameHolder value 
+                    ifTrue:[ self labelWithClass ]
+                    ifFalse: [ self label ].
+
+    shownLabel displayOn:aGC x:x + 20 y:y opaque: opaque
 
     "Created: / 12-04-2011 / 15:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
@@ -840,6 +864,6 @@
 !VariableList class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__VariableList.st,v 1.21 2013-07-10 12:04:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__VariableList.st,v 1.22 2013-08-27 12:57:33 cg Exp $'
 ! !