Only enable delete menu item for root nodes
This commit is contained in:
parent
b971952217
commit
9e258b71f4
|
@ -173,7 +173,11 @@ class QueryViewController: NSViewController {
|
||||||
extension QueryViewController: NSMenuItemValidation {
|
extension QueryViewController: NSMenuItemValidation {
|
||||||
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
|
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
|
||||||
if menuItem.action == #selector(deleteNode(_:)) {
|
if menuItem.action == #selector(deleteNode(_:)) {
|
||||||
return outlineView.clickedRow != -1
|
if outlineView.clickedRow != -1, let node = outlineView.item(atRow: outlineView.clickedRow) as? Node, node.parent == nil {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue