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

Method DropDeleteSource

core/tree.go:1550–1576  ·  view source on GitHub ↗

DropDeleteSource handles delete source event for DropMove case

(e events.Event)

Source from the content-addressed store, hash-verified

1548
1549// DropDeleteSource handles delete source event for DropMove case
1550func (tr *Tree) DropDeleteSource(e events.Event) {
1551 de := e.(*events.DragDrop)
1552 tr.UnselectAll()
1553 if tr.SyncNode != nil {
1554 tr.dropDeleteSourceSync(de)
1555 return
1556 }
1557 md := de.Data.(mimedata.Mimes)
1558 root := tr.root
1559 for _, d := range md {
1560 if d.Type != fileinfo.TextPlain { // link
1561 continue
1562 }
1563 path := string(d.Data)
1564 sn := root.FindPath(path)
1565 if sn != nil {
1566 sn.AsTree().Delete()
1567 }
1568 sn = root.FindPath(path + treeTempMovedTag)
1569 if sn != nil {
1570 psplt := strings.Split(path, "/")
1571 orgnm := psplt[len(psplt)-1]
1572 sn.AsTree().SetName(orgnm)
1573 AsWidget(sn).NeedsRender()
1574 }
1575 }
1576}

Callers

nothing calls this directly

Calls 9

UnselectAllMethod · 0.95
dropDeleteSourceSyncMethod · 0.95
AsWidgetFunction · 0.85
FindPathMethod · 0.80
SplitMethod · 0.80
NeedsRenderMethod · 0.80
DeleteMethod · 0.65
AsTreeMethod · 0.65
SetNameMethod · 0.65

Tested by

no test coverage detected