SelectionInTree.st
changeset 491 c7d57a5e7a21
parent 482 7f922ead2b06
child 496 d511fde77222
--- a/SelectionInTree.st	Mon Aug 11 13:01:26 1997 +0200
+++ b/SelectionInTree.st	Mon Aug 11 13:02:03 1997 +0200
@@ -71,6 +71,25 @@
 root:aRootNode
     "set a new root and recompute list
     "
+    self root:aRootNode keepRoot:false
+
+!
+
+root:aRootNode keepRoot:keepRoot
+    "set a new root and recompute list
+    "
+    |idx children|
+
+    (keepRoot and:[root notNil]) ifTrue:[
+        children := aRootNode children.
+
+        idx := children findFirst:[:el| el name = root name ].
+
+        idx ~~ 0 ifTrue:[
+            root parent:aRootNode.
+            children at:idx put:root.
+        ].
+    ].
     root := aRootNode.
     self recomputeList.
 ! !
@@ -271,5 +290,5 @@
 !SelectionInTree class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTree.st,v 1.2 1997-08-05 06:34:47 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInTree.st,v 1.3 1997-08-11 11:02:03 ca Exp $'
 ! !