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

Method ContextMenu

texteditor/diffbrowser/node.go:88–102  ·  view source on GitHub ↗
(m *core.Scene)

Source from the content-addressed store, hash-verified

86}
87
88func (tn *Node) ContextMenu(m *core.Scene) {
89 vd := core.NewButton(m).SetText("View Diffs").SetIcon(icons.Add)
90 vd.Styler(func(s *styles.Style) {
91 s.SetState(!tn.HasSelection(), states.Disabled)
92 })
93 vd.OnClick(func(e events.Event) {
94 br := tn.Browser()
95 if br == nil {
96 return
97 }
98 sels := tn.GetSelectedNodes()
99 sn := sels[len(sels)-1].(*Node)
100 br.ViewDiff(sn)
101 })
102}
103
104// DiffDirs creates a tree of files within the two paths,
105// where the files have the same names, yet differ in content.

Callers

nothing calls this directly

Calls 10

BrowserMethod · 0.95
NewButtonFunction · 0.92
StylerMethod · 0.80
GetSelectedNodesMethod · 0.80
ViewDiffMethod · 0.80
SetIconMethod · 0.65
SetTextMethod · 0.45
SetStateMethod · 0.45
HasSelectionMethod · 0.45
OnClickMethod · 0.45

Tested by

no test coverage detected