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

Method dropDeleteSourceSync

core/treesync.go:487–508  ·  view source on GitHub ↗

dropDeleteSourceSync handles delete source event for DropMove case, for Sync

(de *events.DragDrop)

Source from the content-addressed store, hash-verified

485
486// dropDeleteSourceSync handles delete source event for DropMove case, for Sync
487func (tr *Tree) dropDeleteSourceSync(de *events.DragDrop) {
488 md := de.Data.(mimedata.Mimes)
489 sroot := tr.root.SyncNode
490 for _, d := range md {
491 if d.Type != fileinfo.TextPlain { // link
492 continue
493 }
494 path := string(d.Data)
495 sn := sroot.AsTree().FindPath(path)
496 if sn != nil {
497 sn.AsTree().Delete()
498 }
499 sn = sroot.AsTree().FindPath(path + treeTempMovedTag)
500 if sn != nil {
501 psplt := strings.Split(path, "/")
502 orgnm := psplt[len(psplt)-1]
503 sn.AsTree().SetName(orgnm)
504 AsWidget(sn).NeedsRender()
505 }
506 }
507 tr.sendChangeEventReSync(nil)
508}

Callers 1

DropDeleteSourceMethod · 0.95

Calls 8

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

Tested by

no test coverage detected