AbstractHierarchicalItem.st
changeset 6010 1d85c27462f6
parent 6009 f2aa69c0687d
child 6019 3f48805b8cac
--- a/AbstractHierarchicalItem.st	Mon Feb 18 18:38:46 2019 +0100
+++ b/AbstractHierarchicalItem.st	Wed Feb 20 00:24:38 2019 +0100
@@ -358,25 +358,27 @@
     self synchronized:[
         |index list|
 
-        (index := self listIndex) notNil ifTrue:[
-            "/ must set expand-flag to false, otherwise change notifications
-            "/ are raised during lazy auto creation (to the list).
-            self setExpanded:false.
-            list := self children.
-            list notEmptyOrNil ifTrue:[
-                self setExpanded:true. 
-                list := OrderedCollection new.
-                self addVisibleChildrenTo:list.
-                self model itemAddAll:list beforeIndex:(index + 1).
-            ].
-            index ~~ 0 ifTrue:[self hierarchyChanged].
-        ] ifFalse:[
-            self setExpanded:true
-        ]
+        self isExpanded ifFalse:[
+            (index := self listIndex) notNil ifTrue:[
+                "/ must set expand-flag to false, otherwise change notifications
+                "/ are raised during lazy auto creation (to the list).
+                self setExpanded:false.
+                list := self children.
+                list notEmptyOrNil ifTrue:[
+                    self setExpanded:true. 
+                    list := OrderedCollection new.
+                    self addVisibleChildrenTo:list.
+                    self model itemAddAll:list beforeIndex:(index + 1).
+                ].
+                index ~~ 0 ifTrue:[self hierarchyChanged].
+            ] ifFalse:[
+                self setExpanded:true
+            ]
+        ].
     ].
 
     "Modified: / 08-03-2018 / 21:06:13 / stefan"
-    "Modified: / 28-07-2018 / 15:47:47 / Claus Gittinger"
+    "Modified: / 20-02-2019 / 00:23:49 / Claus Gittinger"
 !
 
 expandLevels:numLevels