MCPcopy Create free account
hub / github.com/cogentcore/core / addTreeNodes

Method addTreeNodes

core/treesync.go:155–173  ·  view source on GitHub ↗
(rel, myidx int, typ *types.Type, n int)

Source from the content-addressed store, hash-verified

153}
154
155func (tr *Tree) addTreeNodes(rel, myidx int, typ *types.Type, n int) {
156 var stv *Tree
157 for i := 0; i < n; i++ {
158 nn := tree.NewOfType(typ)
159 tr.InsertChild(nn, myidx+i)
160 nn.AsTree().SetName(fmt.Sprintf("new-%v-%v", typ.IDName, myidx+rel+i))
161 ntv := AsTree(nn)
162 ntv.Update()
163 if i == n-1 {
164 stv = ntv
165 }
166 }
167 tr.Update()
168 tr.Open()
169 tr.treeChanged(nil)
170 if stv != nil {
171 stv.SelectEvent(events.SelectOne)
172 }
173}
174
175func (tr *Tree) addSyncNodes(rel, myidx int, typ *types.Type, n int) {
176 parent := tr.SyncNode

Callers 2

AddChildNodeMethod · 0.95
insertAtMethod · 0.80

Calls 9

OpenMethod · 0.95
treeChangedMethod · 0.95
SelectEventMethod · 0.95
NewOfTypeFunction · 0.92
AsTreeFunction · 0.85
InsertChildMethod · 0.80
SetNameMethod · 0.65
AsTreeMethod · 0.65
UpdateMethod · 0.65

Tested by

no test coverage detected